Scippy

SoPlex

Sequential object-oriented simPlex

SPxRatioTester< R > Class Template Referenceabstract

Abstract ratio test base class.Class SPxRatioTester is the virtual base class for computing the ratio test within the Simplex algorithm driven by SoPlex. After a SoPlex solver has been load()ed to an SPxRatioTester, the solver calls selectLeave() for computing the ratio test for the entering simplex and selectEnter() for computing the ratio test in leaving simplex. More...

#include <spxratiotester.h>

Public Member Functions

Access / modification
virtual const char * getName () const
 get name of ratio tester. More...
 
virtual void load (SPxSolverBase< R > *p_solver)
 loads LP. More...
 
virtual void clear ()
 unloads LP. More...
 
virtual SPxSolverBase< R > * solver () const
 returns loaded LP solver. More...
 
virtual void setDelta (R newDelta)
 set allowed bound violation More...
 
virtual R getDelta ()
 get allowed bound violation More...
 
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...
 
Entering / leaving
virtual int selectLeave (R &val, R enterTest, bool polish=false)=0
 selects index to leave the basis. More...
 
virtual SPxId selectEnter (R &val, int leaveIdx, bool polish=false)=0
 selects variable Id to enter the basis. More...
 
virtual void setType (typename SPxSolverBase< R >::Type)
 sets Simplex type. More...
 
Construction / destruction
 SPxRatioTester (const char *name)
 default constructor More...
 
 SPxRatioTester (const SPxRatioTester &old)
 copy constructor More...
 
SPxRatioTesteroperator= (const SPxRatioTester &rhs)
 assignment operator More...
 
virtual ~SPxRatioTester ()
 destructor. More...
 
virtual SPxRatioTesterclone () const =0
 clone function for polymorphism More...
 

Protected Attributes

Data
SPxSolverBase< R > * thesolver
 the solver More...
 
const char * m_name
 name of the ratio tester More...
 
SPxSolverBase< R >::Type m_type
 internal storage of type More...
 
delta
 allowed bound violation More...
 
std::shared_ptr< Tolerances_tolerances
 tolerances used by the solver More...
 

Detailed Description

template<class R>
class soplex::SPxRatioTester< R >

Abstract ratio test base class.

Class SPxRatioTester is the virtual base class for computing the ratio test within the Simplex algorithm driven by SoPlex. After a SoPlex solver has been load()ed to an SPxRatioTester, the solver calls selectLeave() for computing the ratio test for the entering simplex and selectEnter() for computing the ratio test in leaving simplex.

Definition at line 50 of file spxratiotester.h.

Constructor & Destructor Documentation

◆ SPxRatioTester() [1/2]

SPxRatioTester ( const char *  name)
explicit

default constructor

Definition at line 192 of file spxratiotester.h.

◆ SPxRatioTester() [2/2]

SPxRatioTester ( const SPxRatioTester< R > &  old)

copy constructor

Definition at line 199 of file spxratiotester.h.

◆ ~SPxRatioTester()

virtual ~SPxRatioTester ( )
virtual

destructor.

Definition at line 219 of file spxratiotester.h.

Member Function Documentation

◆ clear()

virtual void clear ( )
virtual

unloads LP.

Definition at line 88 of file spxratiotester.h.

◆ clone()

◆ getDelta()

virtual R getDelta ( )
virtual

get allowed bound violation

Reimplemented in SPxFastRT< R >, and SPxFastRT< BP >.

Definition at line 109 of file spxratiotester.h.

◆ getName()

virtual const char* getName ( ) const
virtual

get name of ratio tester.

Definition at line 75 of file spxratiotester.h.

◆ load()

virtual void load ( SPxSolverBase< R > *  p_solver)
virtual

loads LP.

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

Reimplemented in SPxFastRT< R >, and SPxFastRT< BP >.

Definition at line 82 of file spxratiotester.h.

◆ operator=()

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

assignment operator

Definition at line 206 of file spxratiotester.h.

Referenced by SPxDefaultRT< BP >::operator=(), SPxHarrisRT< BP >::operator=(), and SPxFastRT< BP >::operator=().

◆ selectEnter()

virtual SPxId selectEnter ( R &  val,
int  leaveIdx,
bool  polish = false 
)
pure virtual

selects variable Id to enter the basis.

Method selectEnter() is called by the loaded SoPlex solver, when computing the leaving simplex algorithm. It's task is to select and return the Id of the basis variable that is to enter the basis. When being called, pVec() fullfills the bounds lbBound() and ubBound() within leavetol(). Similarly, coPvec() fulfills the bounds lbBound() and ubBound() within leavetol(). pVec().delta() and coPvec().delta() are the vectors by which pVec() and coPvec() will be updated in this simplex step. Their nonzero indices are stored in sorted order in pVec().idx() and coPvec().idx().

If val > 0, val is the maximum allowed update value for pVec() and coPvec(), otherwise the minimum. Method selectEnter() must chose val of the same sign as passed, such that updating pVec() and coPvec() by val yields a new vector that satisfies all basic bounds (within leavetol). The returned Id must be the Id of an element of pVec() or coPvec(), that reaches one of its bounds with this update.

Implemented in SPxBoundFlippingRT< R >, SPxBoundFlippingRT< BP >, SPxFastRT< R >, SPxFastRT< BP >, SPxHarrisRT< R >, SPxHarrisRT< BP >, SPxDefaultRT< R >, and SPxDefaultRT< BP >.

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

◆ selectLeave()

virtual int selectLeave ( R &  val,
enterTest,
bool  polish = false 
)
pure virtual

selects index to leave the basis.

Method selectLeave() is called by the loaded SoPlex solver when computing the entering simplex algorithm. Its task is to select and return the index of the basis variable that is to leave the basis. When being called, fVec() fullfills the basic bounds lbBound() and ubBound() within entertol(). fVec().delta() is the vector by which fVec() will be updated in this simplex step. Its nonzero indices are stored in sorted order in fVec().idx().

If val > 0, val is the maximum allowed update value for fVec(), otherwise the minimum. Method selectLeave() must chose val of the same sign as passed, such that updating fVec() by val yields a new vector that satisfies all basic bounds (within entertol). The returned index, must be the index of an element of fVec(), that reaches one of its bounds with this update.

Implemented in SPxBoundFlippingRT< R >, SPxBoundFlippingRT< BP >, SPxFastRT< R >, SPxFastRT< BP >, SPxHarrisRT< R >, SPxHarrisRT< BP >, SPxDefaultRT< R >, and SPxDefaultRT< BP >.

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

◆ setDelta()

virtual void setDelta ( newDelta)
virtual

set allowed bound violation

Reimplemented in SPxFastRT< R >, and SPxFastRT< BP >.

Definition at line 100 of file spxratiotester.h.

◆ setTolerances()

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

set the _tolerances member variable

Reimplemented in SPxBoundFlippingRT< R >, and SPxBoundFlippingRT< BP >.

Definition at line 115 of file spxratiotester.h.

◆ setType()

virtual void setType ( typename SPxSolverBase< R >::Type  )
virtual

sets Simplex 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 SPxFastRT< R >, and SPxFastRT< BP >.

Definition at line 184 of file spxratiotester.h.

◆ solver()

virtual SPxSolverBase<R>* solver ( ) const
virtual

returns loaded LP solver.

Definition at line 94 of file spxratiotester.h.

Referenced by SPxFastRT< BP >::clone().

◆ tolerances()

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

get the _tolerances member variable

Definition at line 120 of file spxratiotester.h.

Referenced by SPxRatioTester< BP >::setDelta(), SPxFastRT< BP >::setDelta(), and SPxBoundFlippingRT< BP >::setTolerances().

Member Data Documentation

◆ _tolerances

std::shared_ptr<Tolerances> _tolerances
protected

tolerances used by the solver

Definition at line 66 of file spxratiotester.h.

Referenced by SPxBoundFlippingRT< BP >::setTolerances(), and SPxRatioTester< BP >::tolerances().

◆ delta

R delta
protected

allowed bound violation

Definition at line 64 of file spxratiotester.h.

Referenced by SPxRatioTester< BP >::getDelta(), SPxRatioTester< BP >::operator=(), and SPxFastRT< BP >::setDelta().

◆ m_name

const char* m_name
protected

name of the ratio tester

Definition at line 60 of file spxratiotester.h.

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

◆ m_type

SPxSolverBase<R>::Type m_type
protected

internal storage of type

Definition at line 62 of file spxratiotester.h.

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

◆ thesolver

SPxSolverBase<R>* thesolver
protected

the solver

Definition at line 58 of file spxratiotester.h.

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