PIPS-IPM++ Solver and Tools
a parallel interior-point method for doubly bordered block diagonal linear programs
PIPSIPMppInterface Class Reference

The main interface class for PIPS-IPM++. More...

#include <PIPSIPMppInterface.hpp>

Public Member Functions

 PIPSIPMppInterface (DistributedInputTree *tree, MPI_Comm comm=MPI_COMM_WORLD, const std::string &settings="PIPSIPMpp.opt")
 Constructor for PIPSIPMppInterface.
 ~PIPSIPMppInterface ()
 Destructor.
TerminationStatus run ()
 Runs the complete solution process (presolve, solve, postsolve).
TerminationStatus presolve ()
 Runs the presolve step.
TerminationStatus termination_status () const
 Gets the current termination status.
double getObjective ()
 Gets the objective value of the solved problem.
int n_iterations () const
 Gets the number of iterations performed by the solver.
double getRootObjective () const
 Gets the block 0 (the root) objective value.
std::vector< double > gatherPrimalSolution ()
 Gathers the primal solution from all processes.
std::vector< double > gatherDualSolutionEq ()
 Gathers the dual solution for equality constraints from all processes.
std::vector< double > gatherDualSolutionIneq ()
 Gathers the dual solution for inequality constraints from all processes.
std::vector< double > gatherDualSolutionIneqUpp ()
 Gathers the dual solution for upper bounds on inequality constraints from all processes.
std::vector< double > gatherDualSolutionIneqLow ()
 Gathers the dual solution for lower bounds on inequality constraints from all processes.
std::vector< double > gatherDualSolutionVarBounds ()
 Gathers the dual solution for variable bounds from all processes.
std::vector< double > gatherDualSolutionVarBoundsUpp ()
 Gathers the dual solution for upper bounds on variables from all processes.
std::vector< double > gatherDualSolutionVarBoundsLow ()
 Gathers the dual solution for lower bounds on variables from all processes.
std::vector< double > gatherSlacksInequalityUp ()
 Gathers the slack variables for upper bounds on inequality constraints from all processes.
std::vector< double > gatherSlacksInequalityLow ()
 Gathers the slack variables for lower bounds on inequality constraints from all processes.
std::vector< double > gatherSlacksVarsUp ()
 Gathers the slack variables for upper bounds on variables from all processes.
std::vector< double > gatherSlacksVarsLow ()
 Gathers the slack variables for lower bounds on variables from all processes.
std::vector< double > gatherPrimalResidsEQ ()
 Gathers the primal residuals for equality constraints from all processes.
std::vector< double > gatherPrimalResidsIneqUp ()
 Gathers the primal residuals for upper bounds on inequality constraints from all processes.
std::vector< double > gatherPrimalResidsIneqLow ()
 Gathers the primal residuals for lower bounds on inequality constraints from all processes.
std::vector< double > gatherDualResids ()
 Gathers the dual residuals (gradient of the Lagrangian) from all processes.
std::vector< double > getRootPrimalColSolution () const
 Gets the block 0 (the root) primal column solution from the current process.
std::vector< double > getBlockPrimalColSolution (int block) const
 Gets the primal column solution for the given block from the current process.
void allgatherBlocksizes (std::vector< unsigned int > &block_lengths_col, std::vector< unsigned int > &block_lengths_A, std::vector< unsigned int > &block_lengths_C) const
 Gathers the sizes of all blocks from all processes.
void postsolveComputedSolution ()
 Postsolves the computed solution to obtain the solution to the original problem.
std::vector< double > gatherEqualityConsValues ()
 Gathers the values of the equality constraints Ax-b from all processes.
std::vector< double > gatherInequalityConsValues ()
 Gathers the values of the inequality constraints Cx-d from all processes.
void getVarsUnscaledUnperm ()
 Gets the unscaled and unpermuted variables.
void getResidsUnscaledUnperm ()
 Gets the unscaled and unpermuted residuals.

Static Public Member Functions

static void reset_print ()
 Resets the printing behavior of PIPS-IPM++.
static void print_banner (std::ostream &out)
 Prints the PIPS-IPM++ version banner.

Protected Attributes

std::unique_ptr< DistributedFactory > factory
 Factory for creating problem-related objects.
std::unique_ptr< Problem > presolved_problem
 The problem after presolving (possibly the same as original).
std::unique_ptr< Problem > dataUnpermNotHier
 Data after presolve but before permutation, scaling, and hierarchical data structure creation.
std::unique_ptr< Problem > original_problem
 The original problem data.
std::unique_ptr< Variables > variables
 Variables of the (presolved) problem.
std::unique_ptr< Variables > unscaleUnpermNotHierVars
 Unscaled and unpermuted variables.
std::unique_ptr< Variables > postsolved_variables
 Variables of the original problem after postsolving.
std::unique_ptr< Residuals > residuals
 Residuals of the (presolved) problem.
std::unique_ptr< Residuals > unscaleUnpermNotHierResids
 Unscaled and unpermuted residuals.
std::unique_ptr< Residuals > postsolvedResids
 Residuals after postsolving.
std::unique_ptr< Presolver > presolver
 The presolver instance.
std::unique_ptr< Postsolver > postsolver
 The postsolver instance.
std::unique_ptr< Scaler > scaler
 The scaler instance.
std::unique_ptr< PIPSIPMppSolver > solver
 The main solver instance.
MPI_Comm comm = MPI_COMM_NULL
 The MPI communicator.
const int my_rank = -1
 The rank of the current MPI process.
TerminationStatus result {TerminationStatus::DID_NOT_RUN}
 The result status of the solution process.
bool ran_solver = false
 Flag indicating whether the solver has been run.

Detailed Description

The main interface class for PIPS-IPM++.

This class provides a high-level interface for setting up and solving block structured linear optimization problems using the PIPS-IPM++ solver. It handles problem reading, presolving, solving, and postsolving.

Constructor & Destructor Documentation

◆ PIPSIPMppInterface()

PIPSIPMppInterface::PIPSIPMppInterface ( DistributedInputTree * tree,
MPI_Comm comm = MPI_COMM_WORLD,
const std::string & settings = "PIPSIPMpp.opt" )

Constructor for PIPSIPMppInterface.

Parameters
treeThe distributed input tree defining the problem structure.
commThe MPI communicator.
settingsThe path to the settings file.

Member Function Documentation

◆ allgatherBlocksizes()

void PIPSIPMppInterface::allgatherBlocksizes ( std::vector< unsigned int > & block_lengths_col,
std::vector< unsigned int > & block_lengths_A,
std::vector< unsigned int > & block_lengths_C ) const

Gathers the sizes of all blocks from all processes.

Parameters
[out]block_lengths_colVector to store column block lengths.
[out]block_lengths_AVector to store equality constraint block lengths.
[out]block_lengths_CVector to store inequality constraint block lengths.

◆ gatherDualResids()

std::vector< double > PIPSIPMppInterface::gatherDualResids ( )

Gathers the dual residuals (gradient of the Lagrangian) from all processes.

Returns
A vector containing the dual residuals.

◆ gatherDualSolutionEq()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionEq ( )

Gathers the dual solution for equality constraints from all processes.

Returns
A vector containing the dual solution for equality constraints.

◆ gatherDualSolutionIneq()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionIneq ( )

Gathers the dual solution for inequality constraints from all processes.

Returns
A vector containing the dual solution for inequality constraints.

◆ gatherDualSolutionIneqLow()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionIneqLow ( )

Gathers the dual solution for lower bounds on inequality constraints from all processes.

Returns
A vector containing the duals.

◆ gatherDualSolutionIneqUpp()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionIneqUpp ( )

Gathers the dual solution for upper bounds on inequality constraints from all processes.

Returns
A vector containing the duals.

◆ gatherDualSolutionVarBounds()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionVarBounds ( )

Gathers the dual solution for variable bounds from all processes.

Returns
A vector containing the duals.

◆ gatherDualSolutionVarBoundsLow()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionVarBoundsLow ( )

Gathers the dual solution for lower bounds on variables from all processes.

Returns
A vector containing the duals.

◆ gatherDualSolutionVarBoundsUpp()

std::vector< double > PIPSIPMppInterface::gatherDualSolutionVarBoundsUpp ( )

Gathers the dual solution for upper bounds on variables from all processes.

Returns
A vector containing the duals.

◆ gatherEqualityConsValues()

std::vector< double > PIPSIPMppInterface::gatherEqualityConsValues ( )

Gathers the values of the equality constraints Ax-b from all processes.

Returns
A vector containing the constraint values.

◆ gatherInequalityConsValues()

std::vector< double > PIPSIPMppInterface::gatherInequalityConsValues ( )

Gathers the values of the inequality constraints Cx-d from all processes.

Returns
A vector containing the constraint values.

◆ gatherPrimalResidsEQ()

std::vector< double > PIPSIPMppInterface::gatherPrimalResidsEQ ( )

Gathers the primal residuals for equality constraints from all processes.

Returns
A vector containing the residuals.

◆ gatherPrimalResidsIneqLow()

std::vector< double > PIPSIPMppInterface::gatherPrimalResidsIneqLow ( )

Gathers the primal residuals for lower bounds on inequality constraints from all processes.

Returns
A vector containing the residuals.

◆ gatherPrimalResidsIneqUp()

std::vector< double > PIPSIPMppInterface::gatherPrimalResidsIneqUp ( )

Gathers the primal residuals for upper bounds on inequality constraints from all processes.

Returns
A vector containing the residuals.

◆ gatherPrimalSolution()

std::vector< double > PIPSIPMppInterface::gatherPrimalSolution ( )

Gathers the primal solution from all processes.

Returns
A vector containing the primal solution.

◆ gatherSlacksInequalityLow()

std::vector< double > PIPSIPMppInterface::gatherSlacksInequalityLow ( )

Gathers the slack variables for lower bounds on inequality constraints from all processes.

Returns
A vector containing the slack variables.

◆ gatherSlacksInequalityUp()

std::vector< double > PIPSIPMppInterface::gatherSlacksInequalityUp ( )

Gathers the slack variables for upper bounds on inequality constraints from all processes.

Returns
A vector containing the slack variables.

◆ gatherSlacksVarsLow()

std::vector< double > PIPSIPMppInterface::gatherSlacksVarsLow ( )

Gathers the slack variables for lower bounds on variables from all processes.

Returns
A vector containing the slack variables.

◆ gatherSlacksVarsUp()

std::vector< double > PIPSIPMppInterface::gatherSlacksVarsUp ( )

Gathers the slack variables for upper bounds on variables from all processes.

Returns
A vector containing the slack variables.

◆ getBlockPrimalColSolution()

std::vector< double > PIPSIPMppInterface::getBlockPrimalColSolution ( int block) const
nodiscard

Gets the primal column solution for the given block from the current process.

Parameters
blockThe block index.
Returns
A vector containing the local part of the block solution.

◆ getObjective()

double PIPSIPMppInterface::getObjective ( )

Gets the objective value of the solved problem.

Returns
The objective value.

◆ getRootObjective()

double PIPSIPMppInterface::getRootObjective ( ) const
nodiscard

Gets the block 0 (the root) objective value.

Returns
The block 0 objective value.

◆ getRootPrimalColSolution()

std::vector< double > PIPSIPMppInterface::getRootPrimalColSolution ( ) const
nodiscard

Gets the block 0 (the root) primal column solution from the current process.

Returns
A vector containing the local part of the block 0 solution.

◆ n_iterations()

int PIPSIPMppInterface::n_iterations ( ) const
nodiscard

Gets the number of iterations performed by the solver.

Returns
The number of iterations, or -1 if the solver did not run.

◆ presolve()

TerminationStatus PIPSIPMppInterface::presolve ( )

Runs the presolve step.

Returns
The termination status of the presolve step.

◆ print_banner()

void PIPSIPMppInterface::print_banner ( std::ostream & out)
static

Prints the PIPS-IPM++ version banner.

Parameters
outThe output stream to print to.

◆ reset_print()

void PIPSIPMppInterface::reset_print ( )
static

Resets the printing behavior of PIPS-IPM++.

Many components (such as linear solvers, linear systems ...) track via static variables that print exactly once during a run. In order to reset these, call reset_print() between PIPS-IPM++ runs.

◆ run()

TerminationStatus PIPSIPMppInterface::run ( )

Runs the complete solution process (presolve, solve, postsolve).

Returns
The termination status of the solver.

◆ termination_status()

TerminationStatus PIPSIPMppInterface::termination_status ( ) const

Gets the current termination status.

Returns
The termination status.