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>

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[], bool isOptimal=true)=0
 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

◆ Result

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() [1/2]

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() [2/2]

SPxSimplifier ( const SPxSimplifier old)

copy constructor

Definition at line 115 of file spxsimplifier.h.

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

◆ ~SPxSimplifier()

virtual ~SPxSimplifier ( )
virtual

destructor.

Definition at line 157 of file spxsimplifier.h.

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

Member Function Documentation

◆ addObjoffset()

virtual void addObjoffset ( const Real  val)
virtual

◆ clone()

virtual SPxSimplifier* clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SPxMainSM.

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

◆ getBasis()

◆ getBasisColStatus()

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

◆ getBasisRowStatus()

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

◆ getName()

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

◆ getObjoffset()

virtual Real getObjoffset ( ) const
virtual

get objective offset.

Definition at line 220 of file spxsimplifier.h.

References SPxSimplifier::m_objoffset.

Referenced by SoPlex::_decompSimplifyAndSolve(), and SoPlex::_preprocessAndSolveReal().

◆ isConsistent()

virtual bool isConsistent ( ) const
virtual

consistency check

Definition at line 243 of file spxsimplifier.h.

References soplex::operator<<().

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

◆ isUnsimplified()

◆ operator=()

◆ result()

virtual Result result ( ) const
pure virtual

returns result status of the simplification

Implemented in SPxMainSM.

Referenced by SoPlex::_storeSolutionReal(), SoPlex::_storeSolutionRealFromPresol(), and SPxSimplifier::timeUsed().

◆ setMinReduction()

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

◆ simplify() [1/2]

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::_decompSimplifyAndSolve(), SoPlex::_preprocessAndSolveReal(), SoPlex::_solveRealForRational(), SoPlexLegacy::solve(), and SPxSimplifier::timeUsed().

◆ simplify() [2/2]

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.

◆ timeUsed()

virtual Real timeUsed ( ) const
virtual

◆ unsimplifiedDual()

virtual const Vector& unsimplifiedDual ( )
pure virtual

◆ unsimplifiedPrimal()

virtual const Vector& unsimplifiedPrimal ( )
pure virtual

◆ unsimplifiedRedCost()

virtual const Vector& unsimplifiedRedCost ( )
pure virtual

returns a reference to the unsimplified reduced costs.

Implemented in SPxMainSM.

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

◆ unsimplifiedSlacks()

virtual const Vector& unsimplifiedSlacks ( )
pure virtual

returns a reference to the unsimplified slack values.

Implemented in SPxMainSM.

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

◆ unsimplify()

virtual void unsimplify ( const Vector ,
const Vector ,
const Vector ,
const Vector ,
const SPxSolver::VarStatus  [],
const SPxSolver::VarStatus  [],
bool  isOptimal = true 
)
pure virtual

Member Data Documentation

◆ m_chgBnds

int m_chgBnds
protected

◆ m_chgLRhs

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

◆ m_keptBnds

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

◆ m_keptLRhs

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

◆ m_minReduction

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(), SPxMainSM::multiaggregation(), SPxSimplifier::operator=(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), and SPxMainSM::simplifyRows().

◆ m_name

const char* m_name
protected

name of the simplifier

Definition at line 49 of file spxsimplifier.h.

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

◆ m_objoffset

◆ m_remCols

◆ m_remNzos

◆ m_remRows

◆ m_timerType

Timer::TYPE m_timerType
protected

Definition at line 52 of file spxsimplifier.h.

Referenced by SPxSimplifier::operator=().

◆ m_timeUsed

Timer* m_timeUsed
protected

user time used for simplification

Definition at line 51 of file spxsimplifier.h.

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

◆ spxout