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>

Inheritance diagram for SPxMainSM:

Classes

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 SVector::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 SVector::Element: compare nonzeros according to index 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  RowSingletonPS
 Postsolves row singletons. More...
 
class  ZeroObjColSingletonPS
 Postsolves column singletons with zero objective. More...
 

Public Member Functions

 SPxMainSM ()
 default constructor.
 
 SPxMainSM (const SPxMainSM &old)
 copy constructor.
 
SPxMainSMoperator= (const SPxMainSM &rhs)
 assignment operator
 
virtual ~SPxMainSM ()
 destructor.
 
virtual SPxSimplifierclone () 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 VectorunsimplifiedPrimal ()
 returns a reference to the unsimplified primal solution.
 
virtual const VectorunsimplifiedDual ()
 returns a reference to the unsimplified dual solution.
 
virtual const VectorunsimplifiedSlacks ()
 returns a reference to the unsimplified slack values.
 
virtual const VectorunsimplifiedRedCost ()
 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.
 
- Public Member Functions inherited from SPxSimplifier
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
 
SPxSimplifieroperator= (const SPxSimplifier &rhs)
 assignment operator
 
virtual ~SPxSimplifier ()
 destructor.
 

Private Types

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...
 

Private Member Functions

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
 

Private Attributes

DVector m_prim
 unsimplified primal solution vector.
 
DVector m_slack
 unsimplified slack vector.
 
DVector m_dual
 unsimplified dual solution vector.
 
DVector m_redCost
 unsimplified reduced cost vector.
 
DataArray< SPxSolver::VarStatusm_cBasisStat
 basis status of columns.
 
DataArray< SPxSolver::VarStatusm_rBasisStat
 basis status of rows.
 
DataArray< int > m_cIdx
 column index vector in original LP.
 
DataArray< int > m_rIdx
 row index vector in original LP.
 
DataArray< PostStep * > m_hist
 vector of presolve history.
 
bool m_postsolved
 status of postsolving.
 
Real m_epsilon
 epsilon zero.
 
Real m_feastol
 primal feasibility tolerance.
 
Real m_opttol
 dual feasibility tolerance.
 
DataArray< int > m_stat
 preprocessing history.
 
SPxLP::SPxSense m_thesense
 optimization sense.
 

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
 

Additional Inherited Members

- Public Types inherited from SPxSimplifier
enum  Result {
  OKAY = 0, INFEASIBLE = 1, DUAL_INFEASIBLE = 2, UNBOUNDED = 3,
  VANISHED = 4
}
 Result of the simplification. More...
 
- Protected Attributes inherited from SPxSimplifier
const char * m_name
 name of the simplifier
 
Timer m_timeUsed
 user time used for simplification
 
int m_remRows
 number of removed rows
 
int m_remCols
 number of removed columns
 
int m_remNzos
 number of removed nonzero coefficients
 
int m_chgBnds
 number of changed bounds
 
int m_chgLRhs
 number of change right-hand sides
 
Real m_objoffset
 objective offset
 

Detailed Description

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.

Member Enumeration Documentation

enum SimpleStep
private

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.

Constructor & Destructor Documentation

SPxMainSM ( )

default constructor.

Definition at line 1082 of file spxmainsm.h.

Referenced by SPxMainSM::clone().

SPxMainSM ( const SPxMainSM old)

copy constructor.

Definition at line 1087 of file spxmainsm.h.

References SPxMainSM::m_hist.

virtual ~SPxMainSM ( )
virtual

destructor.

Definition at line 1157 of file spxmainsm.h.

References SPxMainSM::m_hist.

Member Function Documentation

int cIdx ( int  j) const
private

returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP.

Definition at line 1055 of file spxmainsm.h.

References SPxMainSM::m_cIdx.

Referenced by SPxMainSM::ForceConstraintPS::execute(), and SPxMainSM::DuplicateColsPS::execute().

virtual SPxSimplifier* clone ( ) const
virtual

clone function for polymorphism

Implements SPxSimplifier.

Definition at line 1167 of file spxmainsm.h.

References SPxMainSM::SPxMainSM().

virtual void getBasis ( SPxSolver::VarStatus  rows[],
SPxSolver::VarStatus  cols[] 
) const
virtual

get optimal basis.

Implements SPxSimplifier.

Definition at line 1230 of file spxmainsm.h.

References SPxMainSM::m_cBasisStat, SPxMainSM::m_postsolved, and SPxMainSM::m_rBasisStat.

virtual SPxSolver::VarStatus getBasisColStatus ( int  j) const
virtual

gets basis status for a single column.

Implements SPxSimplifier.

Definition at line 1224 of file spxmainsm.h.

References SPxMainSM::m_cBasisStat, and SPxMainSM::m_postsolved.

virtual SPxSolver::VarStatus getBasisRowStatus ( int  i) const
virtual

gets basis status for a single row.

Implements SPxSimplifier.

Definition at line 1218 of file spxmainsm.h.

References SPxMainSM::m_postsolved, and SPxMainSM::m_rBasisStat.

virtual bool isUnsimplified ( ) const
virtual

specifies whether an optimal solution has already been unsimplified.

Reimplemented from SPxSimplifier.

Definition at line 1189 of file spxmainsm.h.

References SPxMainSM::m_postsolved.

Real opttol ( ) const
private

Definition at line 1070 of file spxmainsm.h.

References SPxMainSM::m_opttol.

Referenced by SPxMainSM::simplify(), and SPxMainSM::simplifyDual().

void removeCol ( SPxLP lp,
int  j 
)
private

removes a column in the LP.

Definition at line 1044 of file spxmainsm.h.

References SPxMainSM::m_cIdx, SPxLP::nCols(), and SPxLP::removeCol().

Referenced by SPxMainSM::removeEmpty(), SPxMainSM::simplifyCols(), and SPxMainSM::simplifyDual().

void removeRow ( SPxLP lp,
int  i 
)
private
int rIdx ( int  i) const
private

returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP.

Definition at line 1050 of file spxmainsm.h.

References SPxMainSM::m_rIdx.

Referenced by SPxMainSM::FreeZeroObjVariablePS::execute(), and SPxMainSM::DuplicateRowsPS::execute().

virtual Result simplify ( SPxLP lp,
Real  eps,
Real  delta 
)
virtual

simplify SPxLP lp with identical primal and dual feasibility tolerance.

Implements SPxSimplifier.

Definition at line 1177 of file spxmainsm.h.

SPxSimplifier::Result simplify ( SPxLP lp,
Real  eps,
Real  feastol,
Real  opttol 
)
virtual

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.

virtual const Vector& unsimplifiedDual ( )
virtual

returns a reference to the unsimplified dual solution.

Implements SPxSimplifier.

Definition at line 1200 of file spxmainsm.h.

References SPxMainSM::m_dual, and SPxMainSM::m_postsolved.

virtual const Vector& unsimplifiedPrimal ( )
virtual

returns a reference to the unsimplified primal solution.

Implements SPxSimplifier.

Definition at line 1194 of file spxmainsm.h.

References SPxMainSM::m_postsolved, and SPxMainSM::m_prim.

virtual const Vector& unsimplifiedRedCost ( )
virtual

returns a reference to the unsimplified reduced costs.

Implements SPxSimplifier.

Definition at line 1212 of file spxmainsm.h.

References SPxMainSM::m_postsolved, and SPxMainSM::m_redCost.

virtual const Vector& unsimplifiedSlacks ( )
virtual

returns a reference to the unsimplified slack values.

Implements SPxSimplifier.

Definition at line 1206 of file spxmainsm.h.

References SPxMainSM::m_postsolved, and SPxMainSM::m_slack.

void unsimplify ( const Vector x,
const Vector y,
const Vector s,
const Vector r,
const SPxSolver::VarStatus  rows[],
const SPxSolver::VarStatus  cols[] 
)
virtual

Friends And Related Function Documentation

friend class DoubletonEquationPS
friend

Definition at line 956 of file spxmainsm.h.

Referenced by SPxMainSM::simplifyCols().

friend class DuplicateColsPS
friend

Definition at line 958 of file spxmainsm.h.

Referenced by SPxMainSM::duplicateCols().

friend class DuplicateRowsPS
friend

Definition at line 957 of file spxmainsm.h.

Referenced by SPxMainSM::duplicateRows().

friend class EmptyConstraintPS
friend

Definition at line 948 of file spxmainsm.h.

friend class FixBoundsPS
friend

Definition at line 952 of file spxmainsm.h.

friend class FixVariablePS
friend
friend class ForceConstraintPS
friend

Definition at line 950 of file spxmainsm.h.

Referenced by SPxMainSM::simplifyRows().

friend class FreeColSingletonPS
friend

Definition at line 955 of file spxmainsm.h.

Referenced by SPxMainSM::simplifyCols().

friend class FreeConstraintPS
friend

Definition at line 947 of file spxmainsm.h.

Referenced by SPxMainSM::handleExtremes(), and SPxMainSM::simplifyCols().

friend class FreeZeroObjVariablePS
friend

Definition at line 953 of file spxmainsm.h.

Referenced by SPxMainSM::simplifyCols().

friend class RowSingletonPS
friend

Definition at line 949 of file spxmainsm.h.

Referenced by SPxMainSM::removeRowSingleton().

friend class ZeroObjColSingletonPS
friend

Definition at line 954 of file spxmainsm.h.

Member Data Documentation

DataArray<SPxSolver::VarStatus> m_cBasisStat
private
DataArray<int> m_cIdx
private

column index vector in original LP.

Definition at line 995 of file spxmainsm.h.

Referenced by SPxMainSM::cIdx(), SPxMainSM::duplicateCols(), SPxMainSM::operator=(), SPxMainSM::removeCol(), and SPxMainSM::simplify().

DVector m_dual
private

unsimplified dual solution vector.

Definition at line 991 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::simplify(), SPxMainSM::unsimplifiedDual(), and SPxMainSM::unsimplify().

Real m_epsilon
private

epsilon zero.

Definition at line 999 of file spxmainsm.h.

Referenced by SPxMainSM::epsZero(), SPxMainSM::operator=(), SPxMainSM::simplify(), and SPxMainSM::simplifyRows().

Real m_feastol
private

primal feasibility tolerance.

Definition at line 1000 of file spxmainsm.h.

Referenced by SPxMainSM::feastol(), SPxMainSM::operator=(), and SPxMainSM::simplify().

Real m_opttol
private

dual feasibility tolerance.

Definition at line 1001 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::opttol(), and SPxMainSM::simplify().

DVector m_prim
private

unsimplified primal solution vector.

Definition at line 989 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::simplify(), SPxMainSM::unsimplifiedPrimal(), and SPxMainSM::unsimplify().

DVector m_redCost
private

unsimplified reduced cost vector.

Definition at line 992 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::simplify(), SPxMainSM::unsimplifiedRedCost(), and SPxMainSM::unsimplify().

DataArray<int> m_rIdx
private

row index vector in original LP.

Definition at line 996 of file spxmainsm.h.

Referenced by SPxMainSM::duplicateRows(), SPxMainSM::operator=(), SPxMainSM::removeRow(), SPxMainSM::rIdx(), and SPxMainSM::simplify().

DVector m_slack
private

unsimplified slack vector.

Definition at line 990 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::simplify(), SPxMainSM::unsimplifiedSlacks(), and SPxMainSM::unsimplify().

SPxLP::SPxSense m_thesense
private

optimization sense.

Definition at line 1003 of file spxmainsm.h.

Referenced by SPxMainSM::operator=(), SPxMainSM::simplify(), and SPxMainSM::unsimplify().