Scippy

SoPlex

Sequential object-oriented simPlex

SPxSimplifier Class Referenceabstract

LP simplification abstract base class.Instances of classes derived from SPxSimplifier may be loaded to SoPlex in order to simplify LPs before solving them. SoPlex will call simplify() on itself. Generally any SPxLP can be given to a SPxSimplifier for simplify()ing it. The simplification cannot be undone, but given an primal/dual solution for the simplified SPxLP, the simplifier can reconstruct the primal/dual solution of the unsimplified LP. More...

#include <spxsimplifier.h>

Inheritance diagram for SPxSimplifier:

Public Member Functions

Access / modfication
virtual const char * getName () const
 get name of simplifier. More...
 
virtual Real timeUsed () const
 
Simplifying / unsimplifying
virtual Result simplify (SPxLP &lp, Real eps, Real delta)=0
 simplify SPxLP lp with identical primal and dual feasibility tolerance. More...
 
virtual Result simplify (SPxLP &lp, Real eps, Real feastol, Real opttol, bool keepbounds=false)=0
 simplify SPxLP lp with independent primal and dual feasibility tolerance. More...
 
virtual void unsimplify (const Vector &, const Vector &, const Vector &, const Vector &, const SPxSolver::VarStatus[], const SPxSolver::VarStatus[])
 reconstructs an optimal solution for the unsimplified LP. More...
 
virtual Result result () const =0
 returns result status of the simplification More...
 
virtual bool isUnsimplified () const
 specifies whether an optimal solution has already been unsimplified. More...
 
virtual const VectorunsimplifiedPrimal ()=0
 returns a reference to the unsimplified primal solution. More...
 
virtual const VectorunsimplifiedDual ()=0
 returns a reference to the unsimplified dual solution. More...
 
virtual const VectorunsimplifiedSlacks ()=0
 returns a reference to the unsimplified slack values. More...
 
virtual const VectorunsimplifiedRedCost ()=0
 returns a reference to the unsimplified reduced costs. More...
 
virtual SPxSolver::VarStatus getBasisRowStatus (int) const =0
 gets basis status for a single row. More...
 
virtual SPxSolver::VarStatus getBasisColStatus (int) const =0
 gets basis status for a single column. More...
 
virtual void getBasis (SPxSolver::VarStatus[], SPxSolver::VarStatus[], const int rowsSize=-1, const int colsSize=-1) const =0
 get optimal basis. More...
 
virtual Real getObjoffset () const
 get objective offset. More...
 
virtual void addObjoffset (const Real val)
 add objective offset. More...
 
virtual void setMinReduction (const Real minRed)
 set minimal reduction threshold to continue simplification More...
 
Consistency check
virtual bool isConsistent () const
 consistency check More...
 

Protected Attributes

Protected Data
const char * m_name
 name of the simplifier More...
 
Timerm_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...
 
Real m_objoffset
 objective offset More...
 
Real m_minReduction
 minimal reduction (sum of removed rows/cols) to continue simplification More...
 
SPxOutspxout
 message handler More...
 

Types

enum  Result {
  OKAY = 0, INFEASIBLE = 1, DUAL_INFEASIBLE = 2, UNBOUNDED = 3,
  VANISHED = 4
}
 Result of the simplification. More...
 
 SPxSimplifier (const char *p_name, Timer::TYPE ttype=Timer::USER_TIME)
 constructor More...
 
 SPxSimplifier (const SPxSimplifier &old)
 copy constructor More...
 
SPxSimplifieroperator= (const SPxSimplifier &rhs)
 assignment operator More...
 
virtual ~SPxSimplifier ()
 destructor. More...
 
virtual SPxSimplifierclone () const =0
 clone function for polymorphism More...
 

Detailed Description

LP simplification abstract base class.

Instances of classes derived from SPxSimplifier may be loaded to SoPlex in order to simplify LPs before solving them. SoPlex will call simplify() on itself. Generally any SPxLP can be given to a SPxSimplifier for simplify()ing it. The simplification cannot be undone, but given an primal/dual solution for the simplified SPxLP, the simplifier can reconstruct the primal/dual solution of the unsimplified LP.

Definition at line 41 of file spxsimplifier.h.

Member Enumeration Documentation

enum Result

Result of the simplification.

Enumerator
OKAY 

simplification could be done

INFEASIBLE 

primal infeasibility was detected

DUAL_INFEASIBLE 

dual infeasibility was detected

UNBOUNDED 

primal unboundedness was detected

VANISHED 

the problem was so much simplified that it vanished

Definition at line 81 of file spxsimplifier.h.

Constructor & Destructor Documentation

SPxSimplifier ( const char *  p_name,
Timer::TYPE  ttype = Timer::USER_TIME 
)
explicit

constructor

Definition at line 95 of file spxsimplifier.h.

References TimerFactory::createTimer(), and SPxSimplifier::isConsistent().

SPxSimplifier ( const SPxSimplifier old)

copy constructor

Definition at line 115 of file spxsimplifier.h.

References TimerFactory::createTimer(), and SPxSimplifier::isConsistent().

virtual ~SPxSimplifier ( )
virtual

destructor.

Definition at line 157 of file spxsimplifier.h.

References SPxSimplifier::clone(), soplex::spx_free(), and Timer::~Timer().

Member Function Documentation

virtual void addObjoffset ( const Real  val)
virtual

add objective offset.

Definition at line 226 of file spxsimplifier.h.

Referenced by SPxMainSM::FixVariablePS::FixVariablePS(), and SPxMainSM::FreeColSingletonPS::FreeColSingletonPS().

virtual SPxSimplifier* clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SPxMainSM.

Referenced by SoPlexLegacy::operator=(), SoPlexLegacy::SoPlexLegacy(), and SPxSimplifier::~SPxSimplifier().

virtual void getBasis ( SPxSolver::VarStatus  [],
SPxSolver::VarStatus  [],
const int  rowsSize = -1,
const int  colsSize = -1 
) const
pure virtual
virtual SPxSolver::VarStatus getBasisColStatus ( int  ) const
pure virtual

gets basis status for a single column.

Implemented in SPxMainSM.

Referenced by SoPlexLegacy::getBasisColStatus(), and SPxSimplifier::isUnsimplified().

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

gets basis status for a single row.

Implemented in SPxMainSM.

Referenced by SoPlexLegacy::getBasisRowStatus(), and SPxSimplifier::isUnsimplified().

virtual const char* getName ( ) const
virtual

get name of simplifier.

Definition at line 171 of file spxsimplifier.h.

References SPxSimplifier::m_name.

Referenced by SoPlex::getSimplifierName(), and main().

virtual Real getObjoffset ( ) const
virtual

get objective offset.

Definition at line 220 of file spxsimplifier.h.

References SPxSimplifier::m_objoffset.

Referenced by SoPlex::_preprocessAndSolveReal().

virtual bool isConsistent ( ) const
virtual

consistency check

Definition at line 242 of file spxsimplifier.h.

Referenced by SPxSimplifier::operator=(), and SPxSimplifier::SPxSimplifier().

virtual Result result ( ) const
pure virtual

returns result status of the simplification

Implemented in SPxMainSM.

Referenced by SPxSimplifier::unsimplify().

virtual void setMinReduction ( const Real  minRed)
virtual

set minimal reduction threshold to continue simplification

Definition at line 232 of file spxsimplifier.h.

Referenced by SoPlex::_enableSimplifierAndScaler().

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

simplify SPxLP lp with identical primal and dual feasibility tolerance.

Implemented in SPxMainSM.

Referenced by SoPlex::_preprocessAndSolveReal(), SoPlex::_solveRealForRational(), SoPlexLegacy::solve(), and SPxSimplifier::timeUsed().

virtual Result simplify ( SPxLP lp,
Real  eps,
Real  feastol,
Real  opttol,
bool  keepbounds = false 
)
pure virtual

simplify SPxLP lp with independent primal and dual feasibility tolerance.

Implemented in SPxMainSM.

virtual Real timeUsed ( ) const
virtual

Definition at line 175 of file spxsimplifier.h.

References SPxSimplifier::simplify(), and Timer::time().

virtual const Vector& unsimplifiedDual ( )
pure virtual

returns a reference to the unsimplified dual solution.

Implemented in SPxMainSM.

Referenced by SoPlex::_solveRealForRational(), SoPlexLegacy::getDual(), and SPxSimplifier::isUnsimplified().

virtual const Vector& unsimplifiedPrimal ( )
pure virtual

returns a reference to the unsimplified primal solution.

Implemented in SPxMainSM.

Referenced by SoPlex::_solveRealForRational(), SoPlexLegacy::getPrimal(), and SPxSimplifier::isUnsimplified().

virtual const Vector& unsimplifiedRedCost ( )
pure virtual

returns a reference to the unsimplified reduced costs.

Implemented in SPxMainSM.

Referenced by SoPlexLegacy::getRedCost(), and SPxSimplifier::isUnsimplified().

virtual const Vector& unsimplifiedSlacks ( )
pure virtual

returns a reference to the unsimplified slack values.

Implemented in SPxMainSM.

Referenced by SoPlexLegacy::getSlacks(), and SPxSimplifier::isUnsimplified().

virtual void unsimplify ( const Vector ,
const Vector ,
const Vector ,
const Vector ,
const SPxSolver::VarStatus  [],
const SPxSolver::VarStatus  [] 
)
virtual

reconstructs an optimal solution for the unsimplified LP.

Reimplemented in SPxMainSM.

Definition at line 189 of file spxsimplifier.h.

References SPxSimplifier::result().

Referenced by SoPlex::_resolveWithoutPreprocessing(), SoPlex::_solveRealForRational(), and SoPlexLegacy::unsimplify().

Member Data Documentation

int m_chgBnds
protected
int m_chgLRhs
protected

number of change right-hand sides

Definition at line 62 of file spxsimplifier.h.

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

int m_keptBnds
protected

number of kept bounds

Definition at line 64 of file spxsimplifier.h.

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

int m_keptLRhs
protected

number of kept left- and right-hand sides

Definition at line 66 of file spxsimplifier.h.

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

Real m_minReduction
protected

minimal reduction (sum of removed rows/cols) to continue simplification

Definition at line 70 of file spxsimplifier.h.

Referenced by SPxMainSM::duplicateCols(), SPxMainSM::duplicateRows(), SPxSimplifier::operator=(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), and SPxMainSM::simplifyRows().

const char* m_name
protected

name of the simplifier

Definition at line 49 of file spxsimplifier.h.

Referenced by SPxSimplifier::getName(), and SPxSimplifier::operator=().

Real m_objoffset
protected

objective offset

Definition at line 68 of file spxsimplifier.h.

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

int m_remCols
protected
Timer::TYPE m_timerType
protected

Definition at line 52 of file spxsimplifier.h.

Referenced by SPxSimplifier::operator=().

Timer* m_timeUsed
protected

user time used for simplification

Definition at line 51 of file spxsimplifier.h.

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