Scippy

SoPlex

Sequential object-oriented simPlex

SLinSolver< R > Class Template Referenceabstract

Sparse Linear Solver virtual base class. More...

#include <slinsolver.h>

Public Types

Types
enum  Status {
  OK = 0 , INSTABLE = 1 , SINGULAR = 2 , UNLOADED = 4 ,
  ERROR = 8
}
 status flags of the SLinSolver class. More...
 

Public Member Functions

Miscellaneous
virtual const char * getName () const =0
 returns the name of the SLinSolver. More...
 
virtual Status status () const =0
 returns the Status of the SLinSolver. More...
 
virtual void clear ()=0
 unloads any matrix. More...
 
virtual int memory () const =0
 returns current memory consumption. More...
 
virtual int dim () const =0
 returns dimension of loaded matrix. More...
 
virtual Status load (const SVectorBase< R > *vec[], int dim)=0
 loads dim column vectors vec into the solver. More...
 
virtual R stability () const =0
 returns a stability number (0: singularity, 1: perfect stability). More...
 
virtual R matrixMetric (int type=0) const =0
 return estimate for the condition number based on the diagonal of U More...
 
virtual std::string statistics () const =0
 returns statistical information in form of a string. More...
 
virtual Status change (int idx, const SVectorBase< R > &subst, const SSVectorBase< R > *eta=0)=0
 Substitute column idx with subst. More...
 
virtual bool isConsistent () const =0
 consistency check. More...
 
virtual int getFactorCount () const =0
 get number of factorizations More...
 
Solving linear systems

For solving linear systems with an SLinSolver object, it must have previously been loaded with the matrix to use.

Two types of systems can be solved \(A x = b\) and \(x^T A = b^T\). Method names related to the first and second type are solveRight() and solveLeft(), respectively.

The methods receive their right hand-side vector \(b\) as a const parameter, that will hence be unchanged after termination.

Some methods are available with two parameters for right hand-side vectors. Then two system are solved in one method invocation. This should generally be faster than solving two systems seperately.

The result vector(s) are allways given as the first parameter(s). Two types of result vectors are supported, VectorBase<R> and SSVectorBase<R> .

virtual void solveRight (VectorBase< R > &x, const VectorBase< R > &b)=0
 Solves \(Ax=b\). More...
 
virtual void solveRight (SSVectorBase< R > &x, const SSVectorBase< R > &b)=0
 Solves \(Ax=b\). More...
 
virtual void solveRight (SSVectorBase< R > &x, const SVectorBase< R > &b)=0
 
virtual void solveRight4update (SSVectorBase< R > &x, const SVectorBase< R > &b)=0
 Solves \(Ax=b\). Possibly sets up internal data structures suitable for an optimized subsequent change() call with \(b\) as entering column. More...
 
virtual void solve2right4update (SSVectorBase< R > &x, VectorBase< R > &y, const SVectorBase< R > &b, SSVectorBase< R > &d)=0
 Solves \(Ax=b\) and \(Ay=d\). More...
 
virtual void solve2right4update (SSVectorBase< R > &x, SSVectorBase< R > &y, const SVectorBase< R > &b, SSVectorBase< R > &d)=0
 sparse version of solving two systems of equations More...
 
virtual void solve3right4update (SSVectorBase< R > &x, VectorBase< R > &y, VectorBase< R > &z, const SVectorBase< R > &b, SSVectorBase< R > &d, SSVectorBase< R > &e)=0
 Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More...
 
virtual void solve3right4update (SSVectorBase< R > &x, SSVectorBase< R > &y, SSVectorBase< R > &z, const SVectorBase< R > &b, SSVectorBase< R > &d, SSVectorBase< R > &e)=0
 sparse version of solving three systems of equations More...
 
virtual void solveLeft (VectorBase< R > &x, const VectorBase< R > &b)=0
 solves \(x^TA=b^T\). More...
 
virtual void solveLeft (SSVectorBase< R > &x, const SSVectorBase< R > &b)=0
 
virtual void solveLeft (SSVectorBase< R > &x, const SVectorBase< R > &b)=0
 sparse version of solving one system of equations with transposed basis matrix More...
 
virtual void solveLeft (SSVectorBase< R > &x, VectorBase< R > &two, const SVectorBase< R > &b, SSVectorBase< R > &rhs2)=0
 solves \(x^TA=b^T\) and \(x^TA=rhs2^T\) internally using \(rhs2\). More...
 
virtual void solveLeft (SSVectorBase< R > &x, SSVectorBase< R > &two, const SVectorBase< R > &b, SSVectorBase< R > &rhs2)=0
 sparse version of solving two systems of equations with transposed basis matrix More...
 
virtual void solveLeft (SSVectorBase< R > &x, VectorBase< R > &y, VectorBase< R > &z, const SVectorBase< R > &b, SSVectorBase< R > &d, SSVectorBase< R > &e)=0
 solves \(x^TA=b^T\), \(y^TA=d^T\) and \(z^TA=e^T\) More...
 
virtual void solveLeft (SSVectorBase< R > &x, SSVectorBase< R > &y, SSVectorBase< R > &z, const SVectorBase< R > &b, SSVectorBase< R > &d, SSVectorBase< R > &e)=0
 sparse version of solving three systems of equations with transposed basis matrix More...
 
Constructors / Destructors
 SLinSolver ()
 default constructor More...
 
virtual ~SLinSolver ()
 destructor More...
 
virtual SLinSolver< R > * clone () const =0
 clone function for polymorphism More...
 

Public Attributes

SPxOutspxout
 message handler More...
 

Detailed Description

template<class R>
class soplex::SLinSolver< R >

Sparse Linear Solver virtual base class.

Class SLinSolver provides a class for solving sparse linear systems with a matrix \(A\) and arbitrary right-hand side vectors. For doing so, the matrix must be first loaded to an SLinSolver object as an array of pointers to the column SVectors of this matrix.

Definition at line 52 of file slinsolver.h.

Member Enumeration Documentation

◆ Status

enum Status

status flags of the SLinSolver class.

Enumerator
OK 

The SLinSolver is ready for solving linear systems with the loaded matrix

INSTABLE 

The loaded matrix allows only for instable solutions to be computed

SINGULAR 

The loaded matrix is singular.

UNLOADED 

No matrix has yet been loaded.

ERROR 

An error has occurred.

Definition at line 60 of file slinsolver.h.

Constructor & Destructor Documentation

◆ SLinSolver()

default constructor

Definition at line 212 of file slinsolver.h.

◆ ~SLinSolver()

virtual ~SLinSolver ( )
virtual

destructor

Definition at line 216 of file slinsolver.h.

Member Function Documentation

◆ change()

virtual Status change ( int  idx,
const SVectorBase< R > &  subst,
const SSVectorBase< R > *  eta = 0 
)
pure virtual

Substitute column idx with subst.

The change method is used to modify the loaded matrix by substituting column idx with the new vector subst. One may also pass the optional parameter eta to the solution of solveRight() if readily availabble. This may improve on the performance of the update.

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ clear()

virtual void clear ( )
pure virtual

unloads any matrix.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ clone()

virtual SLinSolver< R > * clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ dim()

virtual int dim ( ) const
pure virtual

returns dimension of loaded matrix.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ getFactorCount()

virtual int getFactorCount ( ) const
pure virtual

get number of factorizations

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ getName()

virtual const char * getName ( ) const
pure virtual

returns the name of the SLinSolver.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ isConsistent()

virtual bool isConsistent ( ) const
pure virtual

consistency check.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ load()

virtual Status load ( const SVectorBase< R > *  vec[],
int  dim 
)
pure virtual

loads dim column vectors vec into the solver.

Initializes SLinSolver for the solution of linear systems with the matrix consisting of dim column vectors given in vec.

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ matrixMetric()

virtual R matrixMetric ( int  type = 0) const
pure virtual

return estimate for the condition number based on the diagonal of U

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ memory()

virtual int memory ( ) const
pure virtual

returns current memory consumption.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ solve2right4update() [1/2]

virtual void solve2right4update ( SSVectorBase< R > &  x,
SSVectorBase< R > &  y,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d 
)
pure virtual

sparse version of solving two systems of equations

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solve2right4update() [2/2]

virtual void solve2right4update ( SSVectorBase< R > &  x,
VectorBase< R > &  y,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d 
)
pure virtual

Solves \(Ax=b\) and \(Ay=d\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solve3right4update() [1/2]

virtual void solve3right4update ( SSVectorBase< R > &  x,
SSVectorBase< R > &  y,
SSVectorBase< R > &  z,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d,
SSVectorBase< R > &  e 
)
pure virtual

sparse version of solving three systems of equations

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solve3right4update() [2/2]

virtual void solve3right4update ( SSVectorBase< R > &  x,
VectorBase< R > &  y,
VectorBase< R > &  z,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d,
SSVectorBase< R > &  e 
)
pure virtual

Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [1/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
const SSVectorBase< R > &  b 
)
pure virtual

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [2/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
const SVectorBase< R > &  b 
)
pure virtual

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

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [3/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
SSVectorBase< R > &  two,
const SVectorBase< R > &  b,
SSVectorBase< R > &  rhs2 
)
pure virtual

sparse version of solving two systems of equations with transposed basis matrix

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [4/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
SSVectorBase< R > &  y,
SSVectorBase< R > &  z,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d,
SSVectorBase< R > &  e 
)
pure virtual

sparse version of solving three systems of equations with transposed basis matrix

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [5/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
VectorBase< R > &  two,
const SVectorBase< R > &  b,
SSVectorBase< R > &  rhs2 
)
pure virtual

solves \(x^TA=b^T\) and \(x^TA=rhs2^T\) internally using \(rhs2\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [6/7]

virtual void solveLeft ( SSVectorBase< R > &  x,
VectorBase< R > &  y,
VectorBase< R > &  z,
const SVectorBase< R > &  b,
SSVectorBase< R > &  d,
SSVectorBase< R > &  e 
)
pure virtual

solves \(x^TA=b^T\), \(y^TA=d^T\) and \(z^TA=e^T\)

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveLeft() [7/7]

virtual void solveLeft ( VectorBase< R > &  x,
const VectorBase< R > &  b 
)
pure virtual

solves \(x^TA=b^T\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveRight() [1/3]

virtual void solveRight ( SSVectorBase< R > &  x,
const SSVectorBase< R > &  b 
)
pure virtual

Solves \(Ax=b\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveRight() [2/3]

virtual void solveRight ( SSVectorBase< R > &  x,
const SVectorBase< R > &  b 
)
pure virtual

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveRight() [3/3]

virtual void solveRight ( VectorBase< R > &  x,
const VectorBase< R > &  b 
)
pure virtual

Solves \(Ax=b\).

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ solveRight4update()

virtual void solveRight4update ( SSVectorBase< R > &  x,
const SVectorBase< R > &  b 
)
pure virtual

Solves \(Ax=b\). Possibly sets up internal data structures suitable for an optimized subsequent change() call with \(b\) as entering column.

Implemented in SLUFactor< BP >, and SLUFactor< R >.

◆ stability()

virtual R stability ( ) const
pure virtual

returns a stability number (0: singularity, 1: perfect stability).

Returns a stability parameter between 0 and 1, where 0 indicates singularity, while 1 indicates perfect stability.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ statistics()

virtual std::string statistics ( ) const
pure virtual

returns statistical information in form of a string.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

◆ status()

virtual Status status ( ) const
pure virtual

returns the Status of the SLinSolver.

Implemented in SLUFactor< R >, and SLUFactor< BP >.

Member Data Documentation

◆ spxout

SPxOut* spxout

message handler

Definition at line 223 of file slinsolver.h.