Scippy

SoPlex

Sequential object-oriented simPlex

Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer classes to be used by SoPlex. The pricer's task is to select a vector to enter or leave the simplex basis, depending on the chosen simplex type. More...

#include <spxpricer.h>

Inheritance diagram for SPxPricer:

Classes

struct  IdxCompare
 Compare class to sort idx/val pairs, used for hypersparse pricing leaving. More...
 
struct  IdxElement
 

Public Types

enum  ViolationType { NOT_VIOLATED = 0, VIOLATED = 1, VIOLATED_AND_CHECKED = 2 }
 

Public Member Functions

Initialization
virtual const char * getName () const
 get name of pricer. More...
 
virtual void load (SPxSolver *p_solver)
 loads LP. More...
 
virtual void clear ()
 unloads LP. More...
 
virtual SPxSolversolver () const
 returns loaded SPxSolver object. More...
 
virtual Real epsilon () const
 returns violation bound theeps. More...
 
virtual void setEpsilon (Real eps)
 sets violation bound. More...
 
virtual void setType (SPxSolver::Type)
 sets pricing type. More...
 
virtual void setRep (SPxSolver::Representation)
 sets basis representation. More...
 
Pivoting
virtual int selectLeave ()=0
 returns selected index to leave basis. More...
 
virtual void left4 (int, SPxId)
 performs leaving pivot. More...
 
virtual SPxId selectEnter ()=0
 selects Id to enter basis. More...
 
virtual void entered4 (SPxId, int)
 performs entering pivot. More...
 
Extension
virtual void addedVecs (int)
 n vectors have been added to loaded LP. More...
 
virtual void addedCoVecs (int)
 n covectors have been added to loaded LP. More...
 
Shrinking
virtual void removedVec (int)
 vector i was removed from loaded LP. More...
 
virtual void removedVecs (const int *)
 vectors given by perm have been removed from loaded LP. More...
 
virtual void removedCoVec (int)
 covector i was removed from loaded LP. More...
 
virtual void removedCoVecs (const int *)
 covectors given by perm have been removed from loaded LP. More...
 
Import/Export norms
virtual void getNdualNorms (int &nrows, int &ncols) const
 get number of available norms More...
 
virtual bool getDualNorms (int &nrows, int &ncols, Real *norms) const
 export norms from pricer More...
 
virtual bool setDualNorms (int nrows, int ncols, Real *norms)
 import norms into pricer More...
 
Debugging
virtual bool isConsistent () const
 
Constructors / Destructors
 SPxPricer (const char *p_name)
 constructor More...
 
 SPxPricer (const SPxPricer &old)
 copy constructor More...
 
SPxPriceroperator= (const SPxPricer &rhs)
 assignment operator More...
 
virtual ~SPxPricer ()
 destructor. More...
 
virtual SPxPricerclone () const =0
 clone function for polymorphism More...
 

Protected Attributes

IdxCompare compare
 
Data
const char * m_name
 name of the pricer More...
 
SPxSolverthesolver
 the solver More...
 
Real theeps
 violation bound More...
 
DVector weights
 vector to store pricing weights or norms More...
 
DVector coWeights
 
bool weightsAreSetup
 are the weights already set up? More...
 

Detailed Description

Abstract pricer base class.

Class SPxPricer is a pure virtual class defining the interface for pricer classes to be used by SoPlex. The pricer's task is to select a vector to enter or leave the simplex basis, depending on the chosen simplex type.

An SPxPricer first loads the SoPlex object for which pricing is to be performed. Then, depending of the SPxSolver::Type, methods selectEnter() and entered4() (for entering Simplex) or selectLeave() and left4() (for leaving Simplex) are called by SoPlex. The SPxPricer object is informed of a change of the SPxSolver::Type by calling method setType().

Definition at line 46 of file spxpricer.h.

Member Enumeration Documentation

Enumerator
NOT_VIOLATED 
VIOLATED 
VIOLATED_AND_CHECKED 

Definition at line 98 of file spxpricer.h.

Constructor & Destructor Documentation

SPxPricer ( const char *  p_name)
explicit

constructor

Definition at line 362 of file spxpricer.h.

SPxPricer ( const SPxPricer old)

copy constructor

Definition at line 372 of file spxpricer.h.

virtual ~SPxPricer ( )
virtual

destructor.

Definition at line 400 of file spxpricer.h.

References SPxPricer::clone().

Member Function Documentation

virtual void addedCoVecs ( int  )
virtual

n covectors have been added to loaded LP.

Reimplemented in SPxSteepPR, SPxWeightPR, SPxDevexPR, and SPxHybridPR.

Definition at line 226 of file spxpricer.h.

Referenced by SPxHybridPR::addedCoVecs(), and SPxSolver::addedRows().

virtual void addedVecs ( int  )
virtual

n vectors have been added to loaded LP.

Reimplemented in SPxSteepPR, SPxWeightPR, SPxDevexPR, and SPxHybridPR.

Definition at line 223 of file spxpricer.h.

Referenced by SPxSolver::addedRows(), and SPxHybridPR::addedVecs().

virtual void clear ( )
virtual
virtual SPxPricer* clone ( ) const
pure virtual
virtual void entered4 ( SPxId  ,
int   
)
virtual

performs entering pivot.

Method entered4() is called after each simplex iteration in ENTER mode. It informs the SPxPricer that variable id has entered at the n 'th position. When being called, all vectors of SoPlex involved in such an entering update are setup correctly and may be accessed via the corresponding methods (fVec(), pVec(), etc.). In general, argument id will be the one returned by the SPxPricer at the previous call to selectEnter(). However, one can not rely on this.

Reimplemented in SPxSteepPR, SPxDevexPR, SPxAutoPR, and SPxHybridPR.

Definition at line 214 of file spxpricer.h.

Referenced by SPxHybridPR::entered4(), SPxAutoPR::entered4(), and SPxSolver::solve().

virtual Real epsilon ( ) const
virtual

returns violation bound theeps.

Definition at line 135 of file spxpricer.h.

References SPxPricer::theeps.

Referenced by SPxWeightPR::computeCP(), SPxWeightPR::computeRP(), SPxSolver::precisionReached(), and SPxSolver::solve().

virtual bool getDualNorms ( int &  nrows,
int &  ncols,
Real norms 
) const
virtual
virtual const char* getName ( ) const
virtual

get name of pricer.

Definition at line 109 of file spxpricer.h.

References SPxPricer::m_name.

Referenced by SoPlex::getPricerName(), main(), SPxAutoPR::selectEnter(), SPxAutoPR::selectLeave(), and SPxHybridPR::setType().

virtual void getNdualNorms ( int &  nrows,
int &  ncols 
) const
virtual
virtual bool isConsistent ( ) const
virtual

Reimplemented in SPxSteepPR, SPxWeightPR, SPxDevexPR, and SPxHybridPR.

Definition at line 348 of file spxpricer.h.

Referenced by SPxHybridPR::isConsistent(), and SPxPricer::operator=().

virtual void left4 ( int  ,
SPxId   
)
virtual

performs leaving pivot.

Method left4() is called after each simplex iteration in LEAVE mode. It informs the SPxPricer that the n 'th variable has left the basis for id to come in at this position. When being called, all vectors of SoPlex involved in such an entering update are setup correctly and may be accessed via the corresponding methods (fVec(), pVec(), etc.). In general, argument n will be the one returned by the SPxPricer at the previous call to selectLeave(). However, one can not rely on this.

Reimplemented in SPxSteepPR, SPxDevexPR, SPxAutoPR, and SPxHybridPR.

Definition at line 186 of file spxpricer.h.

References SPxPricer::selectEnter().

Referenced by SPxHybridPR::left4(), SPxAutoPR::left4(), and SPxSolver::solve().

virtual void load ( SPxSolver p_solver)
virtual

loads LP.

Loads the solver and LP for which pricing steps are to be performed.

Reimplemented in SPxSteepPR, SPxWeightPR, SPxParMultPR, SPxDevexPR, SPxAutoPR, and SPxHybridPR.

Definition at line 117 of file spxpricer.h.

Referenced by SPxSolver::init(), SPxSolver::operator=(), SPxSolver::setPricer(), and SPxSolver::SPxSolver().

virtual void removedCoVec ( int  )
virtual

covector i was removed from loaded LP.

Reimplemented in SPxSteepPR, and SPxWeightPR.

Definition at line 240 of file spxpricer.h.

virtual void removedCoVecs ( const int *  )
virtual

covectors given by perm have been removed from loaded LP.

Definition at line 243 of file spxpricer.h.

virtual void removedVec ( int  )
virtual

vector i was removed from loaded LP.

Reimplemented in SPxSteepPR, and SPxWeightPR.

Definition at line 234 of file spxpricer.h.

Referenced by SPxSolver::doRemoveCol(), and SPxSolver::doRemoveRow().

virtual void removedVecs ( const int *  )
virtual

vectors given by perm have been removed from loaded LP.

Definition at line 237 of file spxpricer.h.

Referenced by SPxSolver::doRemoveCols(), and SPxSolver::doRemoveRows().

virtual SPxId selectEnter ( )
pure virtual

selects Id to enter basis.

Selects the SPxId of a vector to enter the basis. The selected id, must not represent a basic index (i.e. solver()->isBasic(id) must be false). However, the corresponding test value needs not to be less than -epsilon(). If not, SoPlex will discard the pivot.

Note: When method selectEnter() is called by the loaded SoPlex object, all values from coTest() are up to date. However, whether the elements of test() are up to date depends on the SPxSolver::Pricing type.

Implemented in SPxSteepPR, SPxWeightPR, SPxParMultPR, SPxDevexPR, SPxAutoPR, SPxDantzigPR, and SPxHybridPR.

Referenced by SPxPricer::left4(), SPxHybridPR::selectEnter(), SPxAutoPR::selectEnter(), and SPxSolver::solve().

virtual int selectLeave ( )
pure virtual

returns selected index to leave basis.

Selects the index of a vector to leave the basis. The selected index i, say, must be in the range 0 <= i < solver()->dim() and its tested value must fullfill solver()->test()[i] < -epsilon().

Implemented in SPxSteepPR, SPxWeightPR, SPxParMultPR, SPxDevexPR, SPxAutoPR, SPxDantzigPR, and SPxHybridPR.

Referenced by SPxHybridPR::selectLeave(), SPxAutoPR::selectLeave(), SPxPricer::setRep(), and SPxSolver::solve().

virtual bool setDualNorms ( int  nrows,
int  ncols,
Real norms 
)
virtual
virtual void setEpsilon ( Real  eps)
virtual

sets violation bound.

Inequality violations are accepted, if their size is less than eps.

Reimplemented in SPxAutoPR, and SPxHybridPR.

Definition at line 143 of file spxpricer.h.

Referenced by SPxHybridPR::setEpsilon(), SPxAutoPR::setEpsilon(), and SPxSolver::solve().

virtual void setRep ( SPxSolver::Representation  )
virtual

sets basis representation.

Informs pricer about (a change of) the loaded SoPlex's Representation.

Reimplemented in SPxSteepPR, SPxWeightPR, SPxDevexPR, SPxAutoPR, and SPxHybridPR.

Definition at line 161 of file spxpricer.h.

References SPxPricer::selectLeave().

Referenced by SPxSolver::initRep(), and SPxHybridPR::setRep().

virtual void setType ( SPxSolver::Type  )
virtual

sets pricing type.

Informs pricer about (a change of) the loaded SoPlex's Type. In the sequel, only the corresponding select methods may be called.

Reimplemented in SPxSteepPR, SPxWeightPR, SPxParMultPR, SPxDevexPR, SPxAutoPR, and SPxHybridPR.

Definition at line 154 of file spxpricer.h.

Referenced by SPxAutoPR::setActivePricer(), SPxHybridPR::setType(), SPxAutoPR::setType(), and SPxSolver::solve().

Member Data Documentation

const char* m_name
protected

name of the pricer

Definition at line 54 of file spxpricer.h.

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

SPxSolver* thesolver
protected

the solver

Definition at line 56 of file spxpricer.h.

Referenced by SPxDevexPR::addedCoVecs(), SPxSteepPR::addedCoVecs(), SPxDevexPR::addedVecs(), SPxSteepPR::addedVecs(), SPxDevexPR::buildBestPriceVectorEnterCoDim(), SPxSteepPR::buildBestPriceVectorEnterCoDim(), SPxDevexPR::buildBestPriceVectorEnterDim(), SPxSteepPR::buildBestPriceVectorEnterDim(), SPxDevexPR::buildBestPriceVectorLeave(), SPxSteepPR::buildBestPriceVectorLeave(), SPxHybridPR::clear(), SPxAutoPR::clear(), SPxSteepPR::clear(), SPxWeightPR::computeLeavePenalty(), SPxDevexPR::entered4(), SPxSteepPR::entered4(), SPxDevexPR::init(), SPxHybridPR::isConsistent(), SPxDevexPR::isConsistent(), SPxSteepPR::isConsistent(), SPxDevexPR::left4(), SPxSteepPR::left4(), SPxHybridPR::load(), SPxAutoPR::load(), SPxDevexPR::load(), SPxParMultPR::load(), SPxWeightPR::load(), SPxSteepPR::load(), SPxPricer::operator=(), SPxSteepPR::removedCoVec(), SPxSteepPR::removedCoVecs(), SPxSteepPR::removedVec(), SPxSteepPR::removedVecs(), SPxDantzigPR::selectEnter(), SPxAutoPR::selectEnter(), SPxDevexPR::selectEnter(), SPxParMultPR::selectEnter(), SPxSteepPR::selectEnter(), SPxDantzigPR::selectEnterDenseCoDim(), SPxDevexPR::selectEnterDenseCoDim(), SPxSteepPR::selectEnterDenseCoDim(), SPxDantzigPR::selectEnterDenseDim(), SPxDevexPR::selectEnterDenseDim(), SPxSteepPR::selectEnterDenseDim(), SPxDevexPR::selectEnterHyperCoDim(), SPxSteepPR::selectEnterHyperCoDim(), SPxDevexPR::selectEnterHyperDim(), SPxSteepPR::selectEnterHyperDim(), SPxDantzigPR::selectEnterSparseCoDim(), SPxDevexPR::selectEnterSparseCoDim(), SPxSteepPR::selectEnterSparseCoDim(), SPxDantzigPR::selectEnterSparseDim(), SPxDevexPR::selectEnterSparseDim(), SPxSteepPR::selectEnterSparseDim(), SPxDantzigPR::selectEnterX(), SPxDevexPR::selectEnterX(), SPxSteepPR::selectEnterX(), SPxDantzigPR::selectLeave(), SPxAutoPR::selectLeave(), SPxDevexPR::selectLeave(), SPxParMultPR::selectLeave(), SPxWeightPR::selectLeave(), SPxSteepPR::selectLeave(), SPxDevexPR::selectLeaveHyper(), SPxSteepPR::selectLeaveHyper(), SPxDantzigPR::selectLeaveSparse(), SPxDevexPR::selectLeaveSparse(), SPxSteepPR::selectLeaveSparse(), SPxDevexPR::selectLeaveX(), SPxSteepPR::selectLeaveX(), SPxAutoPR::setActivePricer(), SPxDevexPR::setRep(), SPxSteepPR::setRep(), SPxHybridPR::setType(), SPxParMultPR::setType(), SPxWeightPR::setType(), SPxSteepPR::setType(), SPxSteepPR::setupPrefs(), SPxSteepPR::setupPrefsX(), SPxSteepPR::setupWeights(), and SPxPricer::solver().

bool weightsAreSetup
protected

are the weights already set up?

Definition at line 63 of file spxpricer.h.

Referenced by SPxSteepPR::clear(), SPxDevexPR::init(), SPxPricer::operator=(), and SPxSteepPR::setupWeights().