Scippy

SoPlex

Sequential object-oriented simPlex

SPxDefaultRT Class Reference

Textbook ratio test for SoPlex.Class SPxDefaultRT provides an implementation of the textbook ratio test as a derived class of SPxRatioTester. This class is not intended for reliably solving LPs (even though it does the job for ``numerically simple'' LPs). Instead, it should serve as a demonstration of how to write ratio tester classes. More...

#include <spxdefaultrt.h>

Public Member Functions

Construction / destruction
 SPxDefaultRT ()
 default constructor More...
 
 SPxDefaultRT (const SPxDefaultRT &old)
 copy constructor More...
 
SPxDefaultRToperator= (const SPxDefaultRT &rhs)
 assignment operator More...
 
virtual ~SPxDefaultRT ()
 destructor More...
 
virtual SPxRatioTesterclone () const
 clone function for polymorphism More...
 
Select enter/leave
virtual int selectLeave (Real &val, Real, bool)
 
virtual SPxId selectEnter (Real &val, int, bool)
 
- Public Member Functions inherited from SPxRatioTester
virtual const char * getName () const
 get name of ratio tester. More...
 
virtual void load (SPxSolver *p_solver)
 loads LP. More...
 
virtual void clear ()
 unloads LP. More...
 
virtual SPxSolversolver () const
 returns loaded LP solver. More...
 
virtual void setDelta (Real newDelta)
 set allowed bound violation More...
 
virtual Real getDelta ()
 get allowed bound violation More...
 
virtual void setType (SPxSolver::Type)
 sets Simplex type. More...
 
 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...
 

Additional Inherited Members

- Protected Attributes inherited from SPxRatioTester
SPxSolverthesolver
 the solver More...
 
const char * m_name
 name of the ratio tester More...
 
SPxSolver::Type m_type
 internal storage of type More...
 
Real delta
 allowed bound violation More...
 

Detailed Description

Textbook ratio test for SoPlex.

Class SPxDefaultRT provides an implementation of the textbook ratio test as a derived class of SPxRatioTester. This class is not intended for reliably solving LPs (even though it does the job for ``numerically simple'' LPs). Instead, it should serve as a demonstration of how to write ratio tester classes.

See SPxRatioTester for a class documentation.

Definition at line 42 of file spxdefaultrt.h.

Constructor & Destructor Documentation

◆ SPxDefaultRT() [1/2]

default constructor

Definition at line 50 of file spxdefaultrt.h.

Referenced by SPxDefaultRT::clone().

◆ SPxDefaultRT() [2/2]

SPxDefaultRT ( const SPxDefaultRT old)

copy constructor

Definition at line 54 of file spxdefaultrt.h.

◆ ~SPxDefaultRT()

virtual ~SPxDefaultRT ( )
virtual

destructor

Definition at line 68 of file spxdefaultrt.h.

Member Function Documentation

◆ clone()

virtual SPxRatioTester* clone ( ) const
virtual

clone function for polymorphism

Implements SPxRatioTester.

Definition at line 71 of file spxdefaultrt.h.

References SPxDefaultRT::selectEnter(), SPxDefaultRT::selectLeave(), and SPxDefaultRT::SPxDefaultRT().

◆ operator=()

SPxDefaultRT& operator= ( const SPxDefaultRT rhs)

assignment operator

Definition at line 58 of file spxdefaultrt.h.

References SPxRatioTester::operator=().

◆ selectEnter()

◆ selectLeave()

int selectLeave ( Real val,
Real  ,
bool   
)
virtual

Here comes the ratio test for selecting a variable to leave the basis. It is assumed that Vec.delta() and fVec.idx() have been setup correctly!

The leaving variable is selected such that the update of fVec() (using fVec.value() * fVec.delta()) keeps the basis feasible within solver()->entertol(). Hence, fVec.value() must be chosen such that one updated value of theFvec just reaches its bound and no other one exceeds them by more than solver()->entertol(). Further, fVec.value() must have the same sign as argument val.

The return value of selectLeave() is the number of a variable in the basis selected to leave the basis. -1 indicates that no variable could be selected. Otherwise, parameter val contains the chosen fVec.value().

Implements SPxRatioTester.

Definition at line 40 of file spxdefaultrt.cpp.

References ASSERT_WARN, SPxRatioTester::delta, UpdateVector::delta(), SPxSolver::epsilon(), SPxSolver::fVec(), VectorBase< R >::get_const_ptr(), UpdateVector::idx(), IdxSet::index(), soplex::infinity, SPxSolver::lbBound(), SSVectorBase< R >::setup(), IdxSet::size(), SPxRatioTester::solver(), SPxSolver::ubBound(), and SSVectorBase< R >::values().

Referenced by SPxDefaultRT::clone().