LP simplifier for removing uneccessary row/columns.This SPxSimplifier is mainly based on the paper "Presolving in linear programming" by E. Andersen and K. Andersen (Mathematical Programming, 1995). It implements all proposed methods and some other preprocessing techniques for removing redundant rows and columns and bounds. Also infeasibility and unboundedness may be detected. More...
#include <spxlpbase.h>
Classes | |
class | AggregationPS |
Postsolves aggregation. More... | |
class | DoubletonEquationPS |
Postsolves doubleton equations combined with a column singleton. More... | |
class | DuplicateColsPS |
Postsolves duplicate columns. More... | |
class | DuplicateRowsPS |
Postsolves duplicate rows. More... | |
struct | ElementCompare |
comparator for class SVectorBase<R>::Element: compare nonzeros according to value More... | |
class | EmptyConstraintPS |
Postsolves empty constraints. More... | |
class | FixBoundsPS |
Postsolves variable bound fixing. More... | |
class | FixVariablePS |
Postsolves variable fixing. More... | |
class | ForceConstraintPS |
Postsolves forcing constraints. More... | |
class | FreeColSingletonPS |
Postsolves free column singletons. More... | |
class | FreeConstraintPS |
Postsolves unconstraint constraints. More... | |
class | FreeZeroObjVariablePS |
Postsolves the case when constraints are removed due to a variable with zero objective that is free in one direction. More... | |
struct | IdxCompare |
comparator for class SVectorBase<R>::Element: compare nonzeros according to index More... | |
class | MultiAggregationPS |
Postsolves multi aggregation. More... | |
class | PostStep |
Base class for postsolving operations.Class PostStep is an abstract base class providing the interface for operations in the postsolving process. More... | |
class | RowObjPS |
Postsolves row objectives. More... | |
class | RowSingletonPS |
Postsolves row singletons. More... | |
class | TightenBoundsPS |
Postsolves variable bound tightening from pseudo objective propagation. More... | |
class | ZeroObjColSingletonPS |
Postsolves column singletons with zero objective. More... | |
Public Member Functions | |
Constructors / destructors | |
default constructor. | |
SPxMainSM (Timer::TYPE ttype=Timer::USER_TIME) | |
SPxMainSM (const SPxMainSM &old) | |
copy constructor. More... | |
SPxMainSM & | operator= (const SPxMainSM &rhs) |
assignment operator More... | |
virtual | ~SPxMainSM () |
destructor. More... | |
virtual SPxSimplifier< R > * | clone () const |
clone function for polymorphism More... | |
virtual SPxSimplifier< R >::Result | simplify (SPxLPBase< R > &lp, R eps, R delta, Real remainingTime) |
simplify SPxLPBase<R> lp with identical primal and dual feasibility tolerance. More... | |
virtual SPxSimplifier< R >::Result | simplify (SPxLPBase< R > &lp, R eps, R ftol, R otol, Real remainingTime, bool keepbounds=false, uint32_t seed=0) |
simplify SPxLPBase<R> lp with independent primal and dual feasibility tolerance. More... | |
virtual void | unsimplify (const VectorBase< R > &x, const VectorBase< R > &y, const VectorBase< R > &s, const VectorBase< R > &r, const typename SPxSolverBase< R >::VarStatus rows[], const typename SPxSolverBase< R >::VarStatus cols[], bool isOptimal=true) |
reconstructs an optimal solution for the unsimplified LP. More... | |
virtual SPxSimplifier< R >::Result | result () const |
returns result status of the simplification More... | |
virtual bool | isUnsimplified () const |
specifies whether an optimal solution has already been unsimplified. More... | |
virtual const VectorBase< R > & | unsimplifiedPrimal () |
returns a reference to the unsimplified primal solution. More... | |
virtual const VectorBase< R > & | unsimplifiedDual () |
returns a reference to the unsimplified dual solution. More... | |
virtual const VectorBase< R > & | unsimplifiedSlacks () |
returns a reference to the unsimplified slack values. More... | |
virtual const VectorBase< R > & | unsimplifiedRedCost () |
returns a reference to the unsimplified reduced costs. More... | |
virtual SPxSolverBase< R >::VarStatus | getBasisRowStatus (int i) const |
gets basis status for a single row. More... | |
virtual SPxSolverBase< R >::VarStatus | getBasisColStatus (int j) const |
gets basis status for a single column. More... | |
virtual void | getBasis (typename SPxSolverBase< R >::VarStatus rows[], typename SPxSolverBase< R >::VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const |
get optimal basis. More... | |
Public Member Functions inherited from SPxSimplifier< R > | |
void | setOutstream (SPxOut &newOutstream) |
virtual const char * | getName () const |
get name of simplifier. More... | |
virtual R | timeUsed () const |
virtual R | getObjoffset () const |
get objective offset. More... | |
virtual void | addObjoffset (const R val) |
add objective offset. More... | |
virtual void | setMinReduction (const R minRed) |
set minimal reduction threshold to continue simplification More... | |
virtual bool | isConsistent () const |
consistency check More... | |
SPxSimplifier (const char *p_name, Timer::TYPE ttype=Timer::USER_TIME) | |
constructor More... | |
SPxSimplifier (const SPxSimplifier &old) | |
copy constructor More... | |
SPxSimplifier & | operator= (const SPxSimplifier &rhs) |
assignment operator More... | |
virtual | ~SPxSimplifier () |
destructor. More... | |
Protected Member Functions | |
R | epsZero () const |
R | feastol () const |
R | opttol () const |
Private Types | |
Types | |
Different simplification steps. | |
enum | SimpleStep { EMPTY_ROW = 0, FREE_ROW = 1, SINGLETON_ROW = 2, FORCE_ROW = 3, EMPTY_COL = 4, FIX_COL = 5, FREE_ZOBJ_COL = 6, ZOBJ_SINGLETON_COL = 7, DOUBLETON_ROW = 8, FREE_SINGLETON_COL = 9, DOMINATED_COL = 10, WEAKLY_DOMINATED_COL = 11, DUPLICATE_ROW = 12, FIX_DUPLICATE_COL = 13, SUB_DUPLICATE_COL = 14, AGGREGATION = 15, MULTI_AGG = 16 } |
Private Member Functions | |
Private helpers | |
handle row objectives | |
void | handleRowObjectives (SPxLPBase< R > &lp) |
void | handleExtremes (SPxLPBase< R > &lp) |
handles extreme values by setting them to zero or R(infinity). More... | |
void | computeMinMaxResidualActivity (SPxLPBase< R > &lp, int rowNumber, int colNumber, R &minAct, R &maxAct) |
computes the minimum and maximum residual activity for a given row and column. If colNumber is set to -1, then More... | |
void | computeMinMaxValues (SPxLPBase< R > &lp, R side, R val, R minRes, R maxRes, R &minVal, R &maxVal) |
calculate min/max value for the multi aggregated variables More... | |
void | trivialHeuristic (SPxLPBase< R > &lp) |
tries to find good lower bound solutions by applying some trivial heuristics More... | |
bool | checkSolution (SPxLPBase< R > &lp, VectorBase< R > sol) |
checks a solution for feasibility More... | |
void | propagatePseudoobj (SPxLPBase< R > &lp) |
tightens variable bounds by propagating the pseudo objective function value. More... | |
SPxSimplifier< R >::Result | removeEmpty (SPxLPBase< R > &lp) |
removed empty rows and empty columns. More... | |
SPxSimplifier< R >::Result | removeRowSingleton (SPxLPBase< R > &lp, const SVectorBase< R > &row, int &i) |
remove row singletons. More... | |
SPxSimplifier< R >::Result | aggregateVars (SPxLPBase< R > &lp, const SVectorBase< R > &row, int &i) |
aggregate two variables that appear in an equation. More... | |
SPxSimplifier< R >::Result | simplifyRows (SPxLPBase< R > &lp, bool &again) |
performs simplification steps on the rows of the LP. More... | |
SPxSimplifier< R >::Result | simplifyCols (SPxLPBase< R > &lp, bool &again) |
performs simplification steps on the columns of the LP. More... | |
SPxSimplifier< R >::Result | simplifyDual (SPxLPBase< R > &lp, bool &again) |
performs simplification steps on the LP based on dual concepts. More... | |
SPxSimplifier< R >::Result | multiaggregation (SPxLPBase< R > &lp, bool &again) |
performs multi-aggregations of variable based upon constraint activitu. More... | |
SPxSimplifier< R >::Result | duplicateRows (SPxLPBase< R > &lp, bool &again) |
removes duplicate rows. More... | |
SPxSimplifier< R >::Result | duplicateCols (SPxLPBase< R > &lp, bool &again) |
removes duplicate columns More... | |
void | fixColumn (SPxLPBase< R > &lp, int i, bool correctIdx=true) |
handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated. More... | |
void | removeRow (SPxLPBase< R > &lp, int i) |
removes a row in the LP. More... | |
void | removeCol (SPxLPBase< R > &lp, int j) |
removes a column in the LP. More... | |
int | rIdx (int i) const |
returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP. More... | |
int | cIdx (int j) const |
returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP. More... | |
Private Attributes | |
Data | |
VectorBase< R > | m_prim |
unsimplified primal solution VectorBase<R>. More... | |
VectorBase< R > | m_slack |
unsimplified slack VectorBase<R>. More... | |
VectorBase< R > | m_dual |
unsimplified dual solution VectorBase<R>. More... | |
VectorBase< R > | m_redCost |
unsimplified reduced cost VectorBase<R>. More... | |
DataArray< typename SPxSolverBase< R >::VarStatus > | m_cBasisStat |
basis status of columns. More... | |
DataArray< typename SPxSolverBase< R >::VarStatus > | m_rBasisStat |
basis status of rows. More... | |
DataArray< int > | m_cIdx |
column index VectorBase<R> in original LP. More... | |
DataArray< int > | m_rIdx |
row index VectorBase<R> in original LP. More... | |
Array< std::shared_ptr< PostStep > > | m_hist |
VectorBase<R> of presolve history. More... | |
Array< DSVectorBase< R > > | m_classSetRows |
stores parallel classes with non-zero colum entry More... | |
Array< DSVectorBase< R > > | m_classSetCols |
stores parallel classes with non-zero row entry More... | |
Array< DSVectorBase< R > > | m_dupRows |
arrange duplicate rows using bucket sort w.r.t. their pClass values More... | |
Array< DSVectorBase< R > > | m_dupCols |
arrange duplicate columns w.r.t. their pClass values More... | |
bool | m_postsolved |
status of postsolving. More... | |
R | m_epsilon |
epsilon zero. More... | |
R | m_feastol |
primal feasibility tolerance. More... | |
R | m_opttol |
dual feasibility tolerance. More... | |
DataArray< int > | m_stat |
preprocessing history. More... | |
SPxLPBase< R >::SPxSense | m_thesense |
optimization sense. More... | |
bool | m_keepbounds |
keep some bounds (for boundflipping) More... | |
int | m_addedcols |
columns added by handleRowObjectives() More... | |
SPxSimplifier< R >::Result | m_result |
result of the simplification. More... | |
R | m_cutoffbound |
the cutoff bound that is found by heuristics More... | |
R | m_pseudoobj |
the pseudo objective function value More... | |
Friends | |
class | FreeConstraintPS |
class | EmptyConstraintPS |
class | RowSingletonPS |
class | ForceConstraintPS |
class | FixVariablePS |
class | FixBoundsPS |
class | FreeZeroObjVariablePS |
class | ZeroObjColSingletonPS |
class | FreeColSingletonPS |
class | DoubletonEquationPS |
class | DuplicateRowsPS |
class | DuplicateColsPS |
class | AggregationPS |
Additional Inherited Members | |
Public Types inherited from SPxSimplifier< R > | |
enum | Result { OKAY = 0, INFEASIBLE = 1, DUAL_INFEASIBLE = 2, UNBOUNDED = 3, VANISHED = 4 } |
Result of the simplification. More... | |
Protected Attributes inherited from SPxSimplifier< R > | |
const char * | m_name |
name of the simplifier More... | |
Timer * | m_timeUsed |
user time used for simplification More... | |
Timer::TYPE | m_timerType |
int | m_remRows |
number of removed rows More... | |
int | m_remCols |
number of removed columns More... | |
int | m_remNzos |
number of removed nonzero coefficients More... | |
int | m_chgBnds |
number of changed bounds More... | |
int | m_chgLRhs |
number of change right-hand sides More... | |
int | m_keptBnds |
number of kept bounds More... | |
int | m_keptLRhs |
number of kept left- and right-hand sides More... | |
R | m_objoffset |
objective offset More... | |
R | m_minReduction |
minimal reduction (sum of removed rows/cols) to continue simplification More... | |
SPxOut * | spxout |
message handler More... | |
LP simplifier for removing uneccessary row/columns.
This SPxSimplifier is mainly based on the paper "Presolving in linear programming" by E. Andersen and K. Andersen (Mathematical Programming, 1995). It implements all proposed methods and some other preprocessing techniques for removing redundant rows and columns and bounds. Also infeasibility and unboundedness may be detected.
Removed are:
Definition at line 54 of file spxlpbase.h.
|
private |
Definition at line 1281 of file spxmainsm.h.
SPxMainSM | ( | Timer::TYPE | ttype = Timer::USER_TIME | ) |
Definition at line 1444 of file spxmainsm.h.
Referenced by SPxMainSM< R >::clone().
copy constructor.
Definition at line 1459 of file spxmainsm.h.
|
virtual |
destructor.
Definition at line 1516 of file spxmainsm.h.
|
private |
aggregate two variables that appear in an equation.
|
private |
checks a solution for feasibility
|
private |
returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP.
Definition at line 1414 of file spxmainsm.h.
|
virtual |
clone function for polymorphism
Implements SPxSimplifier< R >.
Definition at line 1521 of file spxmainsm.h.
References SPxMainSM< R >::SPxMainSM().
|
private |
computes the minimum and maximum residual activity for a given row and column. If colNumber is set to -1, then
|
private |
calculate min/max value for the multi aggregated variables
|
private |
removes duplicate columns
|
private |
removes duplicate rows.
|
protected |
Definition at line 1423 of file spxmainsm.h.
References SPxMainSM< R >::m_epsilon.
|
protected |
Definition at line 1428 of file spxmainsm.h.
References SPxMainSM< R >::m_feastol.
|
private |
handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated.
|
virtual |
get optimal basis.
Implements SPxSimplifier< R >.
Definition at line 1595 of file spxmainsm.h.
References DataArray< T >::size().
|
virtual |
gets basis status for a single column.
Implements SPxSimplifier< R >.
Definition at line 1589 of file spxmainsm.h.
|
virtual |
gets basis status for a single row.
Implements SPxSimplifier< R >.
Definition at line 1583 of file spxmainsm.h.
|
private |
handles extreme values by setting them to zero or R(infinity).
|
private |
|
virtual |
specifies whether an optimal solution has already been unsimplified.
Reimplemented from SPxSimplifier< R >.
Definition at line 1554 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved.
|
private |
performs multi-aggregations of variable based upon constraint activitu.
assignment operator
Definition at line 1485 of file spxmainsm.h.
References SPxSimplifier< R >::operator=().
|
protected |
Definition at line 1433 of file spxmainsm.h.
References SPxMainSM< R >::m_opttol.
|
private |
tightens variable bounds by propagating the pseudo objective function value.
|
private |
removes a column in the LP.
Definition at line 1403 of file spxmainsm.h.
References SPxLPBase< R >::nCols(), and SPxLPBase< R >::removeCol().
|
private |
removed empty rows and empty columns.
|
private |
removes a row in the LP.
Definition at line 1397 of file spxmainsm.h.
References SPxLPBase< R >::nRows(), and SPxLPBase< R >::removeRow().
|
private |
remove row singletons.
|
virtual |
returns result status of the simplification
Implements SPxSimplifier< R >.
Definition at line 1548 of file spxmainsm.h.
References SPxMainSM< R >::m_result.
|
private |
returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP.
Definition at line 1409 of file spxmainsm.h.
|
virtual |
simplify SPxLPBase<R> lp
with identical primal and dual feasibility tolerance.
Implements SPxSimplifier< R >.
Definition at line 1531 of file spxmainsm.h.
References SPxMainSM< R >::PostStep::eps(), and SPxMainSM< R >::unsimplify().
|
virtual |
simplify SPxLPBase<R> lp
with independent primal and dual feasibility tolerance.
Implements SPxSimplifier< R >.
|
private |
performs simplification steps on the columns of the LP.
|
private |
performs simplification steps on the LP based on dual concepts.
|
private |
performs simplification steps on the rows of the LP.
|
private |
tries to find good lower bound solutions by applying some trivial heuristics
|
virtual |
returns a reference to the unsimplified dual solution.
Implements SPxSimplifier< R >.
Definition at line 1565 of file spxmainsm.h.
References SPxMainSM< R >::m_dual.
|
virtual |
returns a reference to the unsimplified primal solution.
Implements SPxSimplifier< R >.
Definition at line 1559 of file spxmainsm.h.
References SPxMainSM< R >::m_prim.
|
virtual |
returns a reference to the unsimplified reduced costs.
Implements SPxSimplifier< R >.
Definition at line 1577 of file spxmainsm.h.
References SPxMainSM< R >::m_redCost.
|
virtual |
returns a reference to the unsimplified slack values.
Implements SPxSimplifier< R >.
Definition at line 1571 of file spxmainsm.h.
References SPxMainSM< R >::m_slack.
|
virtual |
reconstructs an optimal solution for the unsimplified LP.
Implements SPxSimplifier< R >.
Referenced by SPxMainSM< R >::simplify().
|
friend |
Definition at line 1274 of file spxmainsm.h.
Referenced by SPxMainSM< R >::AggregationPS::clone().
|
friend |
Definition at line 1271 of file spxmainsm.h.
Referenced by SPxMainSM< R >::DoubletonEquationPS::clone().
|
friend |
Definition at line 1273 of file spxmainsm.h.
Referenced by SPxMainSM< R >::DuplicateColsPS::clone().
|
friend |
Definition at line 1272 of file spxmainsm.h.
Referenced by SPxMainSM< R >::DuplicateRowsPS::clone().
|
friend |
Definition at line 1263 of file spxmainsm.h.
Referenced by SPxMainSM< R >::EmptyConstraintPS::clone().
|
friend |
Definition at line 1267 of file spxmainsm.h.
Referenced by SPxMainSM< R >::FixBoundsPS::clone().
|
friend |
Definition at line 1266 of file spxmainsm.h.
Referenced by SPxMainSM< R >::FixVariablePS::clone().
|
friend |
Definition at line 1265 of file spxmainsm.h.
Referenced by SPxMainSM< R >::ForceConstraintPS::clone().
|
friend |
Definition at line 1270 of file spxmainsm.h.
Referenced by SPxMainSM< R >::FreeColSingletonPS::clone().
|
friend |
Definition at line 1262 of file spxmainsm.h.
Referenced by SPxMainSM< R >::FreeConstraintPS::clone().
|
friend |
Definition at line 1268 of file spxmainsm.h.
Referenced by SPxMainSM< R >::FreeZeroObjVariablePS::clone().
|
friend |
Definition at line 1264 of file spxmainsm.h.
Referenced by SPxMainSM< R >::RowSingletonPS::clone().
|
friend |
Definition at line 1269 of file spxmainsm.h.
Referenced by SPxMainSM< R >::ZeroObjColSingletonPS::clone().
|
private |
columns added by handleRowObjectives()
Definition at line 1331 of file spxmainsm.h.
|
private |
basis status of columns.
Definition at line 1311 of file spxmainsm.h.
|
private |
column index VectorBase<R> in original LP.
Definition at line 1313 of file spxmainsm.h.
|
private |
stores parallel classes with non-zero row entry
Definition at line 1319 of file spxmainsm.h.
|
private |
stores parallel classes with non-zero colum entry
Definition at line 1317 of file spxmainsm.h.
|
private |
the cutoff bound that is found by heuristics
Definition at line 1333 of file spxmainsm.h.
|
private |
unsimplified dual solution VectorBase<R>.
Definition at line 1309 of file spxmainsm.h.
Referenced by SPxMainSM< R >::unsimplifiedDual().
|
private |
arrange duplicate columns w.r.t. their pClass values
Definition at line 1323 of file spxmainsm.h.
|
private |
arrange duplicate rows using bucket sort w.r.t. their pClass values
Definition at line 1321 of file spxmainsm.h.
|
private |
|
private |
primal feasibility tolerance.
Definition at line 1326 of file spxmainsm.h.
Referenced by SPxMainSM< R >::feastol().
VectorBase<R> of presolve history.
Definition at line 1315 of file spxmainsm.h.
|
private |
keep some bounds (for boundflipping)
Definition at line 1330 of file spxmainsm.h.
|
private |
dual feasibility tolerance.
Definition at line 1327 of file spxmainsm.h.
Referenced by SPxMainSM< R >::opttol().
|
private |
status of postsolving.
Definition at line 1324 of file spxmainsm.h.
Referenced by SPxMainSM< R >::isUnsimplified().
|
private |
unsimplified primal solution VectorBase<R>.
Definition at line 1307 of file spxmainsm.h.
Referenced by SPxMainSM< R >::unsimplifiedPrimal().
|
private |
the pseudo objective function value
Definition at line 1334 of file spxmainsm.h.
|
private |
basis status of rows.
Definition at line 1312 of file spxmainsm.h.
|
private |
unsimplified reduced cost VectorBase<R>.
Definition at line 1310 of file spxmainsm.h.
Referenced by SPxMainSM< R >::unsimplifiedRedCost().
|
private |
result of the simplification.
Definition at line 1332 of file spxmainsm.h.
Referenced by SPxMainSM< R >::result().
|
private |
row index VectorBase<R> in original LP.
Definition at line 1314 of file spxmainsm.h.
|
private |
unsimplified slack VectorBase<R>.
Definition at line 1308 of file spxmainsm.h.
Referenced by SPxMainSM< R >::unsimplifiedSlacks().
|
private |
preprocessing history.
Definition at line 1328 of file spxmainsm.h.
|
private |
optimization sense.
Definition at line 1329 of file spxmainsm.h.