Scippy

SoPlex

Sequential object-oriented simPlex

SLUFactor Class Reference

Implementation of Sparse Linear Solver.This class implements a SLinSolver interface by using the sparse LU factorization implementet in CLUFactor. More...

#include <slufactor.h>

Inheritance diagram for SLUFactor:

Public Types

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

Public Member Functions

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

See documentation of SLinSolver for a documentation of these methods.

void clear ()
 
int dim () const
 
int memory () const
 
const char * getName () const
 
Status status () const
 
Real stability () const
 
std::string statistics () const
 
Status load (const SVector *vec[], int dim)
 
Solve
void solveRight (Vector &x, const Vector &b)
 Solves $Ax=b$.
 
void solveRight (SSVector &x, const SVector &b)
 Solves $Ax=b$.
 
void solveRight4update (SSVector &x, const SVector &b)
 Solves $Ax=b$.
 
void solve2right4update (SSVector &x, Vector &y, const SVector &b, SSVector &d)
 Solves $Ax=b$ and $Ay=d$.
 
void solve2right4update (SSVector &x, SSVector &y, const SVector &b, SSVector &d)
 Sparse version of solving two systems of equations.
 
void solve3right4update (SSVector &x, Vector &y, Vector &z, const SVector &b, SSVector &d, SSVector &e)
 Solves $Ax=b$, $Ay=d$ and $Az=e$.
 
void solve3right4update (SSVector &x, SSVector &y, SSVector &z, const SVector &b, SSVector &d, SSVector &e)
 sparse version of solving three systems of equations
 
void solveLeft (Vector &x, const Vector &b)
 sparse version of solving one system of equations with transposed basis matrix
 
void solveLeft (SSVector &x, const SVector &b)
 Solves $Ax=b$.
 
void solveLeft (SSVector &x, Vector &y, const SVector &b, SSVector &d)
 Solves $Ax=b$ and $Ay=d$.
 
void solveLeft (SSVector &x, SSVector &two, const SVector &b, SSVector &rhs2)
 sparse version of solving two systems of equations with transposed basis matrix
 
void solveLeft (SSVector &x, Vector &y, Vector &z, const SVector &b, SSVector &d, SSVector &e)
 Solves $Ax=b$, $Ay=d$ and $Az=e$.
 
void solveLeft (SSVector &x, SSVector &y, SSVector &z, const SVector &b, SSVector &d, SSVector &e)
 sparse version of solving three systems of equations with transposed basis matrix
 
Status change (int idx, const SVector &subst, const SSVector *eta=0)
 
Miscellaneous
Real getFactorTime () const
 time spent in factorizations
 
void resetFactorTime ()
 reset FactorTime
 
int getFactorCount () const
 number of factorizations performed
 
Real getSolveTime () const
 time spent in solves
 
void resetSolveTime ()
 reset SolveTime
 
int getSolveCount () const
 number of solves performed
 
void resetCounters ()
 reset timers and counters
 
void dump () const
 prints the LU factorization to stdout.
 
bool isConsistent () const
 consistency check.
 
Constructors / Destructors
 SLUFactor ()
 default constructor.
 
SLUFactoroperator= (const SLUFactor &old)
 assignment operator.
 
 SLUFactor (const SLUFactor &old)
 copy constructor.
 
virtual ~SLUFactor ()
 destructor.
 
virtual SLinSolverclone () const
 clone function for polymorphism
 
- Public Member Functions inherited from SLinSolver
 SLinSolver ()
 default constructor
 
virtual ~SLinSolver ()
 destructor
 

Protected Member Functions

Protected helpers
void freeAll ()
 
void changeEta (int idx, SSVector &eta)
 

Protected Attributes

Protected data
bool usetup
 TRUE iff update vector has been setup.
 
UpdateType uptype
 the current UpdateType.
 
SSVector eta
 
SSVector forest
 ? Update vector set up by solveRight4update() and solve2right4update()
 
Real lastThreshold
 pivoting threshold of last factorization
 
Control Parameters
Real minThreshold
 minimum threshold to use.
 
Real minStability
 minimum stability to achieve by setting threshold.
 
Real epsilon
 |x| < epsililon is considered to be 0.
 
TimersolveTime
 Time spent in solves.
 
Timer::TYPE timerType
 
int solveCount
 Number of solves.
 

Private Member Functions

Private helpers
void assign (const SLUFactor &old)
 used to implement the assignment operator
 

Private Attributes

Private data
DVector vec
 Temporary vector.
 
SSVector ssvec
 Temporary semi-sparse vector.
 

Additional Inherited Members

- Public Attributes inherited from SLinSolver
SPxOutspxout
 message handler
 

Detailed Description

Implementation of Sparse Linear Solver.

This class implements a SLinSolver interface by using the sparse LU factorization implementet in CLUFactor.

Definition at line 41 of file slufactor.h.

Member Typedef Documentation

for convenience

Definition at line 55 of file slufactor.h.

Member Enumeration Documentation

enum UpdateType

Specifies how to perform change method.

Enumerator
ETA 
FOREST_TOMLIN 

Definition at line 49 of file slufactor.h.

Constructor & Destructor Documentation

~SLUFactor ( )
virtual

Member Function Documentation

void assign ( const SLUFactor 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 SLUFactor are not copied here.

Definition at line 752 of file slufactor.cpp.

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

Referenced by SLUFactor::operator=(), and SLUFactor::SLUFactor().

virtual SLinSolver* clone ( ) const
virtual

clone function for polymorphism

Implements SLinSolver.

Definition at line 282 of file slufactor.h.

References SLUFactor::SLUFactor().

int dim ( ) const
virtual

Implements SLinSolver.

Definition at line 156 of file slufactor.h.

References CLUFactor::thedim.

Referenced by SLUFactor::load().

void dump ( ) const

prints the LU factorization to stdout.

Definition at line 1365 of file slufactor.cpp.

References CLUFactor::dump().

Referenced by SLUFactor::load().

int getFactorCount ( ) const
virtual

number of factorizations performed

Implements SLinSolver.

Definition at line 236 of file slufactor.h.

References CLUFactor::factorCount.

Referenced by SoPlex::_solveRealLPAndRecordStatistics(), SoPlexLegacy::getFactorCount(), and SLUFactor::statistics().

Real getFactorTime ( ) const

time spent in factorizations

Definition at line 226 of file slufactor.h.

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

Referenced by SoPlex::_solveRealLPAndRecordStatistics(), SoPlexLegacy::getFactorTime(), and SLUFactor::statistics().

const char* getName ( ) const
virtual

Implements SLinSolver.

Definition at line 166 of file slufactor.h.

References SLUFactor::ETA, and SLUFactor::uptype.

int getSolveCount ( ) const

number of solves performed

Definition at line 251 of file slufactor.h.

References SLUFactor::solveCount.

Referenced by SoPlex::_solveRealLPAndRecordStatistics(), SoPlexLegacy::getSolveCount(), and SLUFactor::statistics().

Real getSolveTime ( ) const

time spent in solves

Definition at line 241 of file slufactor.h.

References SLUFactor::solveTime, and Timer::time().

Referenced by SoPlex::_solveRealLPAndRecordStatistics(), SoPlexLegacy::getSolveTime(), and SLUFactor::statistics().

bool isConsistent ( ) const
virtual

consistency check.

Implements SLinSolver.

Definition at line 1356 of file slufactor.cpp.

References CLUFactor::isConsistent().

Referenced by SLUFactor::load(), SLUFactor::operator=(), and SLUFactor::SLUFactor().

SLUFactor::Status load ( const SVector vec[],
int  dim 
)
virtual
Todo:
if the factorization fails with stat = SINGULAR, distinuish between proven singularity (e.g., because of an empty column) and singularity due to numerics, that could be avoided by changing minStability and lastThreshold; in the first case, we want to abort, otherwise change the numerics

Implements SLinSolver.

Definition at line 1224 of file slufactor.cpp.

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

Real markowitz ( )

returns Markowitz threshold.

Definition at line 141 of file slufactor.h.

References SLUFactor::lastThreshold.

Referenced by SoPlex::_solveRealStable().

int memory ( ) const
virtual

Implements SLinSolver.

Definition at line 161 of file slufactor.h.

References CLUFactor::L::firstUnused, CLUFactor::l, CLUFactor::nzCnt, and CLUFactor::L::start.

void resetCounters ( )
void resetFactorTime ( )

reset FactorTime

Definition at line 231 of file slufactor.h.

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

void resetSolveTime ( )

reset SolveTime

Definition at line 246 of file slufactor.h.

References Timer::reset(), and SLUFactor::solveTime.

void setMarkowitz ( Real  m)

sets minimum Markowitz threshold.

Definition at line 128 of file slufactor.h.

References SLUFactor::lastThreshold, and SLUFactor::minThreshold.

Referenced by SoPlex::_solveRealStable().

void setUtype ( UpdateType  tp)

sets update type.

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

Definition at line 122 of file slufactor.h.

References SLUFactor::uptype.

Referenced by SoPlex::setIntParam(), and SoPlexLegacy::setUtype().

void solveLeft ( Vector x,
const Vector b 
)
virtual

sparse version of solving one system of equations with transposed basis matrix

Todo:
Why is x.clear() here used and not with solveRight() ?

Implements SLinSolver.

Definition at line 363 of file slufactor.cpp.

References VectorBase< R >::clear(), VectorBase< R >::get_ptr(), SLUFactor::solveCount, CLUFactor::solveLeft(), SLUFactor::solveTime, Timer::start(), Timer::stop(), and SLUFactor::vec.

void solveRight ( Vector x,
const Vector b 
)
virtual
Real stability ( ) const
virtual

Implements SLinSolver.

Definition at line 578 of file slufactor.cpp.

References CLUFactor::initMaxabs, CLUFactor::maxabs, SLinSolver::OK, and SLUFactor::status().

Referenced by SLUFactor::change(), and SLUFactor::load().

std::string statistics ( ) const
virtual
Status status ( ) const
virtual

Implements SLinSolver.

Definition at line 171 of file slufactor.h.

References CLUFactor::stat.

Referenced by SLUFactor::change(), and SLUFactor::stability().

UpdateType utype ( ) const

returns the current update type uptype.

Definition at line 113 of file slufactor.h.

References SLUFactor::uptype.

Member Data Documentation

Real epsilon
protected

|x| < epsililon is considered to be 0.

Definition at line 87 of file slufactor.h.

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

Real lastThreshold
protected

pivoting threshold of last factorization

Definition at line 76 of file slufactor.h.

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

Real minStability
protected

minimum stability to achieve by setting threshold.

Definition at line 85 of file slufactor.h.

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

Real minThreshold
protected

minimum threshold to use.

Definition at line 83 of file slufactor.h.

Referenced by SLUFactor::assign(), SLUFactor::clear(), SLUFactor::load(), and SLUFactor::setMarkowitz().

Timer::TYPE timerType
protected

Definition at line 90 of file slufactor.h.

Referenced by SLUFactor::operator=(), and SLUFactor::SLUFactor().

bool usetup
protected