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... | |
SPxDefaultRT & | operator= (const SPxDefaultRT &rhs) |
assignment operator More... | |
virtual | ~SPxDefaultRT () |
destructor More... | |
virtual SPxRatioTester * | clone () 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 SPxSolver * | solver () 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... | |
SPxRatioTester & | operator= (const SPxRatioTester &rhs) |
assignment operator More... | |
virtual | ~SPxRatioTester () |
destructor. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SPxRatioTester | |
SPxSolver * | thesolver |
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... | |
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.
SPxDefaultRT | ( | ) |
default constructor
Definition at line 50 of file spxdefaultrt.h.
Referenced by SPxDefaultRT::clone().
SPxDefaultRT | ( | const SPxDefaultRT & | old | ) |
copy constructor
Definition at line 54 of file spxdefaultrt.h.
|
virtual |
destructor
Definition at line 68 of file spxdefaultrt.h.
|
virtual |
clone function for polymorphism
Implements SPxRatioTester.
Definition at line 71 of file spxdefaultrt.h.
References SPxDefaultRT::selectEnter(), SPxDefaultRT::selectLeave(), and SPxDefaultRT::SPxDefaultRT().
SPxDefaultRT& operator= | ( | const SPxDefaultRT & | rhs | ) |
assignment operator
Definition at line 58 of file spxdefaultrt.h.
References SPxRatioTester::operator=().
Here comes the ratio test. It is assumed that theCoPvec.delta() and theCoPvec.idx() have been setup correctly!
Implements SPxRatioTester.
Definition at line 178 of file spxdefaultrt.cpp.
References SSVectorBase< R >::clearNum(), SPxSolver::coId(), SPxSolver::coPvec(), SPxRatioTester::delta, UpdateVector::delta(), SPxSolver::epsilon(), VectorBase< R >::get_const_ptr(), SPxSolver::id(), UpdateVector::idx(), IdxSet::index(), soplex::infinity, SPxSolver::isBasic(), SPxId::isValid(), SPxSolver::lcBound(), SPxSolver::lpBound(), MSG_DEBUG, SPxSolver::pVec(), SSVectorBase< R >::setup(), IdxSet::size(), SPxRatioTester::solver(), SPxSolver::ucBound(), SPxSolver::upBound(), and SSVectorBase< R >::values().
Referenced by SPxDefaultRT::clone().
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().