Simplex basis.Consider the linear program as provided from class SPxLP:
\[ \begin{array}{rl} \hbox{max} & c^T x \\ \hbox{s.t.} & l_r \le Ax \le u_r \\ & l_c \le x \le u_c \end{array} \]
where \(c, l_c, u_c, x \in {\bf R}^n\), \(l_r, u_r \in {\bf R}^m\) and \(A \in {\bf R}^{m \times n}\). Solving this LP with the simplex algorithm requires the definition of a basis. Such can be defined as a set of column vectors or a set of row vectors building a non-singular matrix. We will refer to the first case as the columnwise representation and the latter case will be called the rowwise representation. In both cases, a basis is a set of vectors forming a non-singular matrix. The dimension of the vectors is referred to as the basis' dimension, whereas the number of vectors belonging to the LP is called the basis' codimension. More...
#include <spxbasis.h>
Classes | |
class | Desc |
Basis descriptor. More... | |
Public Types | |
enum | SPxStatus { NO_PROBLEM = -2, SINGULAR = -1, REGULAR = 0, DUAL = 1, PRIMAL = 2, OPTIMAL = 3, UNBOUNDED = 4, INFEASIBLE = 5 } |
basis status. More... | |
Public Member Functions | |
Status and Descriptor related Methods | |
SPxStatus | status () const |
returns current SPxStatus. More... | |
void | setStatus (SPxStatus stat) |
sets basis SPxStatus to stat . More... | |
void | setMaxUpdates (int maxUp) |
change maximum number of iterations until a refactorization is performed More... | |
int | getMaxUpdates () const |
returns maximum number of updates before a refactorization is performed More... | |
const Desc & | desc () const |
Desc & | desc () |
returns current basis Descriptor. More... | |
Desc::Status | dualColStatus (int i) const |
dual Status for the i'th column variable of the loaded LP. More... | |
Desc::Status | dualStatus (const SPxColId &id) const |
dual Status for the column variable with ID id of the loaded LP. More... | |
Desc::Status | dualRowStatus (int i) const |
dual Status for the i'th row variable of the loaded LP. More... | |
Desc::Status | dualStatus (const SPxRowId &id) const |
dual Status for the row variable with ID id of the loaded LP. More... | |
Desc::Status | dualStatus (const SPxId &id) const |
dual Status for the variable with ID id of the loaded LP. More... | |
Inquiry Methods | |
SPxId & | baseId (int i) |
SPxId | baseId (int i) const |
returns the Id of the i'th basis vector. More... | |
const SVector & | baseVec (int i) const |
returns the i'th basic vector. More... | |
SPxId | lastEntered () const |
returns SPxId of last vector included to the basis. More... | |
SPxId | lastLeft () const |
returns SPxId of last vector that left the basis. More... | |
int | lastIndex () const |
returns index in basis where last update was done. More... | |
int | lastUpdate () const |
returns number of basis changes since last refactorization. More... | |
int | iteration () const |
returns number of basis changes since last load(). More... | |
int | prevIteration () const |
returns the number of iterations prior to the last break in execution More... | |
int | lastDegenCheck () const |
returns the number of iterations since the last degeneracy check More... | |
SPxSolver * | solver () const |
returns loaded solver. More... | |
Linear Algebra | |
Vector & | multBaseWith (Vector &x) const |
Basis-vector product. More... | |
void | multBaseWith (SSVector &x, SSVector &result) const |
Basis-vector product. More... | |
Vector & | multWithBase (Vector &x) const |
Vector-basis product. More... | |
void | multWithBase (SSVector &x, SSVector &result) const |
Vector-basis product. More... | |
Real | condition (int maxiters=10, Real tolerance=1e-6) |
Real | getEstimatedCondition () |
Real | getExactCondition () |
Real | getFastCondition (int type=0) |
Real | stability () const |
returns the stability of the basis matrix. More... | |
void | solve (Vector &x, const Vector &rhs) |
void | solve (SSVector &x, const SVector &rhs) |
void | solve4update (SSVector &x, const SVector &rhs) |
solves linear system with basis matrix. More... | |
void | solve4update (SSVector &x, Vector &y, const SVector &rhsx, SSVector &rhsy) |
solves two systems in one call. More... | |
void | solve4update (SSVector &x, SSVector &y, const SVector &rhsx, SSVector &rhsy) |
solves two systems in one call using only sparse data structures More... | |
void | solve4update (SSVector &x, Vector &y, Vector &y2, const SVector &rhsx, SSVector &rhsy, SSVector &rhsy2) |
solves three systems in one call. More... | |
void | solve4update (SSVector &x, SSVector &y, SSVector &y2, const SVector &rhsx, SSVector &rhsy, SSVector &rhsy2) |
solves three systems in one call using only sparse data structures More... | |
void | coSolve (Vector &x, const Vector &rhs) |
Cosolves linear system with basis matrix. More... | |
void | coSolve (SSVector &x, const SVector &rhs) |
Sparse version of coSolve. More... | |
void | coSolve (SSVector &x, Vector &y, const SVector &rhsx, SSVector &rhsy) |
solves two systems in one call. More... | |
void | coSolve (SSVector &x, SSVector &y, const SVector &rhsx, SSVector &rhsy) |
Sparse version of solving two systems in one call. More... | |
void | coSolve (SSVector &x, Vector &y, Vector &z, const SVector &rhsx, SSVector &rhsy, SSVector &rhsz) |
solves three systems in one call. May be improved by using just one pass through the basis. More... | |
void | coSolve (SSVector &x, SSVector &y, SSVector &z, const SVector &rhsx, SSVector &rhsy, SSVector &rhsz) |
Sparse version of solving three systems in one call. More... | |
Modification notification. | |
These methods must be called after the loaded LP has been modified. | |
void | addedRows (int n) |
inform SPxBasis, that n new rows had been added. More... | |
void | removedRow (int i) |
inform SPxBasis that row i had been removed. More... | |
void | removedRows (const int perm[]) |
inform SPxBasis that rows in perm with negative entry were removed. More... | |
void | addedCols (int n) |
inform SPxBasis that n new columns had been added. More... | |
void | removedCol (int i) |
inform SPxBasis that column i had been removed. More... | |
void | removedCols (const int perm[]) |
inform SPxBasis that columns in perm with negative entry were removed. More... | |
void | changedRow (int) |
inform SPxBasis that a row had been changed. More... | |
void | changedCol (int) |
inform SPxBasis that a column had been changed. More... | |
void | changedElement (int, int) |
inform SPxBasis that a matrix entry had been changed. More... | |
Miscellaneous | |
virtual void | change (int i, SPxId &id, const SVector *enterVec, const SSVector *eta=0) |
performs basis update. More... | |
virtual bool | readBasis (std::istream &in, const NameSet *rowNames, const NameSet *colNames) |
virtual void | writeBasis (std::ostream &os, const NameSet *rownames, const NameSet *colnames, const bool cpxFormat=false) const |
virtual void | printMatrix () const |
void | printMatrixMTX (int number) |
virtual bool | isDescValid (const Desc &ds) |
checks if a Descriptor is valid for the current LP w.r.t. its bounds More... | |
virtual void | loadDesc (const Desc &) |
sets up basis. More... | |
virtual void | loadBasisSolver (SLinSolver *solver, const bool destroy=false) |
sets up linear solver to use. More... | |
virtual void | load (SPxSolver *lp, bool initSlackBasis=true) |
loads the LP lp to the basis. More... | |
virtual void | unLoad () |
unloads the LP from the basis. More... | |
void | invalidate () |
invalidates actual basis. More... | |
void | restoreInitialBasis () |
Restores initial basis. More... | |
void | dump () |
output basis entries. More... | |
bool | isConsistent () const |
consistency check. More... | |
Real | getTotalUpdateTime () const |
time spent in updates More... | |
int | getTotalUpdateCount () const |
number of updates performed More... | |
std::string | statistics () const |
returns statistical information in form of a string. More... | |
void | setOutstream (SPxOut &newOutstream) |
Constructors / Destructors | |
SPxBasis (Timer::TYPE ttype=Timer::USER_TIME) | |
default constructor. More... | |
SPxBasis (const SPxBasis &old) | |
copy constructor More... | |
SPxBasis & | operator= (const SPxBasis &rhs) |
assignment operator More... | |
virtual | ~SPxBasis () |
destructor. More... | |
Protected Member Functions | |
Protected helpers | |
void | loadMatrixVecs () |
loads matrix according to the SPxIds stored in theBaseId. More... | |
void | reDim () |
resizes internal arrays. More... | |
virtual void | factorize () |
factorizes the basis matrix. More... | |
void | setRep () |
sets descriptor representation according to loaded LP. More... | |
Protected Attributes | |
SPxSolver * | theLP |
the LP More... | |
DataArray< SPxId > | theBaseId |
SPxIds of basic vectors. More... | |
DataArray< const SVector *> | matrix |
pointers to the vectors of the basis matrix. More... | |
bool | matrixIsSetup |
true iff the pointers in matrix are set up correctly. More... | |
SLinSolver * | factor |
bool | factorized |
true iff factor = matrix \(^{-1}\). More... | |
int | maxUpdates |
number of updates before refactorization. More... | |
Real | nonzeroFactor |
allowed increase of nonzeros before refactorization. More... | |
Real | fillFactor |
allowed increase in relative fill before refactorization More... | |
Real | memFactor |
allowed total increase in memory consumption before refactorization More... | |
int | iterCount |
number of calls to change() since last manipulation More... | |
int | lastIterCount |
number of calls to change() before halting the simplex More... | |
int | iterDegenCheck |
number of calls to change() since last degeneracy check More... | |
int | updateCount |
number of calls to change() since last factorize() More... | |
int | totalUpdateCount |
number of updates More... | |
int | nzCount |
number of nonzeros in basis matrix More... | |
int | lastMem |
memory needed after last fresh factorization More... | |
Real | lastFill |
fill ratio that occured during last factorization More... | |
int | lastNzCount |
number of nonzeros in basis matrix after last fresh factorization More... | |
Timer * | theTime |
time spent in updates More... | |
Timer::TYPE | timerType |
type of timer (user or wallclock) More... | |
SPxId | lastin |
lastEntered(): variable entered the base last More... | |
SPxId | lastout |
lastLeft(): variable left the base last More... | |
int | lastidx |
lastIndex(): basis index where last update was done More... | |
Real | minStab |
minimum stability More... | |
Private Attributes | |
SPxStatus | thestatus |
current status of the basis. More... | |
Desc | thedesc |
the basis' Descriptor More... | |
bool | freeSlinSolver |
true iff factor should be freed inside of this object More... | |
SPxOut * | spxout |
message handler More... | |
Simplex basis.
Consider the linear program as provided from class SPxLP:
\[ \begin{array}{rl} \hbox{max} & c^T x \\ \hbox{s.t.} & l_r \le Ax \le u_r \\ & l_c \le x \le u_c \end{array} \]
where \(c, l_c, u_c, x \in {\bf R}^n\), \(l_r, u_r \in {\bf R}^m\) and \(A \in {\bf R}^{m \times n}\). Solving this LP with the simplex algorithm requires the definition of a basis. Such can be defined as a set of column vectors or a set of row vectors building a non-singular matrix. We will refer to the first case as the columnwise representation and the latter case will be called the rowwise representation. In both cases, a basis is a set of vectors forming a non-singular matrix. The dimension of the vectors is referred to as the basis' dimension, whereas the number of vectors belonging to the LP is called the basis' codimension.
Class SPxBasis is designed to represent a generic simplex basis, suitable for both representations. At any time the representation can be changed by calling method setRep().
Class SPxBasis provides methods for solving linear systems with the basis matrix. However, SPxBasis does not provide a linear solver by its own. Instead, a SLinSolver object must be loaded to a SPxBasis which will be called for solving linear systems.
Definition at line 82 of file spxbasis.h.
enum SPxStatus |
basis status.
Each SPxBasis is assigned a status flag, which can take on of the above values.
Definition at line 90 of file spxbasis.h.
SPxBasis | ( | Timer::TYPE | ttype = Timer::USER_TIME | ) |
default constructor.
Definition at line 1282 of file spxbasis.cpp.
References TimerFactory::createTimer(), SPxBasis::theTime, and SPxBasis::timerType.
copy constructor
Definition at line 1318 of file spxbasis.cpp.
References SLinSolver::clone(), SPxBasis::factor, SPxBasis::freeSlinSolver, and SPxBasis::isConsistent().
|
virtual |
destructor.
Definition at line 1355 of file spxbasis.cpp.
References SPxBasis::factor, SPxBasis::freeSlinSolver, soplex::spx_free(), and SPxBasis::theTime.
Referenced by SPxBasis::setOutstream().
void addedCols | ( | int | n | ) |
inform SPxBasis that n
new columns had been added.
Definition at line 262 of file spxchangebasis.cpp.
References SPxBasis::baseId(), SPxBasis::Desc::colStatus(), SPxSolver::COLUMN, SPxBasis::DUAL, SPxBasis::factorized, SPxBasis::INFEASIBLE, SPxBasis::loadMatrixVecs(), SPxBasis::matrixIsSetup, MSG_ERROR, SPxLPBase< R >::nCols(), SPxBasis::NO_PROBLEM, SPxBasis::OPTIMAL, SPxBasis::PRIMAL, soplex::primalColStatus(), SPxBasis::reDim(), SPxBasis::REGULAR, SPxSolver::rep(), SPxSolver::ROW, SPxBasis::setStatus(), SPxBasis::SINGULAR, SPxBasis::status(), SPxBasis::thedesc, SPxBasis::theLP, and SPxBasis::UNBOUNDED.
Referenced by SPxSolver::addedCols(), and SPxBasis::coSolve().
void addedRows | ( | int | n | ) |
inform SPxBasis, that n
new rows had been added.
Definition at line 59 of file spxchangebasis.cpp.
References SPxBasis::baseId(), SPxSolver::COLUMN, SPxBasis::DUAL, SPxBasis::dualRowStatus(), SPxBasis::factorized, SPxBasis::INFEASIBLE, SPxBasis::loadMatrixVecs(), SPxBasis::matrixIsSetup, MSG_ERROR, SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::OPTIMAL, SPxBasis::PRIMAL, SPxBasis::reDim(), SPxBasis::REGULAR, SPxSolver::rep(), SPxSolver::ROW, SPxBasis::Desc::rowStatus(), SPxBasis::setStatus(), SPxBasis::SINGULAR, SPxBasis::status(), SPxBasis::thedesc, SPxBasis::theLP, and SPxBasis::UNBOUNDED.
Referenced by SPxSolver::addedRows(), and SPxBasis::coSolve().
SPxId& baseId | ( | int | i | ) |
Definition at line 504 of file spxbasis.h.
Referenced by SoPlex::_getCompatibleColumns(), SoPlex::_getZeroDualMultiplierIndices(), SPxBasis::addedCols(), SPxBasis::addedRows(), SoPlex::checkBasisDualFeasibility(), SPxSolver::computeDualfarkas4Row(), SPxSolver::computeEnterCoPrhs(), SPxSolver::computeEnterCoPrhs4Col(), SPxSolver::computeEnterCoPrhs4Row(), SPxSolver::computeLeaveCoPrhs(), SPxSolver::computeLeaveCoPrhs4Col(), SPxSolver::computeLeaveCoPrhs4Row(), SPxWeightPR::computeLeavePenalty(), SPxSolver::computePrimalray4Col(), SPxSolver::enter(), SPxBoundFlippingRT::flipAndUpdate(), SoPlex::getBasisInd(), SoPlex::getBasisInverseColReal(), SoPlex::getBasisInverseRowReal(), SoPlex::getBasisInverseTimesVecReal(), SPxBoundFlippingRT::getData(), SPxSolver::getDual(), SPxSolver::getEnterVals2(), SPxSolver::getLeaveVals(), SPxSolver::getPrimal(), SPxSolver::getRedCost(), SPxSolver::getSlacks(), SPxSolver::leave(), SPxBasis::loadMatrixVecs(), SPxFastRT::maxReLeave(), SPxFastRT::minReLeave(), SoPlex::multBasis(), SoPlex::multBasisTranspose(), SPxSolver::performSolutionPolishing(), SPxSolver::perturbMax(), SPxSolver::perturbMin(), SPxBasis::removedCol(), SPxBasis::removedRow(), SPxBasis::restoreInitialBasis(), SPxFastRT::selectLeave(), SPxBoundFlippingRT::selectLeave(), SPxSolver::setDual(), SPxSolver::setEnterBound4Col(), SPxSolver::setEnterBound4Row(), SPxSolver::setEnterBounds(), SPxSolver::setLeaveBound4Col(), SPxSolver::setLeaveBound4Row(), SPxSolver::setLeaveBounds(), SPxSolver::setPrimal(), SPxSolver::setRedCost(), SPxSolver::setSlacks(), SPxSolver::solve(), and SPxSolver::unShift().
SPxId baseId | ( | int | i | ) | const |
returns the Id of the i'th
basis vector.
Definition at line 509 of file spxbasis.h.
const SVector& baseVec | ( | int | i | ) | const |
returns the i'th
basic vector.
Definition at line 515 of file spxbasis.h.
Referenced by SPxSolver::enter(), SPxSolver::leave(), and SPxBasis::printMatrixMTX().
performs basis update.
Changes the i
'th vector of the basis with the vector associated to id
. This includes:
The basis descriptor is not modified, since factor() cannot know about how to set up the status of the involved variables correctly.
A vector enterVec
may be passed for a fast ETA update of the LU factorization associated to the basis. It must be initialized with the solution vector \(x\) of the right linear system \(Bx = b\) with the entering vector as right-hand side vector \(b\), where \(B\) denotes the basis matrix. This can be computed using method solve(). When using FAST updates, a vector eta
may be passed for improved performance. It must be initialized by a call to factor->solveRightUpdate() as described in SLinSolver. The implementation hidden behind FAST updates depends on the SLinSolver implementation class.
Definition at line 773 of file spxbasis.cpp.
References SLinSolver::change(), SLinSolver::dim(), SPxBasis::factor, SPxBasis::factorize(), SPxBasis::factorized, SPxBasis::iteration(), SPxBasis::iterCount, SPxBasis::lastFill, SPxBasis::lastidx, SPxBasis::lastin, SPxBasis::lastMem, SPxBasis::lastNzCount, SPxBasis::lastout, SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxBasis::maxUpdates, SPxBasis::memFactor, SLinSolver::memory(), SPxBasis::minStab, MSG_DEBUG, MSG_INFO3, SPxBasis::nonzeroFactor, SPxBasis::nzCount, SLinSolver::OK, SPxBasis::REGULAR, SVectorBase< R >::size(), SPxBasis::spxout, SLinSolver::stability(), Timer::start(), SLinSolver::status(), SPxBasis::status(), Timer::stop(), SPxBasis::theBaseId, SPxBasis::theLP, SPxBasis::theTime, SPxSolver::time(), SPxBasis::totalUpdateCount, and SPxBasis::updateCount.
Referenced by SPxBasis::coSolve(), SPxSolver::enter(), and SPxSolver::leave().
void changedCol | ( | int | ) |
inform SPxBasis that a column had been changed.
Definition at line 490 of file spxchangebasis.cpp.
References SPxBasis::invalidate(), and SPxBasis::restoreInitialBasis().
Referenced by SPxSolver::changeCol(), and SPxBasis::coSolve().
void changedElement | ( | int | , |
int | |||
) |
inform SPxBasis that a matrix entry had been changed.
Definition at line 498 of file spxchangebasis.cpp.
References SPxBasis::invalidate(), and SPxBasis::restoreInitialBasis().
Referenced by SPxSolver::changeElement(), and SPxBasis::coSolve().
void changedRow | ( | int | ) |
inform SPxBasis that a row had been changed.
The following methods (changedRow(), changedCol(), changedElement()) radically change the current basis to the original (slack) basis also present after loading the LP. The reason is that through the changes, the current basis may become singular. Going back to the initial basis is quite inefficient, but correct.
Definition at line 482 of file spxchangebasis.cpp.
References SPxBasis::invalidate(), and SPxBasis::restoreInitialBasis().
Referenced by SPxSolver::changeRow(), and SPxBasis::coSolve().
Definition at line 1081 of file spxbasis.cpp.
References SSVectorBase< R >::add(), SSVectorBase< R >::clear(), SPxBasis::factor, SPxBasis::factorize(), SPxBasis::factorized, SSVectorBase< R >::length(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::REGULAR, SSVectorBase< R >::setup(), SLinSolver::solveLeft(), SLinSolver::solveRight(), soplex::spxAbs(), SPxBasis::status(), and SPxBasis::thedesc.
Referenced by SPxBasis::getEstimatedCondition(), SPxBasis::getExactCondition(), and SPxBasis::solver().
Cosolves linear system with basis matrix.
Depending on the representation, for a SPxBasis B, B.coSolve(x) computes
Both can be seen uniformly as solving a linear system with the basis matrix B
and a right handside vector x
aligned the same way as the covectors of B
.
Definition at line 730 of file spxbasis.h.
References VectorBase< R >::clear(), VectorBase< R >::dim(), SPxBasis::factorize(), and SLinSolver::solveLeft().
Referenced by SoPlex::_checkOriginalProblemOptimality(), SPxSolver::enter(), SPxSolver::factorize(), SoPlex::getBasisInverseColReal(), SoPlex::getBasisInverseRowReal(), SoPlex::getBasisInverseTimesVecReal(), SPxSolver::init(), SPxSteepPR::isConsistent(), SPxSolver::leave(), SPxSolver::reinitializeVecs(), SPxSteepPR::selectLeave(), SPxSteepPR::setupWeights(), SPxSolver::solve(), SPxSolver::terminate(), and SPxSolver::testVecs().
Sparse version of coSolve.
Definition at line 744 of file spxbasis.h.
References SSVectorBase< R >::clear(), SPxBasis::factorize(), SVectorBase< R >::size(), and SLinSolver::solveLeft().
solves two systems in one call.
Definition at line 758 of file spxbasis.h.
References SPxBasis::factorize(), and SLinSolver::solveLeft().
Sparse version of solving two systems in one call.
Definition at line 766 of file spxbasis.h.
References SPxBasis::factorize(), and SLinSolver::solveLeft().
void coSolve | ( | SSVector & | x, |
Vector & | y, | ||
Vector & | z, | ||
const SVector & | rhsx, | ||
SSVector & | rhsy, | ||
SSVector & | rhsz | ||
) |
solves three systems in one call. May be improved by using just one pass through the basis.
Definition at line 774 of file spxbasis.h.
References SPxBasis::factorize(), and SLinSolver::solveLeft().
void coSolve | ( | SSVector & | x, |
SSVector & | y, | ||
SSVector & | z, | ||
const SVector & | rhsx, | ||
SSVector & | rhsy, | ||
SSVector & | rhsz | ||
) |
Sparse version of solving three systems in one call.
Definition at line 782 of file spxbasis.h.
References SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::change(), SPxBasis::changedCol(), SPxBasis::changedElement(), SPxBasis::changedRow(), SPxBasis::factorize(), SPxBasis::isDescValid(), SPxBasis::load(), SPxBasis::loadBasisSolver(), SPxBasis::loadDesc(), SPxBasis::printMatrix(), SPxBasis::printMatrixMTX(), SPxBasis::readBasis(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SLinSolver::solveLeft(), SPxBasis::solver(), and SPxBasis::writeBasis().
const Desc& desc | ( | ) | const |
Definition at line 464 of file spxbasis.h.
References SPxBasis::thedesc.
Referenced by SoPlex::_identifyComplementaryDualFixedPrimalVars(), SoPlex::_identifyComplementaryPrimalFixedPrimalVars(), SoPlex::_performOptIRStable(), SoPlex::_updateDecompComplementaryDualProblem(), SoPlex::_updateDecompComplementaryPrimalProblem(), SPxSolver::changeLhsStatus(), SPxSolver::changeLowerStatus(), SPxSolver::changeRhsStatus(), SPxSolver::changeUpperStatus(), SoPlex::checkBasisDualFeasibility(), SPxSolver::computeCoTest(), SPxSolver::computeEnterCoPrhs4Col(), SPxSolver::computeEnterCoPrhs4Row(), SPxSolver::computeFrhs(), SPxSolver::computeFrhs1(), SPxSolver::computeFrhs2(), SPxSolver::computeFrhsXtra(), SPxSolver::computeLeaveCoPrhs4Col(), SPxSolver::computeLeaveCoPrhs4Row(), SPxSolver::computeTest(), SPxSolver::enter(), SPxBoundFlippingRT::flipAndUpdate(), SPxSolver::getBasis(), SPxSolver::getBasisColStatus(), SPxSolver::getBasisRowStatus(), SPxSolver::getDual(), SPxSolver::getEnterVals(), SPxSolver::getEnterVals2(), SoPlex::getExpectedDualVariableSign(), SPxSolver::getLeaveVals(), SPxSolver::getLeaveVals2(), SoPlex::getOriginalProblemBasisColStatus(), SoPlex::getOriginalProblemBasisRowStatus(), SoPlex::getOrigVarFixedDirection(), SPxSolver::getPrimal(), SPxSolver::getRedCost(), SPxSolver::getSlacks(), SPxSolver::init(), SPxSolver::initRep(), SPxSolver::leave(), SPxSolver::nonbasicValue(), SPxSolver::performSolutionPolishing(), SPxSolver::perturbMaxLeave(), SPxSolver::perturbMinLeave(), SPxSolver::rejectEnter(), SPxSolver::rejectLeave(), SPxWeightPR::selectEnter(), SPxFastRT::selectLeave(), SPxSolver::setBasis(), SPxSolver::setDualColBounds(), SPxSolver::setEnterBound4Col(), SPxSolver::setEnterBound4Row(), SPxSolver::setLeaveBound4Col(), SPxSolver::setLeaveBound4Row(), SPxSolver::solve(), SPxSolver::ungetEnterVal(), SPxSolver::unShift(), SPxSolver::updateCoTest(), and SPxSolver::updateTest().
Desc& desc | ( | ) |
returns current basis Descriptor.
Definition at line 469 of file spxbasis.h.
References SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), SPxBasis::dualStatus(), and SPxBasis::thedesc.
SPxBasis::Desc::Status dualColStatus | ( | int | i | ) | const |
dual Status for the i'th
column variable of the loaded LP.
Definition at line 69 of file spxbasis.cpp.
References SPxBasis::Desc::D_FREE, SPxBasis::Desc::D_ON_BOTH, SPxBasis::Desc::D_ON_LOWER, SPxBasis::Desc::D_ON_UPPER, SPxBasis::Desc::D_UNDEFINED, soplex::infinity, and SPxBasis::theLP.
Referenced by SPxSolver::changeLowerStatus(), SPxSolver::changeUpperStatus(), SPxBasis::desc(), SPxBasis::dualStatus(), SPxSolver::getEnterVals2(), SPxSolver::getLeaveVals(), SPxSolver::getLeaveVals2(), SPxBasis::isConsistent(), SPxBasis::isDescValid(), SPxBasis::loadDesc(), SPxBasis::readBasis(), SPxSolver::setDualRowBounds(), soplex::setDualStatus(), and SPxSolver::varStatusToBasisStatusCol().
SPxBasis::Desc::Status dualRowStatus | ( | int | i | ) | const |
dual Status for the i'th
row variable of the loaded LP.
Definition at line 46 of file spxbasis.cpp.
References SPxBasis::Desc::D_FREE, SPxBasis::Desc::D_ON_BOTH, SPxBasis::Desc::D_ON_LOWER, SPxBasis::Desc::D_ON_UPPER, SPxBasis::Desc::D_UNDEFINED, soplex::infinity, SPxLPBase< R >::lhs(), SPxLPBase< R >::rhs(), and SPxBasis::theLP.
Referenced by SPxBasis::addedRows(), SPxSolver::changeLhsStatus(), SPxSolver::changeRhsStatus(), SPxBasis::desc(), SPxBasis::dualStatus(), SPxSolver::getEnterVals2(), SPxSolver::getLeaveVals(), SPxSolver::getLeaveVals2(), SPxBasis::isConsistent(), SPxBasis::isDescValid(), SPxBasis::loadDesc(), SPxBasis::readBasis(), SPxBasis::restoreInitialBasis(), SPxSolver::setDualRowBounds(), soplex::setDualStatus(), and SPxSolver::varStatusToBasisStatusRow().
SPxBasis::Desc::Status dualStatus | ( | const SPxColId & | id | ) | const |
dual Status for the column variable with ID id
of the loaded LP.
Definition at line 34 of file spxbasis.cpp.
References SPxBasis::dualColStatus(), and SPxBasis::theLP.
Referenced by SPxBasis::desc(), SPxBasis::dualStatus(), SPxBoundFlippingRT::getData(), SPxFastRT::maxReLeave(), SPxFastRT::minReLeave(), SPxSolver::perturbMax(), and SPxSolver::perturbMin().
SPxBasis::Desc::Status dualStatus | ( | const SPxRowId & | id | ) | const |
dual Status for the row variable with ID id
of the loaded LP.
Definition at line 40 of file spxbasis.cpp.
References SPxBasis::dualRowStatus(), and SPxBasis::theLP.
Desc::Status dualStatus | ( | const SPxId & | id | ) | const |
dual Status for the variable with ID id
of the loaded LP.
It is automatically detected, whether the id
is one of a row or a column variable, and the correct row or column status is returned.
Definition at line 491 of file spxbasis.h.
References SPxBasis::dualStatus().
void dump | ( | ) |
output basis entries.
Definition at line 1185 of file spxbasis.cpp.
References SPxBasis::Desc::colStatus(), SPxSolver::dim(), SPxSolver::isBasic(), SPxBasis::matrix, SPxLPBase< R >::nCols(), SPxBasis::Desc::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::Desc::nRows(), SPxLPBase< R >::number(), SPxBasis::Desc::rowStatus(), SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
|
protectedvirtual |
factorizes the basis matrix.
Reimplemented in SPxSolver.
Definition at line 928 of file spxbasis.cpp.
References SPxBasis::factor, SPxBasis::factorized, SPxBasis::fillFactor, SPxBasis::lastFill, SPxBasis::lastMem, SPxBasis::lastNzCount, SLinSolver::load(), SPxBasis::loadDesc(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SLinSolver::memory(), SPxBasis::minStab, MSG_ERROR, SPxBasis::nonzeroFactor, SPxBasis::nzCount, SLinSolver::OK, SPxBasis::REGULAR, SPxBasis::setStatus(), SLinSolver::SINGULAR, SPxBasis::SINGULAR, SLinSolver::stability(), SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::updateCount.
Referenced by SPxBasis::change(), SPxBasis::condition(), SPxBasis::coSolve(), SPxSolver::factorize(), SPxSolver::init(), SPxBasis::setOutstream(), SPxBasis::solve(), and SPxBasis::solve4update().
Real getEstimatedCondition | ( | ) |
Definition at line 608 of file spxbasis.h.
References SPxBasis::condition().
Referenced by SoPlex::getEstimatedCondition(), and SPxSolver::printDisplayLine().
Real getExactCondition | ( | ) |
Definition at line 614 of file spxbasis.h.
References SPxBasis::condition(), and SPxBasis::getFastCondition().
Referenced by SoPlex::getExactCondition().
Real getFastCondition | ( | int | type = 0 | ) |
Definition at line 1175 of file spxbasis.cpp.
References SLinSolver::conditionEstimate(), SPxBasis::factor, SPxBasis::factorized, and soplex::infinity.
Referenced by SPxBasis::getExactCondition(), SoPlex::getFastCondition(), and SPxSolver::printDisplayLine().
int getMaxUpdates | ( | ) | const |
returns maximum number of updates before a refactorization is performed
Definition at line 458 of file spxbasis.h.
References SPxBasis::maxUpdates.
Referenced by SPxSolver::writeState().
int getTotalUpdateCount | ( | ) | const |
number of updates performed
Definition at line 924 of file spxbasis.h.
References SPxBasis::totalUpdateCount.
Referenced by SPxBasis::statistics().
Real getTotalUpdateTime | ( | ) | const |
time spent in updates
Definition at line 919 of file spxbasis.h.
References Timer::time().
Referenced by SPxBasis::statistics().
void invalidate | ( | ) |
invalidates actual basis.
This method makes the basis matrix and vectors invalid. The basis will be reinitialized if needed.
mark the basis as not factorized
Definition at line 413 of file spxchangebasis.cpp.
References SPxBasis::factorized, SPxBasis::matrixIsSetup, MSG_INFO3, and SPxBasis::spxout.
Referenced by SPxBasis::changedCol(), SPxBasis::changedElement(), SPxBasis::changedRow(), SPxBasis::setStatus(), SPxBasis::unLoad(), and SPxSolver::unscaleLPandReloadBasis().
bool isConsistent | ( | ) | const |
consistency check.
Definition at line 1232 of file spxbasis.cpp.
References SPxBasis::Desc::colStatus(), SPxSolver::dim(), SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), SPxBasis::factor, SLinSolver::isConsistent(), SPxBasis::Desc::isConsistent(), SPxBasis::matrix, MSGinconsistent, SPxLPBase< R >::nCols(), SPxBasis::Desc::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::Desc::nRows(), SPxBasis::Desc::rowStatus(), SPxBasis::status(), SPxBasis::theBaseId, SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxSolver::isConsistent(), SPxBasis::operator=(), and SPxBasis::SPxBasis().
|
virtual |
checks if a Descriptor is valid for the current LP w.r.t. its bounds
Definition at line 115 of file spxbasis.cpp.
References SPxBasis::Desc::colstat, SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), soplex::infinity, MSG_DEBUG, SPxLPBase< R >::nCols(), SPxBasis::Desc::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::Desc::nRows(), SPxBasis::Desc::P_FIXED, SPxBasis::Desc::P_ON_LOWER, SPxBasis::Desc::P_ON_UPPER, SPxBasis::Desc::rowstat, SPxBasis::status(), and SPxBasis::theLP.
Referenced by SPxBasis::coSolve(), and SPxBasis::loadDesc().
int iteration | ( | ) | const |
returns number of basis changes since last load().
Definition at line 546 of file spxbasis.h.
References SPxBasis::iterCount.
Referenced by SPxBasis::change(), SPxSteepPR::entered4(), SPxSolver::factorize(), SPxSolver::leave(), SPxSteepPR::left4(), SPxSolver::perturbMaxEnter(), SPxSolver::perturbMaxLeave(), SPxSolver::perturbMinEnter(), SPxSolver::perturbMinLeave(), SPxSolver::printDisplayLine(), SPxFastRT::selectEnter(), SPxBoundFlippingRT::selectEnter(), SPxFastRT::selectLeave(), SPxBoundFlippingRT::selectLeave(), SPxSolver::solve(), SPxSolver::terminate(), SPxSolver::testVecs(), and SPxSolver::updateNonbasicValue().
int lastDegenCheck | ( | ) | const |
returns the number of iterations since the last degeneracy check
Definition at line 558 of file spxbasis.h.
References SPxBasis::iterDegenCheck.
Referenced by SPxSolver::terminate().
SPxId lastEntered | ( | ) | const |
returns SPxId of last vector included to the basis.
Definition at line 522 of file spxbasis.h.
References SPxBasis::lastin.
Referenced by SPxSolver::solve().
int lastIndex | ( | ) | const |
returns index in basis where last update was done.
Definition at line 534 of file spxbasis.h.
References SPxBasis::lastidx.
Referenced by SPxSolver::solve().
SPxId lastLeft | ( | ) | const |
returns SPxId of last vector that left the basis.
Definition at line 528 of file spxbasis.h.
References SPxBasis::lastout.
Referenced by SPxSolver::solve().
int lastUpdate | ( | ) | const |
returns number of basis changes since last refactorization.
Definition at line 540 of file spxbasis.h.
References SPxBasis::updateCount.
Referenced by SPxSolver::enter(), SPxSolver::leave(), SPxDevexPR::selectEnterX(), SPxSteepPR::selectEnterX(), SPxDevexPR::selectLeave(), SPxSteepPR::selectLeave(), and SPxSolver::solve().
|
virtual |
loads the LP lp
to the basis.
This involves resetting all counters to 0 and setting up a regular default basis consisting of slacks, artificial variables or bounds.
Definition at line 345 of file spxbasis.cpp.
References SPxBasis::loadDesc(), SPxBasis::restoreInitialBasis(), SPxBasis::setOutstream(), SPxBasis::setRep(), SPxSolver::spxout, SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::coSolve(), SPxSolver::init(), SPxSolver::loadBasis(), SPxSolver::loadLP(), SPxBasis::readBasis(), SPxSolver::setBasis(), and SPxSolver::solve().
|
virtual |
sets up linear solver to use.
If destroy is true, solver will be freed inside this object, e.g. in the destructor.
Definition at line 361 of file spxbasis.cpp.
References SLinSolver::clear(), SPxBasis::factor, SPxBasis::factorized, SPxBasis::freeSlinSolver, MSG_INFO3, SPxBasis::setOutstream(), SLinSolver::spxout, and SPxBasis::spxout.
Referenced by SPxBasis::coSolve(), and SPxSolver::setBasisSolver().
|
virtual |
sets up basis.
Loads a Descriptor to the basis and sets up the basis matrix and all vectors accordingly. The Descriptor must have the same number of rows and columns as the currently loaded LP.
Definition at line 201 of file spxbasis.cpp.
References SLinSolver::clear(), SPxBasis::Desc::colStatus(), SPxSolver::dim(), SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), SPxBasis::factor, SPxBasis::factorized, soplex::infinity, SPxSolver::isBasic(), SPxBasis::isDescValid(), SPxBasis::iterCount, SPxBasis::lastidx, SPxBasis::lastin, SPxBasis::lastout, SPxBasis::matrix, SPxBasis::matrixIsSetup, MSG_INFO3, SPxLPBase< R >::nCols(), SPxBasis::Desc::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::Desc::nRows(), SPxBasis::nzCount, SPxBasis::Desc::P_FIXED, SPxBasis::Desc::P_FREE, SPxBasis::Desc::P_ON_LOWER, SPxBasis::Desc::P_ON_UPPER, SPxBasis::restoreInitialBasis(), SPxBasis::Desc::rowStatus(), SPxBasis::setRep(), SPxBasis::spxout, SPxBasis::status(), SPxBasis::theBaseId, SPxBasis::thedesc, SPxBasis::theLP, SPxBasis::updateCount, and SPxSolver::vector().
Referenced by SPxBasis::coSolve(), SPxBasis::factorize(), SPxSolver::init(), SPxSolver::initRep(), SPxBasis::load(), SPxSolver::loadBasis(), and SPxBasis::readBasis().
|
protected |
loads matrix according to the SPxIds stored in theBaseId.
This method must be called whenever there is a chance, that the vector pointers may have changed due to manipulations of the LP.
Definition at line 91 of file spxbasis.cpp.
References SPxBasis::baseId(), SLinSolver::clear(), SPxSolver::dim(), SPxBasis::factor, SPxBasis::factorized, SPxBasis::matrix, SPxBasis::matrixIsSetup, MSG_INFO3, SPxBasis::nzCount, SPxBasis::spxout, SPxBasis::theLP, and SPxSolver::vector().
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::restoreInitialBasis(), and SPxBasis::setOutstream().
Basis-vector product.
Depending on the representation, for an SPxBasis B, B.multBaseWith(x) computes
Both can be seen uniformly as multiplying the basis matrix B
with a vector x
aligned the same way as the vectors of B
.
Definition at line 1023 of file spxbasis.cpp.
References VectorBase< R >::clear(), VectorBase< R >::dim(), SPxSolver::dim(), SPxBasis::matrix, SPxBasis::matrixIsSetup, VectorBase< R >::multAdd(), SPxBasis::SINGULAR, SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::condition(), SPxSolver::enter(), SPxSolver::factorize(), SPxSolver::leave(), SoPlex::multBasis(), SPxBasis::solver(), and SPxSolver::testVecs().
Basis-vector product.
Definition at line 1047 of file spxbasis.cpp.
References SSVectorBase< R >::clear(), SSVectorBase< R >::dim(), SPxSolver::dim(), SSVectorBase< R >::index(), SSVectorBase< R >::isSetup(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SSVectorBase< R >::multAdd(), SPxBasis::SINGULAR, SSVectorBase< R >::size(), SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Vector-basis product.
Depending on the representation, for a SPxBasis B, B.multWithBase(x) computes
Both can be seen uniformly as multiplying the basis matrix B
with a vector x
aligned the same way as the covectors of B
.
Definition at line 984 of file spxbasis.cpp.
References VectorBase< R >::dim(), SPxSolver::dim(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxBasis::SINGULAR, SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::condition(), SPxSolver::factorize(), SoPlex::multBasisTranspose(), SPxBasis::solver(), and SPxSolver::testVecs().
Vector-basis product.
Definition at line 1003 of file spxbasis.cpp.
References SSVectorBase< R >::add(), SSVectorBase< R >::clear(), SSVectorBase< R >::dim(), SPxSolver::dim(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxBasis::SINGULAR, SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
assignment operator
Definition at line 1373 of file spxbasis.cpp.
References SLinSolver::clone(), SPxBasis::factor, SPxBasis::factorized, SPxBasis::fillFactor, SPxBasis::freeSlinSolver, SPxBasis::isConsistent(), SPxBasis::iterCount, SPxBasis::lastFill, SPxBasis::lastidx, SPxBasis::lastin, SPxBasis::lastNzCount, SPxBasis::lastout, SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxBasis::maxUpdates, SPxBasis::memFactor, SPxBasis::minStab, SPxBasis::nonzeroFactor, SPxBasis::nzCount, SPxBasis::theBaseId, SPxBasis::thedesc, SPxBasis::theLP, and SPxBasis::thestatus.
Referenced by SPxSolver::operator=().
int prevIteration | ( | ) | const |
returns the number of iterations prior to the last break in execution
Definition at line 552 of file spxbasis.h.
References SPxBasis::lastIterCount.
Referenced by SPxSolver::terminate().
|
virtual |
Definition at line 729 of file spxbasis.cpp.
References SPxBasis::matrix, and SPxBasis::matrixIsSetup.
Referenced by SPxBasis::coSolve().
void printMatrixMTX | ( | int | number | ) |
Prints current basis matrix to a file using the MatrixMarket format: row col value The filename is basis/basis[number].mtx where number is a parameter.
Definition at line 740 of file spxbasis.cpp.
References SPxBasis::baseVec(), SVectorBase< R >::index(), SPxBasis::matrix, SPxBasis::nzCount, REAL_FORMAT, SVectorBase< R >::size(), SPX_MAXSTRLEN, soplex::spxSnprintf(), and SVectorBase< R >::value().
Referenced by SPxBasis::coSolve().
Load basis from in
in MPS format. If rowNames
and colNames
are NULL
, default names are used for the constraints and variables.
The specification is taken from the
ILOG CPLEX 7.0 Reference Manual, Appendix E, Page 543.
This routine should read valid BAS format files.
Here is a very brief outline of the format:
The format is in a form similar to an MPS file. The basic assumption is that all (column) variables are nonbasic at their lower bound and all row (variables) are basic; only the differences to this rule are given. Each data line contains an indicator, a variable name and possibly a row/constraint name. The following meaning applies with respect to the indicators:
The CPLEX format contains an additional indicator 'BS', but this is unsupported here.
Nonbasic variables without lower bound have the following default status for SoPlex:
Definition at line 412 of file spxbasis.cpp.
References NameSet::add(), SPxSolver::colId(), SPxBasis::Desc::colstat, SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), SPxBasis::Desc::dump(), MPSInput::ENDATA, LPRowBase< R >::EQUAL, MPSInput::field0(), MPSInput::field1(), MPSInput::field2(), MPSInput::field3(), LPRowBase< R >::GREATER_EQUAL, MPSInput::hasError(), soplex::infinity, LPRowBase< R >::LESS_EQUAL, SPxBasis::load(), SPxBasis::loadDesc(), MSG_DEBUG, SPxLPBase< R >::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), NameSet::number(), SPxBasis::Desc::P_FIXED, SPxBasis::Desc::P_FREE, SPxBasis::Desc::P_ON_LOWER, SPxBasis::Desc::P_ON_UPPER, MPSInput::readLine(), SPxBasis::REGULAR, NameSet::reMax(), SPxSolver::rowId(), SPxBasis::Desc::rowstat, MPSInput::section(), MPSInput::setSection(), SPxBasis::setStatus(), soplex::spx_alloc(), soplex::spx_free(), SPxBasis::status(), MPSInput::syntaxError(), SPxBasis::thedesc, SPxBasis::theLP, and NameSet::~NameSet().
Referenced by SPxBasis::coSolve(), and SPxSolver::readBasisFile().
|
protected |
resizes internal arrays.
When a new LP is loaded, the basis matrix and vectors become invalid and possibly also of the wrong dimension. Hence, after loading an LP, reDim() is called to reset all arrays etc. accoriding to the dimensions of the loaded LP.
Definition at line 26 of file spxchangebasis.cpp.
References SPxSolver::dim(), SPxBasis::factorized, SPxBasis::matrix, SPxBasis::matrixIsSetup, MSG_DEBUG, MSG_INFO3, SPxLPBase< R >::nCols(), SPxLPBase< R >::nRows(), SPxBasis::Desc::reSize(), SPxBasis::spxout, SPxBasis::theBaseId, SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxSolver::clear(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::setOutstream(), and SPxBasis::setRep().
void removedCol | ( | int | i | ) |
inform SPxBasis that column i
had been removed.
Definition at line 324 of file spxchangebasis.cpp.
References SPxBasis::baseId(), SPxBasis::Desc::colStatus(), SPxSolver::COLUMN, SPxSolver::dim(), SPxBasis::factorized, SPxLPBase< R >::has(), SPxSolver::isBasic(), SPxBasis::matrix, SPxBasis::matrixIsSetup, SPxLPBase< R >::nCols(), SPxBasis::NO_PROBLEM, SPxBasis::reDim(), SPxSolver::rep(), SPxSolver::ROW, SPxBasis::setStatus(), SPxBasis::status(), SPxBasis::thedesc, SPxBasis::theLP, and SPxSolver::vector().
Referenced by SPxBasis::coSolve(), and SPxSolver::doRemoveCol().
void removedCols | ( | const int | perm[] | ) |
inform SPxBasis that columns in perm
with negative entry were removed.
Definition at line 365 of file spxchangebasis.cpp.
References SPxBasis::Desc::colStatus(), SPxSolver::COLUMN, SPxBasis::factorized, SPxSolver::isBasic(), SPxBasis::matrixIsSetup, SPxBasis::Desc::nCols(), SPxBasis::NO_PROBLEM, SPxBasis::reDim(), SPxSolver::rep(), SPxSolver::ROW, SPxBasis::setStatus(), SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::coSolve(), and SPxSolver::doRemoveCols().
void removedRow | ( | int | i | ) |
inform SPxBasis that row i
had been removed.
Definition at line 122 of file spxchangebasis.cpp.
References SPxBasis::baseId(), SPxSolver::COLUMN, SPxSolver::dim(), SPxBasis::factorized, SPxLPBase< R >::has(), SPxSolver::isBasic(), SPxBasis::matrix, SPxBasis::matrixIsSetup, MSG_DEBUG, SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::reDim(), SPxSolver::rep(), SPxSolver::ROW, SPxBasis::Desc::rowStatus(), SPxBasis::setStatus(), SPxBasis::status(), SPxBasis::thedesc, SPxBasis::theLP, and SPxSolver::vector().
Referenced by SPxBasis::coSolve(), and SPxSolver::doRemoveRow().
void removedRows | ( | const int | perm[] | ) |
inform SPxBasis that rows in perm
with negative entry were removed.
Definition at line 171 of file spxchangebasis.cpp.
References SPxSolver::COLUMN, SPxBasis::factorized, SPxSolver::isBasic(), SPxBasis::matrixIsSetup, MSG_DEBUG, SPxBasis::NO_PROBLEM, SPxBasis::Desc::nRows(), SPxBasis::reDim(), SPxSolver::rep(), SPxSolver::ROW, SPxBasis::Desc::rowStatus(), SPxBasis::setStatus(), SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::coSolve(), and SPxSolver::doRemoveRows().
void restoreInitialBasis | ( | ) |
Restores initial basis.
This method changes the basis to that present just after loading the LP (see addedRows() and addedCols()). This may be necessary if a row or a column is changed, since then the current basis may become singular.
Create the initial slack basis descriptor and set up the basis matrix accordingly. This code has been adapted from SPxBasis::addedRows() and SPxBasis::addedCols().
Definition at line 429 of file spxchangebasis.cpp.
References SPxBasis::baseId(), SPxBasis::Desc::colStatus(), SPxSolver::COLUMN, SPxBasis::dualRowStatus(), SPxBasis::factorized, SPxBasis::loadMatrixVecs(), SPxBasis::matrixIsSetup, MSG_INFO3, SPxLPBase< R >::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), soplex::primalColStatus(), SPxBasis::REGULAR, SPxSolver::rep(), SPxSolver::ROW, SPxBasis::Desc::rowStatus(), SPxBasis::setStatus(), SPxBasis::spxout, SPxBasis::status(), SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxBasis::changedCol(), SPxBasis::changedElement(), SPxBasis::changedRow(), SPxSolver::init(), SPxBasis::load(), SPxBasis::loadDesc(), and SPxBasis::unLoad().
void setMaxUpdates | ( | int | maxUp | ) |
change maximum number of iterations until a refactorization is performed
Definition at line 451 of file spxbasis.h.
Referenced by SoPlex::setIntParam().
void setOutstream | ( | SPxOut & | newOutstream | ) |
Definition at line 943 of file spxbasis.h.
References SPxBasis::factorize(), SPxBasis::loadMatrixVecs(), SPxBasis::Desc::operator<<, SPxBasis::Desc::operator=(), SPxBasis::reDim(), SPxBasis::setRep(), SPxBasis::Desc::SPxBasis, SPxBasis::Desc::status(), Timer::USER_TIME, and SPxBasis::~SPxBasis().
Referenced by SPxBasis::load(), and SPxBasis::loadBasisSolver().
|
protected |
sets descriptor representation according to loaded LP.
Definition at line 326 of file spxbasis.cpp.
References SPxBasis::Desc::colstat, SPxBasis::Desc::costat, SPxBasis::minStab, SPxBasis::reDim(), SPxSolver::rep(), SPxSolver::ROW, SPxBasis::Desc::rowstat, SPxBasis::Desc::stat, SPxBasis::thedesc, and SPxBasis::theLP.
Referenced by SPxSolver::initRep(), SPxBasis::load(), SPxBasis::loadDesc(), and SPxBasis::setOutstream().
void setStatus | ( | SPxStatus | stat | ) |
sets basis SPxStatus to stat
.
Definition at line 431 of file spxbasis.h.
References SPxBasis::invalidate(), MSG_DEBUG, and SPxBasis::NO_PROBLEM.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::factorize(), SPxSolver::performSolutionPolishing(), SPxBasis::readBasis(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::restoreInitialBasis(), and SPxBasis::unLoad().
Definition at line 632 of file spxbasis.h.
References VectorBase< R >::clear(), VectorBase< R >::dim(), SPxBasis::factorize(), and SLinSolver::solveRight().
Referenced by SoPlex::_computeReducedProbObjCoeff(), SoPlex::_getCompatibleBoundCons(), SoPlex::_getCompatibleColumns(), SoPlex::_solveDecompositionDualSimplex(), SoPlex::_updateDecompReducedProblemViol(), SPxSolver::factorize(), SoPlex::getBasisInverseColReal(), SoPlex::getBasisInverseRowReal(), SoPlex::getBasisInverseTimesVecReal(), SPxSolver::init(), SPxSolver::leave(), SPxSolver::reinitializeVecs(), SPxSolver::solve(), SPxSolver::terminate(), and SPxSolver::testVecs().
Definition at line 646 of file spxbasis.h.
References SSVectorBase< R >::clear(), SPxBasis::factorize(), SVectorBase< R >::size(), and SLinSolver::solveRight().
solves linear system with basis matrix.
Depending on the representation, for a SPxBasis B, B.solve(x) computes
Both can be seen uniformly as solving a linear system with the basis matrix B
and a right handside vector x
aligned the same way as the vectors of B
.
Definition at line 669 of file spxbasis.h.
References SSVectorBase< R >::clear(), SPxBasis::factorize(), SVectorBase< R >::size(), and SLinSolver::solveRight4update().
Referenced by SPxSolver::enter(), SPxSolver::leave(), and SPxSteepPR::selectEnter().
solves two systems in one call.
Definition at line 683 of file spxbasis.h.
References SPxBasis::factorize(), and SLinSolver::solve2right4update().
solves two systems in one call using only sparse data structures
Definition at line 691 of file spxbasis.h.
References SPxBasis::factorize(), and SLinSolver::solve2right4update().
void solve4update | ( | SSVector & | x, |
Vector & | y, | ||
Vector & | y2, | ||
const SVector & | rhsx, | ||
SSVector & | rhsy, | ||
SSVector & | rhsy2 | ||
) |
solves three systems in one call.
Definition at line 699 of file spxbasis.h.
References SPxBasis::factorize(), SSVectorBase< R >::isSetup(), and SLinSolver::solve3right4update().
void solve4update | ( | SSVector & | x, |
SSVector & | y, | ||
SSVector & | y2, | ||
const SVector & | rhsx, | ||
SSVector & | rhsy, | ||
SSVector & | rhsy2 | ||
) |
solves three systems in one call using only sparse data structures
Definition at line 710 of file spxbasis.h.
References SPxBasis::factorize(), SSVectorBase< R >::isSetup(), and SLinSolver::solve3right4update().
SPxSolver* solver | ( | ) | const |
returns loaded solver.
Definition at line 564 of file spxbasis.h.
References SPxBasis::condition(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), and SPxBasis::theLP.
Referenced by SPxBasis::coSolve(), and SPxSolver::init().
Real stability | ( | ) | const |
returns the stability of the basis matrix.
Definition at line 627 of file spxbasis.h.
References SLinSolver::stability().
Referenced by SPxFastRT::selectLeave().
std::string statistics | ( | ) | const |
returns statistical information in form of a string.
Definition at line 930 of file spxbasis.h.
References SPxBasis::getTotalUpdateCount(), SPxBasis::getTotalUpdateTime(), and SLinSolver::statistics().
SPxStatus status | ( | void | ) | const |
returns current SPxStatus.
Definition at line 425 of file spxbasis.h.
References SPxBasis::thestatus.
Referenced by SoPlex::_addColReal(), SoPlex::_addColsReal(), SoPlex::_addRowReal(), SoPlex::_addRowsReal(), SoPlex::_changeBoundsReal(), SoPlex::_changeColReal(), SoPlex::_changeElementReal(), SoPlex::_changeLhsReal(), SoPlex::_changeLowerReal(), SoPlex::_changeRangeReal(), SoPlex::_changeRhsReal(), SoPlex::_changeRowReal(), SoPlex::_changeUpperReal(), SoPlex::_ensureRealLPLoaded(), SoPlex::_evaluateSolutionDecomp(), SoPlex::_optimizeRational(), SoPlex::_performOptIRStable(), SoPlex::_removeColReal(), SoPlex::_removeColsReal(), SoPlex::_removeRowReal(), SoPlex::_removeRowsReal(), SoPlex::_restoreLPReal(), SoPlex::_storeSolutionReal(), SPxBasis::addedCols(), SPxSolver::addedCols(), SPxBasis::addedRows(), SPxSolver::addedRows(), SPxBasis::change(), SPxSolver::changeCol(), SPxSolver::changeElement(), SPxSolver::changeLhs(), SPxSolver::changeLower(), SPxSolver::changeRange(), SPxSolver::changeRhs(), SPxSolver::changeRow(), SPxSolver::changeUpper(), SPxBasis::condition(), SPxSolver::doRemoveCol(), SPxSolver::doRemoveCols(), SPxSolver::doRemoveRow(), SPxSolver::doRemoveRows(), SPxBasis::dump(), SPxSolver::enter(), SPxBasis::factorize(), SPxSolver::factorize(), SPxSolver::getDualfarkas(), SoPlex::getEstimatedCondition(), SoPlex::getExactCondition(), SoPlex::getFastCondition(), SPxSolver::getPrimalray(), SPxSolver::init(), SPxSolver::initRep(), SPxBasis::isConsistent(), SPxBasis::isDescValid(), SPxSolver::leave(), SPxSolver::loadBasis(), SPxBasis::loadDesc(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::readBasis(), SoPlex::readBasisFile(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::restoreInitialBasis(), SoPlex::setBasis(), SPxSolver::setBasis(), SPxSolver::solve(), SPxSolver::status(), SPxSolver::terminate(), SPxSolver::testVecs(), and SPxBasis::writeBasis().
|
virtual |
unloads the LP from the basis.
Definition at line 893 of file spxbasis.h.
References SPxBasis::Desc::dump(), SPxBasis::invalidate(), SPxBasis::Desc::isConsistent(), SPxBasis::NO_PROBLEM, SPxBasis::restoreInitialBasis(), and SPxBasis::setStatus().
Referenced by SPxSolver::loadLP(), SPxSolver::read(), and SPxSolver::reLoad().
|
virtual |
Write basis to os
in MPS format. If rowNames
and colNames
are NULL
, default names are used for the constraints and variables.
Definition at line 640 of file spxbasis.cpp.
References SPxBasis::Desc::colStatus(), SPxBasis::Desc::dump(), soplex::getColName(), soplex::getRowName(), soplex::infinity, SPxLPBase< R >::lower(), MSG_DEBUG, SPxLPBase< R >::nCols(), SPxBasis::NO_PROBLEM, SPxLPBase< R >::nRows(), SPxBasis::Desc::P_FIXED, SPxBasis::Desc::P_FREE, SPxBasis::Desc::P_ON_LOWER, SPxBasis::Desc::P_ON_UPPER, LPRowBase< R >::RANGE, SPxBasis::Desc::rowStatus(), SPxBasis::status(), SPxBasis::thedesc, SPxBasis::theLP, and SPxLPBase< R >::upper().
Referenced by SPxBasis::coSolve(), and SPxSolver::writeBasisFile().
|
protected |
Definition at line 355 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::condition(), SPxBasis::factorize(), SPxBasis::getFastCondition(), SPxBasis::isConsistent(), SPxBasis::loadBasisSolver(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::operator=(), SPxBasis::SPxBasis(), and SPxBasis::~SPxBasis().
|
protected |
true
iff factor = matrix \(^{-1}\).
Definition at line 357 of file spxbasis.h.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::change(), SPxBasis::condition(), SPxBasis::factorize(), SPxBasis::getFastCondition(), SPxSolver::init(), SPxBasis::invalidate(), SPxBasis::loadBasisSolver(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::operator=(), SPxBasis::reDim(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), and SPxBasis::restoreInitialBasis().
|
protected |
allowed increase in relative fill before refactorization
When the real relative fill is bigger than fillFactor times lastFill the Basis will be refactorized.
Definition at line 379 of file spxbasis.h.
Referenced by SPxBasis::factorize(), and SPxBasis::operator=().
|
private |
true iff factor should be freed inside of this object
Definition at line 414 of file spxbasis.h.
Referenced by SPxBasis::loadBasisSolver(), SPxBasis::operator=(), SPxBasis::SPxBasis(), and SPxBasis::~SPxBasis().
|
protected |
number of calls to change() since last manipulation
Definition at line 388 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::iteration(), SPxBasis::loadDesc(), SPxBasis::operator=(), SPxSolver::solve(), SPxSolver::terminate(), and SPxSolver::testBounds().
|
protected |
number of calls to change() since last degeneracy check
Definition at line 390 of file spxbasis.h.
Referenced by SPxBasis::lastDegenCheck(), SPxSolver::solve(), and SPxSolver::terminate().
|
protected |
fill ratio that occured during last factorization
Definition at line 395 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), and SPxBasis::operator=().
|
protected |
lastIndex(): basis index where last update was done
Definition at line 403 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::lastIndex(), SPxBasis::loadDesc(), and SPxBasis::operator=().
|
protected |
lastEntered(): variable entered the base last
Definition at line 401 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::lastEntered(), SPxBasis::loadDesc(), and SPxBasis::operator=().
|
protected |
number of calls to change() before halting the simplex
Definition at line 389 of file spxbasis.h.
Referenced by SPxBasis::prevIteration(), SPxSolver::solve(), and SPxSolver::terminate().
|
protected |
memory needed after last fresh factorization
Definition at line 394 of file spxbasis.h.
Referenced by SPxBasis::change(), and SPxBasis::factorize().
|
protected |
number of nonzeros in basis matrix after last fresh factorization
Definition at line 396 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), and SPxBasis::operator=().
|
protected |
lastLeft(): variable left the base last
Definition at line 402 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::lastLeft(), SPxBasis::loadDesc(), and SPxBasis::operator=().
pointers to the vectors of the basis matrix.
Definition at line 347 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::condition(), SPxBasis::dump(), SPxBasis::factorize(), SPxBasis::isConsistent(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::operator=(), SPxBasis::printMatrix(), SPxBasis::printMatrixMTX(), SPxBasis::reDim(), SPxBasis::removedCol(), and SPxBasis::removedRow().
|
protected |
true
iff the pointers in matrix are set up correctly.
Definition at line 349 of file spxbasis.h.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::change(), SPxBasis::condition(), SPxBasis::factorize(), SPxSolver::init(), SPxBasis::invalidate(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::operator=(), SPxBasis::printMatrix(), SPxBasis::reDim(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::restoreInitialBasis(), and SPxSolver::solve().
|
protected |
number of updates before refactorization.
When a vector of the basis matrix is exchanged by a call to method change(), the LU factorization of the matrix is updated accordingly. However, after atmost maxUpdates updates of the factorization, it is recomputed in order to regain numerical stability and reduce fill in.
Definition at line 366 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::getMaxUpdates(), and SPxBasis::operator=().
|
protected |
allowed total increase in memory consumption before refactorization
Definition at line 382 of file spxbasis.h.
Referenced by SPxBasis::change(), and SPxBasis::operator=().
|
protected |
minimum stability
Definition at line 404 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), SPxBasis::operator=(), and SPxBasis::setRep().
|
protected |
allowed increase of nonzeros before refactorization.
When the number of nonzeros in LU factorization exceeds nonzeroFactor times the number of nonzeros in B, the basis matrix is refactorized.
Definition at line 373 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), and SPxBasis::operator=().
|
protected |
number of nonzeros in basis matrix
Definition at line 393 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::operator=(), and SPxBasis::printMatrixMTX().
|
private |
message handler
Definition at line 415 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::invalidate(), SPxBasis::loadBasisSolver(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::reDim(), and SPxBasis::restoreInitialBasis().
SPxIds of basic vectors.
Definition at line 345 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::isConsistent(), SPxBasis::loadDesc(), SPxBasis::operator=(), and SPxBasis::reDim().
|
private |
the basis' Descriptor
Definition at line 413 of file spxbasis.h.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::condition(), SPxBasis::desc(), SPxBasis::dump(), SPxBasis::factorize(), SPxBasis::isConsistent(), SPxBasis::load(), SPxBasis::loadDesc(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::operator=(), SPxBasis::readBasis(), SPxBasis::reDim(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::restoreInitialBasis(), SPxBasis::setRep(), and SPxBasis::writeBasis().
|
protected |
the LP
For storing the basis matrix we keep two arrays: Array theBaseId contains the SPxIds of the basis vectors, and matrix the pointers to the vectors themselfes. Method loadMatrixVecs() serves for loading matrix according to the SPxIds stored in theBaseId. This method must be called whenever the vector pointers may have changed due to manipulations of the LP.
Definition at line 343 of file spxbasis.h.
Referenced by SPxBasis::addedCols(), SPxBasis::addedRows(), SPxBasis::change(), SPxSolver::clear(), SPxBasis::dualColStatus(), SPxBasis::dualRowStatus(), SPxBasis::dualStatus(), SPxBasis::dump(), SPxBasis::isConsistent(), SPxBasis::isDescValid(), SPxBasis::load(), SPxBasis::loadDesc(), SPxBasis::loadMatrixVecs(), SPxBasis::multBaseWith(), SPxBasis::multWithBase(), SPxBasis::operator=(), SPxSolver::operator=(), SPxSolver::read(), SPxBasis::readBasis(), SPxBasis::reDim(), SPxSolver::reLoad(), SPxBasis::removedCol(), SPxBasis::removedCols(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxBasis::restoreInitialBasis(), SPxBasis::setRep(), SPxBasis::solver(), SPxSolver::SPxSolver(), and SPxBasis::writeBasis().
|
private |
current status of the basis.
Definition at line 412 of file spxbasis.h.
Referenced by SPxBasis::operator=(), and SPxBasis::status().
|
protected |
time spent in updates
Definition at line 398 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::SPxBasis(), and SPxBasis::~SPxBasis().
|
protected |
type of timer (user or wallclock)
Definition at line 399 of file spxbasis.h.
Referenced by SPxBasis::SPxBasis().
|
protected |
number of updates
Definition at line 392 of file spxbasis.h.
Referenced by SPxBasis::change(), and SPxBasis::getTotalUpdateCount().
|
protected |
number of calls to change() since last factorize()
Definition at line 391 of file spxbasis.h.
Referenced by SPxBasis::change(), SPxBasis::factorize(), SPxBasis::lastUpdate(), SPxBasis::loadDesc(), and SPxSolver::terminate().