24 #define SOPLEX_DEBUG_SPXBASIS 202 template <
class T>
friend std::ostream&
operator<< (std::ostream& os,
224 return colstat.
size();
229 return rowstat.
size();
239 return costat->
size();
302 void reSize(
int rowDim,
int colDim);
437 if(thestatus != stat)
440 MSG_DEBUG(std::cout <<
"DBSTAT01 SPxBasisBase<R>::setStatus(): status: " 441 <<
int(thestatus) <<
" (" << thestatus <<
") -> " 442 <<
int(stat) <<
" (" << stat <<
")" << std::endl;)
496 return id.isSPxRowId()
520 assert(matrixIsSetup);
608 R
condition(
int maxiters = 10, R tolerance = 1e-6);
787 factor->
solveLeft(x, y, z, rhsx, rhsy, rhsz);
796 factor->
solveLeft(x, y, z, rhsx, rhsy, rhsz);
869 const NameSet* rownames,
const NameSet* colnames,
const bool cpxFormat =
false)
const;
929 return theTime->
time();
942 #ifdef MEASUREUPDATETIME 953 spxout = &newOutstream;
1016 #include "spxbasis.hpp" 1017 #include "spxdesc.hpp" 1021 #ifdef SOPLEX_DEBUG_SPXBASIS 1022 #define SOPLEX_DEBUG 1023 #undef SOPLEX_DEBUG_SPXBASIS 1026 #endif // _SPXBASIS_H_ SPxId lastout
lastLeft(): variable left the base last
Desc thedesc
the basis' Descriptor
virtual void solveRight(VectorBase< R > &x, const VectorBase< R > &b)=0
Solves .
bool isSetup() const
Returns setup status.
LP has been proven to be primal infeasible.
int iterCount
number of calls to change() since last manipulation
int nzCount
number of nonzeros in basis matrix
primal or dual variable is undefined
int updateCount
number of calls to change() since last factorize()
void changedCol(int)
inform SPxBasisBase that a column had been changed.
Desc & operator=(const Desc &rhs)
assignment operator
SPxId lastin
lastEntered(): variable entered the base last
friend std::ostream & operator<<(std::ostream &os, const Status &stat)
Desc::Status dualColStatus(int i) const
dual Status for the i'th column variable of the loaded LP.
void coSolve(SSVectorBase< R > &x, VectorBase< R > &y, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy)
solves two systems in one call.
Dense vector.Class VectorBase provides dense linear algebra vectors. Internally, VectorBase wraps std...
void coSolve(SSVectorBase< R > &x, SSVectorBase< R > &y, SSVectorBase< R > &z, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy, SSVectorBase< R > &rhsz)
Sparse version of solving three systems in one call.
virtual std::string statistics() const =0
returns statistical information in form of a string.
SPxOut * spxout
message handler
bool matrixIsSetup
true iff the pointers in matrix are set up correctly.
int lastIndex() const
returns index in basis where last update was done.
Status & colStatus(int i)
int size() const
Number of used indices.
Sequential object-oriented SimPlex.SPxSolverBase is an LP solver class using the revised Simplex algo...
dual variable is left free, but unset
SPxId lastEntered() const
returns SPxId of last VectorBase<R> included to the basis.
virtual void change(int i, SPxId &id, const SVectorBase< R > *enterVec, const SSVectorBase< R > *eta=0)
performs basis update.
primal variable is fixed to both bounds
int lastDegenCheck() const
returns the number of iterations since the last degeneracy check
Simplex basis.Consider the linear program as provided from class SPxLP: where , and ...
Status rowStatus(int i) const
returns status of row i.
int lastNzCount
number of nonzeros in basis matrix after last fresh factorization
Basis is primal feasible.
void setRep()
sets descriptor representation according to loaded LP.
int lastIterCount
number of calls to change() before halting the simplex
virtual void solveRight4update(SSVectorBase< R > &x, const SVectorBase< R > &b)=0
Solves . Possibly sets up internal data structures suitable for an optimized subsequent change() call...
void coSolve(SSVectorBase< R > &x, VectorBase< R > &y, VectorBase< R > &z, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy, SSVectorBase< R > &rhsz)
solves three systems in one call. May be improved by using just one pass through the basis...
virtual R stability() const =0
returns a stability number (0: singularity, 1: perfect stability).
int lastUpdate() const
returns number of basis changes since last refactorization.
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
int dim() const
returns dimension.
DataArray< Status > colstat
status of columns.
Sparse Linear Solver virtual base class.
SPxStatus status() const
returns current SPxStatus.
int maxUpdates
number of updates before refactorization.
Sparse Linear Solver virtual base class.Class SLinSolver provides a class for solving sparse linear s...
virtual void load(SPxSolverBase< R > *lp, bool initSlackBasis=true)
loads the LP lp to the basis.
Semi sparse vector.This class implements semi-sparse vectors. Such are VectorBases where the indices ...
SPxSolverBase< R > * solver() const
returns loaded solver.
Wrapper for different output streams and verbosity levels.
void addedRows(int n)
inform SPxBasisBase, that n new rows had been added.
const Status * colStatus(void) const
returns the array of column Statuses.
bool factorized
true iff factor = matrix .
R getEstimatedCondition()
primal variable is set to its upper bound
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
void solve4update(SSVectorBase< R > &x, const SVectorBase< R > &rhs)
solves linear system with basis matrix.
int getMaxUpdates() const
returns maximum number of updates before a refactorization is performed
void solve(VectorBase< R > &x, const VectorBase< R > &rhs)
void changedElement(int, int)
inform SPxBasisBase that a matrix entry had been changed.
SPxBasisBase< Real > SPxBasis
const Desc & desc() const
R fillFactor
allowed increase in relative fill before refactorization
SPxSolverBase< R > * theLP
the LP
void removedCols(const int perm[])
inform SPxBasisBase that columns in perm with negative entry were removed.
SPxId baseId(int i) const
returns the Id of the i'th basis vector.
int nRows() const
returns number of rows.
Wrapper for several output streams. A verbosity level is used to decide which stream to use and wheth...
Desc::Status dualStatus(const SPxId &id) const
dual Status for the variable with ID id of the loaded LP.
void loadMatrixVecs()
loads matrix according to the SPxIds stored in theBaseId.
const T * get_const_ptr() const
get a const C pointer to the data.
R memFactor
allowed total increase in memory consumption before refactorization
Desc & desc()
returns current basis Descriptor.
void coSolve(VectorBase< R > &x, const VectorBase< R > &rhs)
Cosolves linear system with basis matrix.
Basis is optimal, i.e. dual and primal feasible.
bool isConsistent() const
consistency check.
primal variable is set to its lower bound
int getTotalUpdateCount() const
number of updates performed
void addedCols(int n)
inform SPxBasisBase that n new columns had been added.
void solve4update(SSVectorBase< R > &x, VectorBase< R > &y, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy)
solves two systems in one call.
void clear()
Clears vector.
void solve4update(SSVectorBase< R > &x, VectorBase< R > &y, VectorBase< R > &y2, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy, SSVectorBase< R > &rhsy2)
solves three systems in one call.
void removedRows(const int perm[])
inform SPxBasisBase that rows in perm with negative entry were removed.
int totalUpdateCount
number of updates
void solve4update(SSVectorBase< R > &x, SSVectorBase< R > &y, SSVectorBase< R > &y2, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy, SSVectorBase< R > &rhsy2)
solves three systems in one call using only sparse data structures
const Status * coStatus(void) const
returns the array of covariable Statuses.
void invalidate()
invalidates actual basis.
virtual bool isDescValid(const Desc &ds)
checks if a Descriptor is valid for the current LP w.r.t. its bounds
virtual Real time() const =0
primal variable is left free, but unset
void reDim()
resizes internal arrays.
LP has been proven to be primal unbounded.
void setStatus(SPxStatus stat)
sets basis SPxStatus to stat.
void removedRow(int i)
inform SPxBasisBase that row i had been removed.
void restoreInitialBasis()
Restores initial basis.
R lastFill
fill ratio that occured during last factorization
Status coStatus(int i) const
returns status of covariable i.
Debugging, floating point type and parameter definitions.
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
virtual void writeBasis(std::ostream &os, const NameSet *rownames, const NameSet *colnames, const bool cpxFormat=false) const
Desc::Status dualRowStatus(int i) const
dual Status for the i'th row variable of the loaded LP.
int dim() const
Dimension of vector.
const Status * status(void) const
returns the array of variable Statuses.
void removedCol(int i)
inform SPxBasisBase that column i had been removed.
Everything should be within this namespace.
virtual bool readBasis(std::istream &in, const NameSet *rowNames, const NameSet *colNames)
Basis is not known to be dual nor primal feasible.
const SVectorBase< R > & baseVec(int i) const
returns the i'th basic vector.
int prevIteration() const
returns the number of iterations prior to the last break in execution
R condition(int maxiters=10, R tolerance=1e-6)
void solve(SSVectorBase< R > &x, const SVectorBase< R > &rhs)
Real getTotalUpdateTime() const
time spent in updates
R minStab
minimum stability
DataArray< Status > * costat
cobasis' status.
R getMatrixMetric(int type=0)
virtual void solveLeft(VectorBase< R > &x, const VectorBase< R > &b)=0
solves .
R nonzeroFactor
allowed increase of nonzeros before refactorization.
bool freeSlinSolver
true iff factor should be freed inside of this object
VectorBase< R > & multBaseWith(VectorBase< R > &x) const
Basis-vector product.
Saving LPs in a form suitable for SoPlex.
virtual void factorize()
factorizes the basis matrix.
void clear()
Set vector to contain all-zeros (keeping the same length)
void coSolve(SSVectorBase< R > &x, const SVectorBase< R > &rhs)
Sparse version of coSolve.
VectorBase< R > & multWithBase(VectorBase< R > &x) const
Vector-basis product.
virtual void loadDesc(const Desc &)
sets up basis.
SPxId lastLeft() const
returns SPxId of last vector that left the basis.
DataArray< SPxId > theBaseId
SPxIds of basic vectors.
int size() const
return nr. of elements.
virtual void printMatrix() const
virtual void unLoad()
unloads the LP from the basis.
void solve4update(SSVectorBase< R > &x, SSVectorBase< R > &y, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy)
solves two systems in one call using only sparse data structures
virtual void solve2right4update(SSVectorBase< R > &x, VectorBase< R > &y, const SVectorBase< R > &b, SSVectorBase< R > &d)=0
Solves and .
R stability() const
returns the stability of the basis matrix.
void setMaxUpdates(int maxUp)
change maximum number of iterations until a refactorization is performed
DataArray< Status > * stat
basis' status.
Status status(int i) const
returns status of variable i.
int iteration() const
returns number of basis changes since last load().
dual variable is set to its lower bound
Sparse vectors.Class SVectorBase provides packed sparse vectors. Such are a sparse vectors...
const Status * rowStatus(void) const
returns the array of row Statuses.
Timer::TYPE timerType
type of timer (user or wallclock)
Status colStatus(int i) const
returns status of column i.
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
int lastidx
lastIndex(): basis index where last update was done
int lastMem
memory needed after last fresh factorization
DataArray< const SVectorBase< R > *> matrix
pointers to the vectors of the basis matrix.
void reSize(int rowDim, int colDim)
resets dimensions.
void changedRow(int)
inform SPxBasisBase that a row had been changed.
SPxStatus thestatus
current status of the basis.
virtual void loadBasisSolver(SLinSolver< R > *solver, const bool destroy=false)
sets up linear solver to use.
DataArray< Status > rowstat
status of rows.
int iterDegenCheck
number of calls to change() since last degeneracy check
Save arrays of data objects.
dual variable has two bounds
virtual void solve3right4update(SSVectorBase< R > &x, VectorBase< R > &y, VectorBase< R > &z, const SVectorBase< R > &b, SSVectorBase< R > &d, SSVectorBase< R > &e)=0
Solves , and .
dual variable is set to its upper bound
int coDim() const
returns codimension.
Status & rowStatus(int i)
Wrapper for the system time query methods.
void printMatrixMTX(int number)
void setOutstream(SPxOut &newOutstream)
Desc::Status dualStatus(const SPxColId &id) const
dual Status for the column variable with ID id of the loaded LP.
void coSolve(SSVectorBase< R > &x, SSVectorBase< R > &y, const SVectorBase< R > &rhsx, SSVectorBase< R > &rhsy)
Sparse version of solving two systems in one call.
std::string statistics() const
returns statistical information in form of a string.
Timer * theTime
time spent in updates
No Problem has been loaded to the basis.