Scippy

SoPlex

Sequential object-oriented simPlex

SPxSimplifier< R > Class Template 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

void setOutstream (SPxOut &newOutstream)
 
virtual void setTolerances (std::shared_ptr< Tolerances > newTolerances)
 set the _tolerances member variable More...
 
const std::shared_ptr< Tolerancestolerances () const
 get the _tolerances member variable More...
 
Access / modfication
virtual const char * getName () const
 get name of simplifier. More...
 
virtual R timeUsed () const
 
Simplifying / unsimplifying
virtual Result simplify (SPxLPBase< R > &lp, Real remainingTime, bool keepbounds=false, uint32_t seed=0)=0
 simplify SPxLP lp More...
 
virtual void unsimplify (const VectorBase< R > &, const VectorBase< R > &, const VectorBase< R > &, const VectorBase< R > &, const typename SPxSolverBase< R >::VarStatus[], const typename SPxSolverBase< R >::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 VectorBase< R > & unsimplifiedPrimal ()=0
 returns a reference to the unsimplified primal solution. More...
 
virtual const VectorBase< R > & unsimplifiedDual ()=0
 returns a reference to the unsimplified dual solution. More...
 
virtual const VectorBase< R > & unsimplifiedSlacks ()=0
 returns a reference to the unsimplified slack values. More...
 
virtual const VectorBase< R > & unsimplifiedRedCost ()=0
 returns a reference to the unsimplified reduced costs. More...
 
virtual SPxSolverBase< R >::VarStatus getBasisRowStatus (int) const =0
 gets basis status for a single row. More...
 
virtual SPxSolverBase< R >::VarStatus getBasisColStatus (int) const =0
 gets basis status for a single column. More...
 
virtual void getBasis (typename SPxSolverBase< R >::VarStatus[], typename SPxSolverBase< R >::VarStatus[], const int rowsSize=-1, const int colsSize=-1) const =0
 get optimal basis. More...
 
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...
 
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...
 
m_objoffset
 objective offset More...
 
m_minReduction
 minimal reduction (sum of removed rows/cols) to continue simplification More...
 
SPxOutspxout
 message handler More...
 
std::shared_ptr< Tolerances_tolerances
 

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

template<class R>
class soplex::SPxSimplifier< R >

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 51 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 92 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 106 of file spxsimplifier.h.

◆ SPxSimplifier() [2/2]

SPxSimplifier ( const SPxSimplifier< R > &  old)

copy constructor

Definition at line 126 of file spxsimplifier.h.

◆ ~SPxSimplifier()

virtual ~SPxSimplifier ( )
virtual

destructor.

Definition at line 168 of file spxsimplifier.h.

Member Function Documentation

◆ addObjoffset()

virtual void addObjoffset ( const R  val)
virtual

add objective offset.

Definition at line 239 of file spxsimplifier.h.

◆ clone()

virtual SPxSimplifier* clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::~SPxSimplifier().

◆ getBasis()

virtual void getBasis ( typename SPxSolverBase< R >::VarStatus  [],
typename SPxSolverBase< R >::VarStatus  [],
const int  rowsSize = -1,
const int  colsSize = -1 
) const
pure virtual

get optimal basis.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ getBasisColStatus()

virtual SPxSolverBase<R>::VarStatus getBasisColStatus ( int  ) const
pure virtual

gets basis status for a single column.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ getBasisRowStatus()

virtual SPxSolverBase<R>::VarStatus getBasisRowStatus ( int  ) const
pure virtual

gets basis status for a single row.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ getName()

virtual const char* getName ( ) const
virtual

get name of simplifier.

Definition at line 182 of file spxsimplifier.h.

◆ getObjoffset()

virtual R getObjoffset ( ) const
virtual

get objective offset.

Definition at line 233 of file spxsimplifier.h.

◆ isConsistent()

virtual bool isConsistent ( ) const
virtual

consistency check

Definition at line 256 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=(), and SPxSimplifier< BP >::SPxSimplifier().

◆ isUnsimplified()

virtual bool isUnsimplified ( ) const
virtual

specifies whether an optimal solution has already been unsimplified.

Reimplemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Definition at line 206 of file spxsimplifier.h.

◆ operator=()

SPxSimplifier& operator= ( const SPxSimplifier< R > &  rhs)

assignment operator

Definition at line 144 of file spxsimplifier.h.

Referenced by Presol< BP >::getBasis(), and SPxMainSM< BP >::operator=().

◆ result()

virtual Result result ( ) const
pure virtual

returns result status of the simplification

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::timeUsed().

◆ setMinReduction()

virtual void setMinReduction ( const R  minRed)
virtual

set minimal reduction threshold to continue simplification

Definition at line 245 of file spxsimplifier.h.

◆ setOutstream()

void setOutstream ( SPxOut newOutstream)

Definition at line 262 of file spxsimplifier.h.

◆ setTolerances()

virtual void setTolerances ( std::shared_ptr< Tolerances newTolerances)
virtual

set the _tolerances member variable

Definition at line 268 of file spxsimplifier.h.

◆ simplify()

virtual Result simplify ( SPxLPBase< R > &  lp,
Real  remainingTime,
bool  keepbounds = false,
uint32_t  seed = 0 
)
pure virtual

simplify SPxLP lp

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::timeUsed().

◆ timeUsed()

virtual R timeUsed ( ) const
virtual

Definition at line 186 of file spxsimplifier.h.

◆ tolerances()

const std::shared_ptr<Tolerances> tolerances ( ) const

get the _tolerances member variable

Definition at line 273 of file spxsimplifier.h.

Referenced by SPxMainSM< BP >::epsZero(), SPxMainSM< BP >::feastol(), Presol< BP >::getBasis(), and SPxMainSM< BP >::opttol().

◆ unsimplifiedDual()

virtual const VectorBase<R>& unsimplifiedDual ( )
pure virtual

returns a reference to the unsimplified dual solution.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ unsimplifiedPrimal()

virtual const VectorBase<R>& unsimplifiedPrimal ( )
pure virtual

returns a reference to the unsimplified primal solution.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ unsimplifiedRedCost()

virtual const VectorBase<R>& unsimplifiedRedCost ( )
pure virtual

returns a reference to the unsimplified reduced costs.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ unsimplifiedSlacks()

virtual const VectorBase<R>& unsimplifiedSlacks ( )
pure virtual

returns a reference to the unsimplified slack values.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::isUnsimplified().

◆ unsimplify()

virtual void unsimplify ( const VectorBase< R > &  ,
const VectorBase< R > &  ,
const VectorBase< R > &  ,
const VectorBase< R > &  ,
const typename SPxSolverBase< R >::VarStatus  [],
const typename SPxSolverBase< R >::VarStatus  [],
bool  isOptimal = true 
)
pure virtual

reconstructs an optimal solution for the unsimplified LP.

Implemented in SPxMainSM< R >, SPxMainSM< BP >, Presol< R >, and Presol< BP >.

Referenced by SPxSimplifier< BP >::timeUsed().

Member Data Documentation

◆ _tolerances

std::shared_ptr<Tolerances> _tolerances
protected

Definition at line 83 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::tolerances().

◆ m_chgBnds

int m_chgBnds
protected

number of changed bounds

Definition at line 69 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_chgLRhs

int m_chgLRhs
protected

number of change right-hand sides

Definition at line 71 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_keptBnds

int m_keptBnds
protected

number of kept bounds

Definition at line 73 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_keptLRhs

int m_keptLRhs
protected

number of kept left- and right-hand sides

Definition at line 75 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_minReduction

R m_minReduction
protected

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

Definition at line 79 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_name

const char* m_name
protected

name of the simplifier

Definition at line 58 of file spxsimplifier.h.

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

◆ m_objoffset

R m_objoffset
protected

objective offset

Definition at line 77 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::getObjoffset(), and SPxSimplifier< BP >::operator=().

◆ m_remCols

int m_remCols
protected

number of removed columns

Definition at line 65 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_remNzos

int m_remNzos
protected

number of removed nonzero coefficients

Definition at line 67 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_remRows

int m_remRows
protected

number of removed rows

Definition at line 63 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_timerType

Timer::TYPE m_timerType
protected

Definition at line 61 of file spxsimplifier.h.

Referenced by SPxSimplifier< BP >::operator=().

◆ m_timeUsed

Timer* m_timeUsed
protected

user time used for simplification

Definition at line 60 of file spxsimplifier.h.

Referenced by Presol< BP >::getBasis(), and SPxSimplifier< BP >::operator=().

◆ spxout

SPxOut* spxout
protected

message handler

tolerances used by the solver

Definition at line 81 of file spxsimplifier.h.

Referenced by Presol< BP >::getBasis(), and SPxSimplifier< BP >::operator=().