|
SoPlex Doxygen Documentation
|
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 unboundness may be detected.
More...
#include <spxmainsm.h>
|
|
| SPxMainSM () |
| default constructor.
|
|
| SPxMainSM (const SPxMainSM &old) |
| copy constructor.
|
|
SPxMainSM & | operator= (const SPxMainSM &rhs) |
| assignment operator
|
|
virtual | ~SPxMainSM () |
| destructor.
|
|
virtual SPxSimplifier * | clone () const |
| clone function for polymorphism
|
|
|
virtual Result | simplify (SPxLP &lp, Real eps, Real delta) |
| simplify SPxLP lp with identical primal and dual feasibility tolerance.
|
|
virtual Result | simplify (SPxLP &lp, Real eps, Real feastol, Real opttol) |
| simplify SPxLP lp with independent primal and dual feasibility tolerance.
|
|
virtual void | unsimplify (const Vector &x, const Vector &y, const Vector &s, const Vector &r, const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[]) |
| reconstructs an optimal solution for the unsimplified LP.
|
|
virtual bool | isUnsimplified () const |
| specifies whether an optimal solution has already been unsimplified.
|
|
virtual const Vector & | unsimplifiedPrimal () |
| returns a reference to the unsimplified primal solution.
|
|
virtual const Vector & | unsimplifiedDual () |
| returns a reference to the unsimplified dual solution.
|
|
virtual const Vector & | unsimplifiedSlacks () |
| returns a reference to the unsimplified slack values.
|
|
virtual const Vector & | unsimplifiedRedCost () |
| returns a reference to the unsimplified reduced costs.
|
|
virtual SPxSolver::VarStatus | getBasisRowStatus (int i) const |
| gets basis status for a single row.
|
|
virtual SPxSolver::VarStatus | getBasisColStatus (int j) const |
| gets basis status for a single column.
|
|
virtual void | getBasis (SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[]) const |
| get optimal basis.
|
|
virtual const char * | getName () const |
| get name of simplifier.
|
|
virtual Real | timeUsed () const |
|
virtual Real | getObjoffset () const |
| get objective offset.
|
|
virtual void | addObjoffset (const Real val) |
| add objective offset.
|
|
virtual bool | isConsistent () const |
| consistency check
|
|
| SPxSimplifier (const char *p_name) |
| constructor
|
|
| SPxSimplifier (const SPxSimplifier &old) |
| copy constructor
|
|
SPxSimplifier & | operator= (const SPxSimplifier &rhs) |
| assignment operator
|
|
virtual | ~SPxSimplifier () |
| destructor.
|
|
|
|
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
} |
| Different simplification steps. More...
|
|
|
|
void | handleExtremes (SPxLP &lp) |
| handles extreme values by setting them to zero or infinity.
|
|
Result | removeEmpty (SPxLP &lp) |
| removed empty rows and empty columns.
|
|
Result | removeRowSingleton (SPxLP &lp, const SVector &row, int &i) |
| remove row singletons.
|
|
Result | simplifyRows (SPxLP &lp, bool &again) |
| performs simplification steps on the rows of the LP.
|
|
Result | simplifyCols (SPxLP &lp, bool &again) |
| performs simplification steps on the columns of the LP.
|
|
Result | simplifyDual (SPxLP &lp, bool &again) |
| performs simplification steps on the LP based on dual concepts.
|
|
Result | duplicateRows (SPxLP &lp, bool &again) |
| removes duplicate rows.
|
|
Result | duplicateCols (SPxLP &lp, bool &again) |
| removes duplicate columns
|
|
void | fixColumn (SPxLP &lp, int i, bool correctIdx=true) |
| handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated.
|
|
void | removeRow (SPxLP &lp, int i) |
| removes a row in the LP.
|
|
void | removeCol (SPxLP &lp, int j) |
| removes a column in the LP.
|
|
int | rIdx (int i) const |
| returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP.
|
|
int | cIdx (int j) const |
| returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP.
|
|
Real | epsZero () const |
|
Real | feastol () const |
|
Real | opttol () const |
|
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 unboundness may be detected.
Removed are:
- empty rows / columns
- unconstraint rows
- row singletons
- forcing rows
- zero objective column singletons
- (implied) free column singletons
- doubleton equations combined with a column singleton
- (implicitly) fixed columns
- redundant lhs / rhs
- redundant variable bounds
- variables that are free in one direction
- (weakly) dominated columns
- duplicate rows / columns
Definition at line 60 of file spxmainsm.h.
Different simplification steps.
Enumerator |
---|
EMPTY_ROW |
|
FREE_ROW |
|
SINGLETON_ROW |
|
FORCE_ROW |
|
EMPTY_COL |
|
FIX_COL |
|
FREE_ZOBJ_COL |
|
ZOBJ_SINGLETON_COL |
|
DOUBLETON_ROW |
|
FREE_SINGLETON_COL |
|
DOMINATED_COL |
|
WEAKLY_DOMINATED_COL |
|
DUPLICATE_ROW |
|
FIX_DUPLICATE_COL |
|
SUB_DUPLICATE_COL |
|
Definition at line 965 of file spxmainsm.h.
removes duplicate columns
Definition at line 3121 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::changeLower(), SPxLP::changeUpper(), Array< T >::clear(), SPxLP::colVector(), SPxMainSM::DuplicateColsPS, SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SPxMainSM::FIX_DUPLICATE_COL, SPxMainSM::fixColumn(), soplex::GErel(), SVector::index(), soplex::infinity, soplex::isNotZero(), soplex::isZero(), soplex::LErel(), SPxLP::lower(), SPxMainSM::m_cIdx, SPxMainSM::m_hist, SPxSimplifier::m_remCols, SPxSimplifier::m_remNzos, SPxMainSM::m_stat, SPxLP::maxObj(), METHOD, MSG_INFO2, MSG_INFO3, SPxLP::nCols(), soplex::NErel(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxLP::removeCols(), SPxMainSM::removeEmpty(), SPxLP::rowVector(), SVector::size(), soplex::sorter_qsort(), soplex::spx_alloc(), soplex::spx_free(), soplex::spxout, SPxMainSM::SUB_DUPLICATE_COL, SPxSimplifier::UNBOUNDED, SPxLP::upper(), and SVector::value().
Referenced by SPxMainSM::simplify().
removes duplicate rows.
Definition at line 2770 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::changeRange(), Array< T >::clear(), SPxLP::colVector(), SPxMainSM::DUPLICATE_ROW, SPxMainSM::DuplicateRowsPS, SPxMainSM::PostStep::eps(), SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SVector::index(), SPxSimplifier::INFEASIBLE, soplex::infinity, soplex::isNotZero(), SPxLP::lhs(), soplex::LTrel(), SPxMainSM::m_hist, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_rIdx, SPxMainSM::m_stat, METHOD, MSG_INFO2, MSG_INFO3, SPxLP::nCols(), soplex::NErel(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxMainSM::removeEmpty(), SPxLP::removeRows(), SPxMainSM::removeRowSingleton(), SPxLP::rhs(), SPxLP::rowVector(), SVector::size(), soplex::sorter_qsort(), soplex::spx_alloc(), soplex::spx_free(), soplex::spxout, and SVector::value().
Referenced by SPxMainSM::simplify().
void fixColumn |
( |
SPxLP & |
lp, |
|
|
int |
i, |
|
|
bool |
correctIdx = true |
|
) |
| |
|
private |
handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated.
Definition at line 3492 of file spxmainsm.cpp.
References SPxLP::changeLhs(), SPxLP::changeRhs(), SPxLP::colVector(), SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SPxMainSM::FixVariablePS, SVector::index(), soplex::infinity, soplex::isNotZero(), soplex::isZero(), SPxLP::lhs(), SPxLP::lower(), SPxMainSM::m_hist, soplex::maxAbs(), METHOD, MSG_INFO3, soplex::NE(), SPxLP::rhs(), SVector::size(), soplex::spxout, SPxLP::upper(), and SVector::value().
Referenced by SPxMainSM::duplicateCols(), SPxMainSM::simplifyCols(), and SPxMainSM::simplifyDual().
void handleExtremes |
( |
SPxLP & |
lp | ) |
|
|
private |
handles extreme values by setting them to zero or infinity.
Definition at line 1219 of file spxmainsm.cpp.
References SPxLP::changeLhs(), SPxLP::changeLower(), SPxLP::changeObj(), SPxLP::changeRhs(), SPxLP::changeUpper(), SPxLP::colVector_w(), SPxMainSM::epsZero(), SPxMainSM::feastol(), SPxMainSM::FREE_ROW, SPxMainSM::FreeConstraintPS, SVector::index(), soplex::infinity, SPxLP::isConsistent(), soplex::isZero(), SPxLP::lhs(), SPxLP::lower(), SPxSimplifier::m_chgBnds, SPxSimplifier::m_chgLRhs, SPxMainSM::m_hist, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_stat, METHOD, MSG_INFO2, MSG_INFO3, MSG_WARNING, SPxLP::nCols(), soplex::NE(), SPxLP::nRows(), SVector::number(), SPxLP::obj(), SVector::remove(), SPxMainSM::removeRow(), SPxLP::rhs(), SPxLP::rowVector_w(), SVector::size(), soplex::spxout, SPxLP::upper(), and SVector::value().
Referenced by SPxMainSM::simplify().
virtual bool isUnsimplified |
( |
| ) |
const |
|
virtual |
assignment operator
Definition at line 1115 of file spxmainsm.h.
References SPxMainSM::m_cBasisStat, SPxMainSM::m_cIdx, SPxMainSM::m_dual, SPxMainSM::m_epsilon, SPxMainSM::m_feastol, SPxMainSM::m_hist, SPxMainSM::m_opttol, SPxMainSM::m_postsolved, SPxMainSM::m_prim, SPxMainSM::m_rBasisStat, SPxMainSM::m_redCost, SPxMainSM::m_rIdx, SPxMainSM::m_slack, SPxMainSM::m_stat, SPxMainSM::m_thesense, and SPxSimplifier::operator=().
void removeCol |
( |
SPxLP & |
lp, |
|
|
int |
j |
|
) |
| |
|
private |
removed empty rows and empty columns.
Definition at line 1405 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::colVector(), SPxMainSM::EMPTY_COL, SPxMainSM::EMPTY_ROW, SPxMainSM::epsZero(), SPxMainSM::feastol(), SPxMainSM::FixVariablePS, soplex::GT(), SPxSimplifier::INFEASIBLE, soplex::infinity, soplex::isZero(), SPxLP::lhs(), SPxLP::lower(), soplex::LT(), SPxMainSM::m_hist, SPxSimplifier::m_remCols, SPxSimplifier::m_remRows, SPxMainSM::m_stat, SPxLP::maxObj(), METHOD, MSG_INFO2, MSG_INFO3, SPxLP::nCols(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxMainSM::removeCol(), SPxMainSM::removeRow(), SPxLP::rhs(), SPxLP::rowVector(), SVector::size(), soplex::spxout, SPxSimplifier::UNBOUNDED, and SPxLP::upper().
Referenced by SPxMainSM::duplicateCols(), and SPxMainSM::duplicateRows().
void removeRow |
( |
SPxLP & |
lp, |
|
|
int |
i |
|
) |
| |
|
private |
remove row singletons.
Definition at line 1508 of file spxmainsm.cpp.
References SPxLP::changeLower(), SPxLP::changeUpper(), SPxMainSM::epsZero(), SPxMainSM::feastol(), soplex::GT(), soplex::GTrel(), SVector::index(), SPxSimplifier::INFEASIBLE, soplex::infinity, soplex::isZero(), SPxLP::lhs(), SPxLP::lower(), soplex::LT(), soplex::LTrel(), SPxMainSM::m_hist, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_stat, MSG_INFO3, SPxSimplifier::OKAY, SPxMainSM::removeRow(), SPxLP::rhs(), SPxMainSM::RowSingletonPS, SPxMainSM::SINGLETON_ROW, SVector::size(), soplex::spxout, SPxLP::upper(), and SVector::value().
Referenced by SPxMainSM::duplicateRows(), and SPxMainSM::simplifyRows().
simplify SPxLP lp with independent primal and dual feasibility tolerance.
Implements SPxSimplifier.
Definition at line 3567 of file spxmainsm.cpp.
References SPxMainSM::DOMINATED_COL, SPxMainSM::DOUBLETON_ROW, SPxMainSM::DUPLICATE_ROW, SPxMainSM::duplicateCols(), SPxMainSM::duplicateRows(), SPxMainSM::EMPTY_COL, SPxMainSM::EMPTY_ROW, SPxMainSM::feastol(), SPxMainSM::FIX_COL, SPxMainSM::FIX_DUPLICATE_COL, SPxMainSM::FORCE_ROW, SPxMainSM::FREE_ROW, SPxMainSM::FREE_SINGLETON_COL, SPxMainSM::FREE_ZOBJ_COL, SPxMainSM::handleExtremes(), SPxMainSM::m_cBasisStat, SPxSimplifier::m_chgBnds, SPxSimplifier::m_chgLRhs, SPxMainSM::m_cIdx, SPxMainSM::m_dual, SPxMainSM::m_epsilon, SPxMainSM::m_feastol, SPxMainSM::m_hist, SPxMainSM::m_opttol, SPxMainSM::m_postsolved, SPxMainSM::m_prim, SPxMainSM::m_rBasisStat, SPxMainSM::m_redCost, SPxSimplifier::m_remCols, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_rIdx, SPxMainSM::m_slack, SPxMainSM::m_stat, SPxMainSM::m_thesense, SPxSimplifier::m_timeUsed, METHOD, MSG_INFO1, MSG_INFO2, SPxLP::nCols(), SPxLP::nNzos(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxMainSM::opttol(), DVector::reDim(), Timer::reset(), DataArray< T >::reSize(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), SPxMainSM::simplifyRows(), SPxMainSM::SINGLETON_ROW, DataArray< T >::size(), soplex::spxout, SPxLP::spxSense(), Timer::start(), Timer::stop(), SPxMainSM::SUB_DUPLICATE_COL, SPxSimplifier::VANISHED, SPxMainSM::WEAKLY_DOMINATED_COL, and SPxMainSM::ZOBJ_SINGLETON_COL.
performs simplification steps on the columns of the LP.
Definition at line 2023 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::changeBounds(), SPxLP::changeLower(), SPxLP::changeObj(), SPxLP::changeRange(), SPxLP::changeUpper(), SPxLP::colVector(), SPxMainSM::DOUBLETON_ROW, SPxMainSM::DoubletonEquationPS, SPxMainSM::EMPTY_COL, SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SPxMainSM::FIX_COL, SPxMainSM::fixColumn(), SPxMainSM::FixVariablePS, SPxMainSM::FREE_ROW, SPxMainSM::FREE_SINGLETON_COL, SPxMainSM::FREE_ZOBJ_COL, SPxMainSM::FreeColSingletonPS, SPxMainSM::FreeConstraintPS, SPxMainSM::FreeZeroObjVariablePS, soplex::GT(), soplex::GTrel(), SVector::index(), SPxSimplifier::INFEASIBLE, soplex::infinity, soplex::isNotZero(), soplex::isZero(), SPxLP::lhs(), SPxLP::lower(), soplex::LT(), soplex::LTrel(), SPxSimplifier::m_chgBnds, SPxMainSM::m_hist, SPxSimplifier::m_remCols, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_stat, soplex::maxAbs(), SPxLP::maxObj(), METHOD, MSG_INFO2, MSG_INFO3, SPxLP::nCols(), soplex::NErel(), SPxLP::obj(), SPxSimplifier::OKAY, SPxMainSM::removeCol(), SPxMainSM::removeRow(), SPxLP::rhs(), SPxLP::rowVector(), SVector::size(), soplex::sorter_qsort(), soplex::spxout, SPxSimplifier::UNBOUNDED, SPxLP::upper(), SVector::value(), and SPxMainSM::ZOBJ_SINGLETON_COL.
Referenced by SPxMainSM::simplify().
performs simplification steps on the LP based on dual concepts.
Definition at line 2529 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::changeLower(), SPxLP::changeUpper(), SPxLP::colVector(), SPxMainSM::DOMINATED_COL, SPxSimplifier::DUAL_INFEASIBLE, SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SPxMainSM::FIX_COL, SPxMainSM::fixColumn(), SPxMainSM::FREE_ROW, soplex::GTrel(), SVector::index(), soplex::infinity, soplex::isNotZero(), SPxLP::lhs(), SPxLP::lower(), soplex::LTrel(), SPxMainSM::m_hist, SPxSimplifier::m_remCols, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_stat, SPxLP::maxObj(), METHOD, MSG_INFO2, MSG_INFO3, SPxLP::nCols(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxMainSM::opttol(), SPxMainSM::removeCol(), SPxMainSM::removeRow(), SPxLP::rhs(), SPxLP::rowVector(), SVector::size(), soplex::spxout, SPxSimplifier::UNBOUNDED, SPxLP::upper(), SVector::value(), and SPxMainSM::WEAKLY_DOMINATED_COL.
Referenced by SPxMainSM::simplify().
performs simplification steps on the rows of the LP.
Definition at line 1579 of file spxmainsm.cpp.
References ASSERT_WARN, SPxLP::changeLhs(), SPxLP::changeLower(), SPxLP::changeRhs(), SPxLP::changeUpper(), SPxMainSM::EMPTY_ROW, Param::epsilon(), SPxMainSM::epsZero(), soplex::EQrel(), SPxMainSM::feastol(), SPxMainSM::FORCE_ROW, SPxMainSM::ForceConstraintPS, SPxMainSM::FREE_ROW, soplex::GErel(), soplex::GT(), soplex::GTrel(), SVector::index(), SPxSimplifier::INFEASIBLE, soplex::infinity, soplex::isNotZero(), soplex::isZero(), soplex::LErel(), SPxLP::lhs(), SPxLP::lower(), soplex::LT(), soplex::LTrel(), SPxSimplifier::m_chgBnds, SPxSimplifier::m_chgLRhs, SPxMainSM::m_epsilon, SPxMainSM::m_hist, SPxSimplifier::m_remNzos, SPxSimplifier::m_remRows, SPxMainSM::m_stat, soplex::maxAbs(), METHOD, MSG_INFO2, MSG_INFO3, soplex::NErel(), SPxLP::nRows(), SPxSimplifier::OKAY, SPxMainSM::removeRow(), SPxMainSM::removeRowSingleton(), SPxLP::rhs(), SPxLP::rowVector(), SVector::size(), soplex::spxout, SPxLP::upper(), and SVector::value().
Referenced by SPxMainSM::simplify().
virtual const Vector& unsimplifiedDual |
( |
| ) |
|
|
virtual |
virtual const Vector& unsimplifiedPrimal |
( |
| ) |
|
|
virtual |
virtual const Vector& unsimplifiedRedCost |
( |
| ) |
|
|
virtual |
virtual const Vector& unsimplifiedSlacks |
( |
| ) |
|
|
virtual |
reconstructs an optimal solution for the unsimplified LP.
Reimplemented from SPxSimplifier.
Definition at line 3716 of file spxmainsm.cpp.
References SPxSolver::BASIC, Vector::dim(), SPxMainSM::epsZero(), SPxSimplifier::getName(), soplex::isZero(), SPxMainSM::m_cBasisStat, SPxMainSM::m_dual, SPxMainSM::m_hist, SPxMainSM::m_postsolved, SPxMainSM::m_prim, SPxMainSM::m_rBasisStat, SPxMainSM::m_redCost, SPxMainSM::m_slack, SPxMainSM::m_thesense, SPxLP::MAXIMIZE, METHOD, MSG_DEBUG, and soplex::spxout.
vector of presolve history.
Definition at line 997 of file spxmainsm.h.
Referenced by SPxMainSM::duplicateCols(), SPxMainSM::duplicateRows(), SPxMainSM::fixColumn(), SPxMainSM::handleExtremes(), SPxMainSM::operator=(), SPxMainSM::removeEmpty(), SPxMainSM::removeRowSingleton(), SPxMainSM::simplify(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), SPxMainSM::simplifyRows(), SPxMainSM::SPxMainSM(), SPxMainSM::unsimplify(), and SPxMainSM::~SPxMainSM().
status of postsolving.
Definition at line 998 of file spxmainsm.h.
Referenced by SPxMainSM::getBasis(), SPxMainSM::getBasisColStatus(), SPxMainSM::getBasisRowStatus(), SPxMainSM::isUnsimplified(), SPxMainSM::operator=(), SPxMainSM::simplify(), SPxMainSM::unsimplifiedDual(), SPxMainSM::unsimplifiedPrimal(), SPxMainSM::unsimplifiedRedCost(), SPxMainSM::unsimplifiedSlacks(), and SPxMainSM::unsimplify().
|