Scippy

SoPlex

Sequential object-oriented simPlex

SLUFactorRational Class Reference

Implementation of Sparse Linear Solver with Rational precision.This class implements a SLinSolverRational interface by using the sparse LU factorization implemented in CLUFactorRational. More...

#include <slufactor_rational.h>

Public Types

Types
enum  UpdateType { ETA = 0, FOREST_TOMLIN }
 Specifies how to perform change method. More...
 
typedef SLinSolverRational::Status Status
 for convenience More...
 
- Public Types inherited from SLinSolverRational
enum  Status {
  OK = 0, INSTABLE = 1, SINGULAR = 2, UNLOADED = 4,
  ERROR = 8, TIME = 16
}
 status flags of the SLinSolverRational class. More...
 

Public Member Functions

Update type
UpdateType utype () const
 returns the current update type uptype. More...
 
void setUtype (UpdateType tp)
 sets update type. More...
 
void setMarkowitz (const Rational &m)
 sets minimum Markowitz threshold. More...
 
Rational markowitz ()
 returns Markowitz threshold. More...
 
Derived from SLinSolverRational

See documentation of SLinSolverRational for a documentation of these methods.

void clear ()
 
int dim () const
 
int memory () const
 
const char * getName () const
 
Status status () const
 
Rational stability () const
 
std::string statistics () const
 
Status load (const SVectorRational *vec[], int dim)
 
Solve
void solveRight (VectorRational &x, const VectorRational &b)
 Solves \(Ax=b\). More...
 
void solveRight (SSVectorRational &x, const SVectorRational &b)
 Solves \(Ax=b\). More...
 
void solveRight4update (SSVectorRational &x, const SVectorRational &b)
 Solves \(Ax=b\). More...
 
void solve2right4update (SSVectorRational &x, VectorRational &y, const SVectorRational &b, SSVectorRational &d)
 Solves \(Ax=b\) and \(Ay=d\). More...
 
void solve3right4update (SSVectorRational &x, VectorRational &y, VectorRational &z, const SVectorRational &b, SSVectorRational &d, SSVectorRational &e)
 Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More...
 
void solveLeft (VectorRational &x, const VectorRational &b)
 Solves \(Ax=b\). More...
 
void solveLeft (SSVectorRational &x, const SVectorRational &b)
 Solves \(Ax=b\). More...
 
void solveLeft (SSVectorRational &x, VectorRational &y, const SVectorRational &b, SSVectorRational &d)
 Solves \(Ax=b\) and \(Ay=d\). More...
 
void solveLeft (SSVectorRational &x, VectorRational &y, VectorRational &z, const SVectorRational &b, SSVectorRational &d, SSVectorRational &e)
 Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More...
 
Status change (int idx, const SVectorRational &subst, const SSVectorRational *eta=0)
 
Miscellaneous
Real getFactorTime () const
 time spent in factorizations More...
 
void setTimeLimit (const Real limit)
 set time limit on factorization More...
 
void resetFactorTime ()
 reset FactorTime More...
 
int getFactorCount () const
 number of factorizations performed More...
 
Real getSolveTime () const
 time spent in solves More...
 
void resetSolveTime ()
 reset SolveTime More...
 
int getSolveCount () const
 number of solves performed More...
 
void resetCounters ()
 reset timers and counters More...
 
void dump () const
 prints the LU factorization to stdout. More...
 
bool isConsistent () const
 consistency check. More...
 
Constructors / Destructors
 SLUFactorRational ()
 default constructor. More...
 
SLUFactorRationaloperator= (const SLUFactorRational &old)
 assignment operator. More...
 
 SLUFactorRational (const SLUFactorRational &old)
 copy constructor. More...
 
virtual ~SLUFactorRational ()
 destructor. More...
 
virtual SLinSolverRationalclone () const
 clone function for polymorphism More...
 
- Public Member Functions inherited from SLinSolverRational
 SLinSolverRational ()
 default constructor More...
 
virtual ~SLinSolverRational ()
 destructor More...
 

Protected Member Functions

Protected helpers
void freeAll ()
 
void changeEta (int idx, SSVectorRational &eta)
 
- Protected Member Functions inherited from CLUFactorRational
 CLUFactorRational ()
 default construtor. More...
 
void solveLright (Rational *vec)
 
int solveRight4update (Rational *vec, int *nonz, Rational *rhs, Rational *forest, int *forestNum, int *forestIdx)
 
void solveRight (Rational *vec, Rational *rhs)
 
int solveRight2update (Rational *vec1, Rational *vec2, Rational *rhs1, Rational *rhs2, int *nonz, Rational *forest, int *forestNum, int *forestIdx)
 
void solveRight2 (Rational *vec1, Rational *vec2, Rational *rhs1, Rational *rhs2)
 
void solveLeft (Rational *vec, Rational *rhs)
 
int solveLeftEps (Rational *vec, Rational *rhs, int *nonz)
 
int solveLeft2 (Rational *vec1, int *nonz, Rational *vec2, Rational *rhs1, Rational *rhs2)
 
int vSolveRight4update (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *forest, int *forestNum, int *forestIdx)
 
int vSolveRight4update2 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *forest, int *forestNum, int *forestIdx)
 
int vSolveRight4update3 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *vec3, Rational *rhs3, int *ridx3, int rn3, Rational *forest, int *forestNum, int *forestIdx)
 
void vSolveRightNoNZ (Rational *vec2, Rational *rhs2, int *ridx2, int rn2)
 
int vSolveLeft (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn)
 
void vSolveLeftNoNZ (Rational *vec, Rational *rhs, int *ridx, int rn)
 
int vSolveLeft2 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2)
 
int vSolveLeft3 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *vec3, Rational *rhs3, int *ridx3, int rn3)
 
void forestUpdate (int col, Rational *work, int num, int *nonz)
 Performs the Forrest-Tomlin update of the LU factorization. More...
 
void update (int p_col, Rational *p_work, const int *p_idx, int num)
 
void updateNoClear (int p_col, const Rational *p_work, const int *p_idx, int num)
 
void factor (const SVectorRational **vec, const Rational &threshold)
 pivoting threshold More...
 
void dump () const
 
bool isConsistent () const
 

Protected Attributes

Protected data
bool usetup
 TRUE iff update vector has been setup. More...
 
UpdateType uptype
 the current UpdateType. More...
 
SSVectorRational eta
 
SSVectorRational forest
 ? Update vector set up by solveRight4update() and solve2right4update() More...
 
Rational lastThreshold
 pivoting threshold of last factorization More...
 
Control Parameters
Rational minThreshold
 minimum threshold to use. More...
 
Rational minStability
 minimum stability to achieve by setting threshold. More...
 
TimersolveTime
 Time spent in solves. More...
 
Timer::TYPE timerType
 
int solveCount
 Number of solves. More...
 
- Protected Attributes inherited from CLUFactorRational
SLinSolverRational::Status stat
 Status indicator. More...
 
int thedim
 dimension of factorized matrix More...
 
int nzCnt
 number of nonzeros in U More...
 
Rational initMaxabs
 maximum abs number in initail Matrix More...
 
Rational maxabs
 maximum abs number in L and U More...
 
Real rowMemMult
 factor of minimum Memory * number of nonzeros More...
 
Real colMemMult
 factor of minimum Memory * number of nonzeros More...
 
Real lMemMult
 factor of minimum Memory * number of nonzeros More...
 
Perm row
 row permutation matrices More...
 
Perm col
 column permutation matrices More...
 
L l
 L matrix. More...
 
DVectorRational diag
 Array of pivot elements. More...
 
U u
 U matrix. More...
 
Rationalwork
 Working array: must always be left as 0! More...
 
TimerfactorTime
 Time spent in factorizations. More...
 
int factorCount
 Number of factorizations. More...
 
Real timeLimit
 Time limit on factorization or solves. More...
 

Private Member Functions

Private helpers
void assign (const SLUFactorRational &old)
 used to implement the assignment operator More...
 

Private Attributes

Private data
DVectorRational vec
 Temporary vector. More...
 
SSVectorRational ssvec
 Temporary semi-sparse vector. More...
 

Detailed Description

Implementation of Sparse Linear Solver with Rational precision.

This class implements a SLinSolverRational interface by using the sparse LU factorization implemented in CLUFactorRational.

Definition at line 42 of file slufactor_rational.h.

Member Typedef Documentation

◆ Status

for convenience

Definition at line 56 of file slufactor_rational.h.

Member Enumeration Documentation

◆ UpdateType

enum UpdateType

Specifies how to perform change method.

Enumerator
ETA 
FOREST_TOMLIN 

Definition at line 50 of file slufactor_rational.h.

Constructor & Destructor Documentation

◆ SLUFactorRational() [1/2]

default constructor.

Definition at line 697 of file slufactor_rational.cpp.

References SLUFactorRational::clear(), CLUFactorRational::U::col, CLUFactorRational::col, TimerFactory::createTimer(), CLUFactorRational::diag, VectorBase< R >::dim(), CLUFactorRational::U::Row::elem, CLUFactorRational::U::Col::elem, CLUFactorRational::factorCount, CLUFactorRational::factorTime, CLUFactorRational::L::firstUnused, CLUFactorRational::L::firstUpdate, SLUFactorRational::freeAll(), VectorBase< R >::get_ptr(), CLUFactorRational::Dring::idx, CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, SLUFactorRational::isConsistent(), CLUFactorRational::l, CLUFactorRational::U::Row::len, CLUFactorRational::U::Col::len, CLUFactorRational::U::Row::list, CLUFactorRational::U::Col::list, CLUFactorRational::U::Row::max, CLUFactorRational::U::Col::max, CLUFactorRational::nzCnt, CLUFactorRational::Perm::orig, CLUFactorRational::Perm::perm, CLUFactorRational::L::rbeg, DVectorBase< R >::reDim(), CLUFactorRational::L::ridx, CLUFactorRational::L::rorig, CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::row, CLUFactorRational::L::rperm, CLUFactorRational::L::rval, CLUFactorRational::U::Col::size, SLUFactorRational::solveCount, SLUFactorRational::solveTime, soplex::spx_alloc(), CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::thedim, CLUFactorRational::timeLimit, SLUFactorRational::timerType, CLUFactorRational::u, CLUFactorRational::U::Row::used, CLUFactorRational::U::Col::used, CLUFactorRational::U::Row::val, CLUFactorRational::U::Col::val, CLUFactorRational::L::val, SLUFactorRational::vec, and CLUFactorRational::work.

Referenced by SLUFactorRational::clone(), and SLUFactorRational::resetCounters().

◆ SLUFactorRational() [2/2]

◆ ~SLUFactorRational()

~SLUFactorRational ( )
virtual

destructor.

Definition at line 907 of file slufactor_rational.cpp.

References SLUFactorRational::freeAll().

Referenced by SLUFactorRational::resetCounters().

Member Function Documentation

◆ assign()

void assign ( const SLUFactorRational old)
private

used to implement the assignment operator

assignment used to implement operator=() and copy constructor. If this is initialised, freeAll() has to be called before. Class objects from SLUFactorRational are not copied here.

Definition at line 492 of file slufactor_rational.cpp.

References CLUFactorRational::U::col, CLUFactorRational::col, CLUFactorRational::colMemMult, CLUFactorRational::diag, VectorBase< R >::dim(), CLUFactorRational::U::Row::elem, CLUFactorRational::U::Col::elem, CLUFactorRational::factorCount, CLUFactorRational::factorTime, CLUFactorRational::L::firstUnused, CLUFactorRational::L::firstUpdate, VectorBase< R >::get_ptr(), CLUFactorRational::Dring::idx, CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, CLUFactorRational::initMaxabs, CLUFactorRational::l, SLUFactorRational::lastThreshold, CLUFactorRational::U::Row::len, CLUFactorRational::U::Col::len, CLUFactorRational::U::Row::list, CLUFactorRational::U::Col::list, CLUFactorRational::lMemMult, CLUFactorRational::U::Row::max, CLUFactorRational::U::Col::max, CLUFactorRational::maxabs, SLUFactorRational::minStability, SLUFactorRational::minThreshold, CLUFactorRational::Dring::next, CLUFactorRational::nzCnt, SLinSolverRational::OK, CLUFactorRational::Perm::orig, CLUFactorRational::Perm::perm, CLUFactorRational::Dring::prev, CLUFactorRational::L::rbeg, DVectorBase< R >::reDim(), CLUFactorRational::L::ridx, CLUFactorRational::L::rorig, CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::row, CLUFactorRational::rowMemMult, CLUFactorRational::L::rperm, CLUFactorRational::L::rval, CLUFactorRational::U::Col::size, soplex::spx_alloc(), CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::stat, CLUFactorRational::thedim, CLUFactorRational::timeLimit, CLUFactorRational::u, CLUFactorRational::L::updateType, SLUFactorRational::uptype, CLUFactorRational::U::Row::used, CLUFactorRational::U::Col::used, CLUFactorRational::U::Row::val, CLUFactorRational::U::Col::val, CLUFactorRational::L::val, SLUFactorRational::vec, and CLUFactorRational::work.

Referenced by SLUFactorRational::clone(), SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().

◆ change()

◆ changeEta()

◆ clear()

void clear ( )
virtual

Implements SLinSolverRational.

Definition at line 421 of file slufactor_rational.cpp.

References VectorBase< R >::clear(), SSVectorBase< R >::clear(), CLUFactorRational::U::col, CLUFactorRational::colMemMult, VectorBase< R >::dim(), SLUFactorRational::eta, CLUFactorRational::L::firstUnused, CLUFactorRational::L::firstUpdate, SLUFactorRational::forest, SLUFactorRational::freeAll(), CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, CLUFactorRational::initMaxabs, CLUFactorRational::l, SLUFactorRational::lastThreshold, CLUFactorRational::lMemMult, CLUFactorRational::maxabs, MINSTABILITY, SLUFactorRational::minStability, SLUFactorRational::minThreshold, CLUFactorRational::L::rbeg, DVectorBase< R >::reDim(), CLUFactorRational::L::ridx, CLUFactorRational::L::rorig, CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::rowMemMult, CLUFactorRational::L::rperm, CLUFactorRational::L::rval, CLUFactorRational::U::Col::size, soplex::spx_alloc(), soplex::spx_free(), SLUFactorRational::ssvec, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::stat, CLUFactorRational::thedim, CLUFactorRational::u, SLinSolverRational::UNLOADED, SLUFactorRational::usetup, CLUFactorRational::U::Row::val, CLUFactorRational::L::val, and SLUFactorRational::vec.

Referenced by SoPlex::_addColReal(), SoPlex::_addColsReal(), SoPlex::_addRowReal(), SoPlex::_addRowsReal(), SoPlex::_changeColReal(), SoPlex::_changeElementReal(), SoPlex::_changeRowReal(), SoPlex::_lift(), SoPlex::_performOptIRStable(), SoPlex::_project(), SoPlex::_removeColReal(), SoPlex::_removeColsReal(), SoPlex::_removeRowReal(), SoPlex::_removeRowsReal(), SoPlex::_solveRealForRational(), SoPlex::_solveRealLPAndRecordStatistics(), SoPlex::_syncLPReal(), SoPlex::_transformEquality(), SoPlex::_transformFeasibility(), SoPlex::_transformUnbounded(), SoPlex::_untransformEquality(), SoPlex::_untransformFeasibility(), SoPlex::_untransformUnbounded(), SoPlex::clearBasis(), SoPlex::clearLPRational(), SoPlex::clearLPReal(), SoPlex::computeBasisInverseRational(), SLUFactorRational::load(), SLUFactorRational::markowitz(), SoPlex::setBasis(), and SLUFactorRational::SLUFactorRational().

◆ clone()

virtual SLinSolverRational* clone ( ) const
virtual

clone function for polymorphism

Implements SLinSolverRational.

Definition at line 283 of file slufactor_rational.h.

References SLUFactorRational::assign(), and SLUFactorRational::SLUFactorRational().

◆ dim()

◆ dump()

void dump ( ) const

prints the LU factorization to stdout.

Definition at line 1046 of file slufactor_rational.cpp.

References CLUFactorRational::dump().

Referenced by SLUFactorRational::load(), and SLUFactorRational::resetCounters().

◆ freeAll()

◆ getFactorCount()

int getFactorCount ( ) const
virtual

number of factorizations performed

Implements SLinSolverRational.

Definition at line 237 of file slufactor_rational.h.

References CLUFactorRational::factorCount.

Referenced by SoPlex::_computeBasisInverseRational(), and SLUFactorRational::statistics().

◆ getFactorTime()

Real getFactorTime ( ) const

time spent in factorizations

Definition at line 222 of file slufactor_rational.h.

References CLUFactorRational::factorTime, and Timer::time().

Referenced by SoPlex::_computeBasisInverseRational(), and SLUFactorRational::statistics().

◆ getName()

const char* getName ( ) const
virtual

Implements SLinSolverRational.

Definition at line 172 of file slufactor_rational.h.

References SLUFactorRational::ETA.

◆ getSolveCount()

int getSolveCount ( ) const

number of solves performed

Definition at line 252 of file slufactor_rational.h.

References SLUFactorRational::solveCount.

Referenced by SLUFactorRational::statistics().

◆ getSolveTime()

Real getSolveTime ( ) const

time spent in solves

Definition at line 242 of file slufactor_rational.h.

References Timer::time().

Referenced by SoPlex::_factorizeColumnRational(), and SLUFactorRational::statistics().

◆ isConsistent()

bool isConsistent ( ) const
virtual

◆ load()

SLUFactorRational::Status load ( const SVectorRational vec[],
int  dim 
)
virtual

Implements SLinSolverRational.

Definition at line 928 of file slufactor_rational.cpp.

References soplex::betterThreshold(), SLUFactorRational::clear(), CLUFactorRational::U::col, CLUFactorRational::col, CLUFactorRational::diag, SLUFactorRational::dim(), SLUFactorRational::dump(), CLUFactorRational::U::Row::elem, CLUFactorRational::U::Col::elem, SLUFactorRational::eta, CLUFactorRational::factor(), CLUFactorRational::L::firstUnused, CLUFactorRational::L::firstUpdate, SLUFactorRational::forest, VectorBase< R >::get_ptr(), CLUFactorRational::Dring::idx, initDR, SLUFactorRational::isConsistent(), CLUFactorRational::l, SLUFactorRational::lastThreshold, CLUFactorRational::U::Row::len, CLUFactorRational::U::Col::len, CLUFactorRational::U::Row::list, CLUFactorRational::U::Col::list, CLUFactorRational::U::Row::max, CLUFactorRational::U::Col::max, MAXUPDATES, MINSTABILITY, SLUFactorRational::minStability, SLUFactorRational::minThreshold, MSG_DEBUG, SLinSolverRational::OK, CLUFactorRational::Perm::orig, CLUFactorRational::Perm::perm, soplex::rationalToString(), DVectorBase< R >::reDim(), SSVectorBase< R >::reDim(), CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::row, SVectorBase< R >::size(), soplex::spx_realloc(), SLUFactorRational::ssvec, SLUFactorRational::stability(), CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::stat, CLUFactorRational::thedim, CLUFactorRational::u, CLUFactorRational::L::updateType, SLUFactorRational::uptype, SLUFactorRational::usetup, SLUFactorRational::vec, and CLUFactorRational::work.

Referenced by SoPlex::_computeBasisInverseRational(), and SLUFactorRational::status().

◆ markowitz()

Rational markowitz ( )

returns Markowitz threshold.

Definition at line 147 of file slufactor_rational.h.

References SLUFactorRational::clear(), and SLUFactorRational::lastThreshold.

◆ memory()

◆ operator=()

◆ resetCounters()

◆ resetFactorTime()

void resetFactorTime ( )

reset FactorTime

Definition at line 232 of file slufactor_rational.h.

References CLUFactorRational::factorTime, and Timer::reset().

◆ resetSolveTime()

void resetSolveTime ( )

reset SolveTime

Definition at line 247 of file slufactor_rational.h.

References Timer::reset().

◆ setMarkowitz()

void setMarkowitz ( const Rational m)

sets minimum Markowitz threshold.

Definition at line 127 of file slufactor_rational.h.

◆ setTimeLimit()

void setTimeLimit ( const Real  limit)

set time limit on factorization

Definition at line 227 of file slufactor_rational.h.

References CLUFactorRational::timeLimit.

Referenced by SoPlex::_computeBasisInverseRational(), and SoPlex::_factorizeColumnRational().

◆ setUtype()

void setUtype ( UpdateType  tp)

sets update type.

The new UpdateType becomes valid only after the next call to method load().

Definition at line 121 of file slufactor_rational.h.

◆ solve2right4update()

◆ solve3right4update()

◆ solveLeft() [1/4]

◆ solveLeft() [2/4]

◆ solveLeft() [3/4]

◆ solveLeft() [4/4]

◆ solveRight() [1/2]

◆ solveRight() [2/2]

◆ solveRight4update()

◆ stability()

◆ statistics()

◆ status()

◆ utype()

UpdateType utype ( ) const

returns the current update type uptype.

Definition at line 112 of file slufactor_rational.h.

References SLUFactorRational::uptype.

Member Data Documentation

◆ eta

◆ forest

◆ lastThreshold

Rational lastThreshold
protected

pivoting threshold of last factorization

Definition at line 77 of file slufactor_rational.h.

Referenced by SLUFactorRational::assign(), SLUFactorRational::clear(), SLUFactorRational::load(), and SLUFactorRational::markowitz().

◆ minStability

Rational minStability
protected

minimum stability to achieve by setting threshold.

Definition at line 86 of file slufactor_rational.h.

Referenced by SLUFactorRational::assign(), SLUFactorRational::clear(), and SLUFactorRational::load().

◆ minThreshold

Rational minThreshold
protected

minimum threshold to use.

Definition at line 84 of file slufactor_rational.h.

Referenced by SLUFactorRational::assign(), SLUFactorRational::clear(), and SLUFactorRational::load().

◆ solveCount

◆ solveTime

◆ ssvec

◆ timerType

Timer::TYPE timerType
protected

Definition at line 89 of file slufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().

◆ uptype

◆ usetup

◆ vec