LP simplifier for removing uneccessary row/columns. More...
#include <spxmainsm.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. 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, Real remainingTime, bool keepbounds=false, uint32_t seed=0) |
simplify SPxLPBase<R> lp . 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 void | setTolerances (std::shared_ptr< Tolerances > newTolerances) |
set the _tolerances member variable More... | |
const std::shared_ptr< Tolerances > | tolerances () const |
get the _tolerances member variable More... | |
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... | |
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... | |
std::shared_ptr< Tolerances > | _tolerances |
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 71 of file spxmainsm.h.
|
private |
Definition at line 1309 of file spxmainsm.h.
SPxMainSM | ( | Timer::TYPE | ttype = Timer::USER_TIME | ) |
Definition at line 1469 of file spxmainsm.h.
Referenced by SPxMainSM< R >::clone().
copy constructor.
Definition at line 1481 of file spxmainsm.h.
|
virtual |
destructor.
Definition at line 1532 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 1439 of file spxmainsm.h.
References SPxMainSM< R >::m_cIdx.
|
virtual |
clone function for polymorphism
Implements SPxSimplifier< R >.
Definition at line 1537 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 1448 of file spxmainsm.h.
References SPxSimplifier< R >::tolerances().
|
protected |
Definition at line 1453 of file spxmainsm.h.
References SPxSimplifier< R >::tolerances().
|
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 1604 of file spxmainsm.h.
References SPxMainSM< R >::m_cBasisStat, SPxMainSM< R >::m_postsolved, and SPxMainSM< R >::m_rBasisStat.
|
virtual |
gets basis status for a single column.
Implements SPxSimplifier< R >.
Definition at line 1598 of file spxmainsm.h.
References SPxMainSM< R >::m_cBasisStat, and SPxMainSM< R >::m_postsolved.
|
virtual |
gets basis status for a single row.
Implements SPxSimplifier< R >.
Definition at line 1592 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved, and SPxMainSM< R >::m_rBasisStat.
|
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 1563 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved.
|
private |
performs multi-aggregations of variable based upon constraint activitu.
assignment operator
Definition at line 1504 of file spxmainsm.h.
References SPxMainSM< R >::m_addedcols, SPxMainSM< R >::m_cBasisStat, SPxMainSM< R >::m_cIdx, SPxMainSM< R >::m_cutoffbound, SPxMainSM< R >::m_dual, SPxMainSM< R >::m_hist, SPxMainSM< R >::m_keepbounds, SPxMainSM< R >::m_postsolved, SPxMainSM< R >::m_prim, SPxMainSM< R >::m_pseudoobj, SPxMainSM< R >::m_rBasisStat, SPxMainSM< R >::m_redCost, SPxMainSM< R >::m_result, SPxMainSM< R >::m_rIdx, SPxMainSM< R >::m_slack, SPxMainSM< R >::m_stat, SPxMainSM< R >::m_thesense, and SPxSimplifier< R >::operator=().
|
protected |
Definition at line 1458 of file spxmainsm.h.
References SPxSimplifier< R >::tolerances().
|
private |
tightens variable bounds by propagating the pseudo objective function value.
|
private |
removes a column in the LP.
Definition at line 1428 of file spxmainsm.h.
References SPxMainSM< R >::m_cIdx, SPxLPBase< R >::nCols(), and SPxLPBase< R >::removeCol().
|
private |
removed empty rows and empty columns.
|
private |
removes a row in the LP.
Definition at line 1422 of file spxmainsm.h.
References SPxMainSM< R >::m_rIdx, SPxLPBase< R >::nRows(), and SPxLPBase< R >::removeRow().
|
private |
remove row singletons.
|
virtual |
returns result status of the simplification
Implements SPxSimplifier< R >.
Definition at line 1557 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 1434 of file spxmainsm.h.
References SPxMainSM< R >::m_rIdx.
|
virtual |
simplify SPxLPBase<R> lp
.
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 1574 of file spxmainsm.h.
References SPxMainSM< R >::m_dual, and SPxMainSM< R >::m_postsolved.
|
virtual |
returns a reference to the unsimplified primal solution.
Implements SPxSimplifier< R >.
Definition at line 1568 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved, and SPxMainSM< R >::m_prim.
|
virtual |
returns a reference to the unsimplified reduced costs.
Implements SPxSimplifier< R >.
Definition at line 1586 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved, and SPxMainSM< R >::m_redCost.
|
virtual |
returns a reference to the unsimplified slack values.
Implements SPxSimplifier< R >.
Definition at line 1580 of file spxmainsm.h.
References SPxMainSM< R >::m_postsolved, and SPxMainSM< R >::m_slack.
|
virtual |
reconstructs an optimal solution for the unsimplified LP.
Implements SPxSimplifier< R >.
|
friend |
Definition at line 1302 of file spxmainsm.h.
|
friend |
Definition at line 1299 of file spxmainsm.h.
|
friend |
Definition at line 1301 of file spxmainsm.h.
|
friend |
Definition at line 1300 of file spxmainsm.h.
|
friend |
Definition at line 1291 of file spxmainsm.h.
|
friend |
Definition at line 1295 of file spxmainsm.h.
|
friend |
Definition at line 1294 of file spxmainsm.h.
|
friend |
Definition at line 1293 of file spxmainsm.h.
|
friend |
Definition at line 1298 of file spxmainsm.h.
|
friend |
Definition at line 1290 of file spxmainsm.h.
|
friend |
Definition at line 1296 of file spxmainsm.h.
|
friend |
Definition at line 1292 of file spxmainsm.h.
|
friend |
Definition at line 1297 of file spxmainsm.h.
|
private |
columns added by handleRowObjectives()
Definition at line 1356 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
basis status of columns.
Definition at line 1339 of file spxmainsm.h.
Referenced by SPxMainSM< R >::getBasis(), SPxMainSM< R >::getBasisColStatus(), and SPxMainSM< R >::operator=().
|
private |
column index VectorBase<R> in original LP.
Definition at line 1341 of file spxmainsm.h.
Referenced by SPxMainSM< R >::cIdx(), SPxMainSM< R >::operator=(), and SPxMainSM< R >::removeCol().
|
private |
stores parallel classes with non-zero row entry
Definition at line 1347 of file spxmainsm.h.
|
private |
stores parallel classes with non-zero colum entry
Definition at line 1345 of file spxmainsm.h.
|
private |
the cutoff bound that is found by heuristics
Definition at line 1358 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
unsimplified dual solution VectorBase<R>.
Definition at line 1337 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), and SPxMainSM< R >::unsimplifiedDual().
|
private |
arrange duplicate columns w.r.t. their pClass values
Definition at line 1351 of file spxmainsm.h.
|
private |
arrange duplicate rows using bucket sort w.r.t. their pClass values
Definition at line 1349 of file spxmainsm.h.
VectorBase<R> of presolve history.
Definition at line 1343 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
keep some bounds (for boundflipping)
Definition at line 1355 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
status of postsolving.
Definition at line 1352 of file spxmainsm.h.
Referenced by SPxMainSM< R >::getBasis(), SPxMainSM< R >::getBasisColStatus(), SPxMainSM< R >::getBasisRowStatus(), SPxMainSM< R >::isUnsimplified(), SPxMainSM< R >::operator=(), SPxMainSM< R >::unsimplifiedDual(), SPxMainSM< R >::unsimplifiedPrimal(), SPxMainSM< R >::unsimplifiedRedCost(), and SPxMainSM< R >::unsimplifiedSlacks().
|
private |
unsimplified primal solution VectorBase<R>.
Definition at line 1335 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), and SPxMainSM< R >::unsimplifiedPrimal().
|
private |
the pseudo objective function value
Definition at line 1359 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
basis status of rows.
Definition at line 1340 of file spxmainsm.h.
Referenced by SPxMainSM< R >::getBasis(), SPxMainSM< R >::getBasisRowStatus(), and SPxMainSM< R >::operator=().
|
private |
unsimplified reduced cost VectorBase<R>.
Definition at line 1338 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), and SPxMainSM< R >::unsimplifiedRedCost().
|
private |
result of the simplification.
Definition at line 1357 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), and SPxMainSM< R >::result().
|
private |
row index VectorBase<R> in original LP.
Definition at line 1342 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), SPxMainSM< R >::removeRow(), and SPxMainSM< R >::rIdx().
|
private |
unsimplified slack VectorBase<R>.
Definition at line 1336 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=(), and SPxMainSM< R >::unsimplifiedSlacks().
|
private |
preprocessing history.
Definition at line 1353 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().
|
private |
optimization sense.
Definition at line 1354 of file spxmainsm.h.
Referenced by SPxMainSM< R >::operator=().