50 int ninfeasibilities = 0;
53 for(
int i = 0; i <
dim(); ++i)
71 if(ninfeasibilities > sparsitythreshold)
94 (*spxout) <<
" --- using hypersparse pricing, ";
96 (*
spxout) <<
" --- using sparse pricing, ";
97 (*spxout) <<
"sparsity: " 98 << std::setw(6) << std::fixed << std::setprecision(4)
99 << (
Real) ninfeasibilities /
dim()
100 << std::scientific << std::setprecision(
int(prec))
111 assert(&ftest == &
fTest());
118 for(
int j = idx.
size() - 1; j >= 0; --j)
120 int i = idx.
index(j);
206 leaveId =
baseId(leaveIdx);
238 assert(
lhs(leaveNum) ==
rhs(leaveNum));
239 leavebound = -
rhs(leaveNum);
251 leavebound = -
rhs(leaveNum);
259 leavebound = -
lhs(leaveNum);
271 leavebound = -
lhs(leaveNum);
279 leavebound = -
rhs(leaveNum);
290 MSG_DEBUG(std::cout <<
"DLEAVE51 SPxSolver::getLeaveVals() : row " << leaveNum
293 <<
" objChange: " << objChange
343 objChange +=
maxObj(leaveNum) * leavebound;
356 objChange +=
theUCbound[leaveNum] * leavebound;
364 objChange +=
theLCbound[leaveNum] * leavebound;
375 objChange +=
theUCbound[leaveNum] * leavebound;
383 objChange +=
theLCbound[leaveNum] * leavebound;
394 MSG_DEBUG(std::cout <<
"DLEAVE52 SPxSolver::getLeaveVals() : col " << leaveNum
397 <<
" objChange: " << objChange
480 newUBbound = -
lhs(idx);
481 newLBbound = -
rhs(idx);
482 enterBound = -
rhs(idx);
483 objChange -= newCoPrhs *
rhs(idx);
494 newLBbound = -
rhs(idx);
495 newUBbound = -
lhs(idx);
496 enterBound = -
lhs(idx);
497 objChange -= newCoPrhs *
lhs(idx);
505 MSG_ERROR(std::cerr <<
"ELEAVE53 ERROR: not yet debugged!" << std::endl;)
517 <<
"ERROR! Tried to put a fixed row variable into the basis: " 519 <<
", lhs=" <<
lhs(idx)
520 <<
", rhs=" <<
rhs(idx) << std::endl;)
527 MSG_DEBUG(std::cout <<
"DLEAVE55 SPxSolver::getLeaveVals2(): row " << idx
530 <<
" objChange: " << objChange
597 objChange -= newCoPrhs * enterBound;
611 objChange -= newCoPrhs * enterBound;
631 <<
"ERROR! Tried to put a fixed column variable into the basis. " 633 <<
", lower=" <<
lower(idx)
634 <<
", upper=" <<
upper(idx) << std::endl;)
641 MSG_DEBUG(std::cout <<
"DLEAVE57 SPxSolver::getLeaveVals2(): col " << idx
644 <<
" objChange: " << objChange
661 MSG_DEBUG(std::cout <<
"DLEAVE58 rejectLeave() : row " << leaveNum
663 <<
" -> " << leaveStat << std::endl;)
677 MSG_DEBUG(std::cout <<
"DLEAVE59 rejectLeave() : col " << leaveNum
679 <<
" -> " << leaveStat << std::endl;)
696 Real sign = (direction > 0 ? 1.0 : -1.0);
707 Real sign = (direction > 0 ? -1.0 : 1.0);
718 assert(leaveIdx <
dim() && leaveIdx >= 0);
735 #ifdef ENABLE_ADDITIONAL_CHECKS 748 <<
": coPvec.delta error = " << tmp.
length()
768 getLeaveVals(leaveIdx, leaveStat, leaveId, leaveMax, leavebound, leaveNum, objChange);
784 Real enterVal = leaveMax;
791 MSG_DEBUG(std::cout <<
"DLEAVE71 trigger recomputation of nonbasic value due to shifts in ratiotest" 817 if(
NE(enterVal, leaveMax))
819 MSG_DEBUG(std::cout <<
"DLEAVE61 rejecting leave A (leaveIdx=" << leaveIdx
820 <<
", theCoTest=" <<
theCoTest[leaveIdx] <<
")" 837 instableLeaveNum = leaveIdx;
850 <<
"leave() for feasibility test" << std::endl;)
885 <<
"in leave()" << std::endl;)
906 if(enterId !=
baseId(leaveIdx))
927 MSG_DEBUG(std::cout <<
"ILBFRT02 breakpoints passed / bounds flipped = " <<
boundflips << std::endl;
953 MSG_DEBUG(std::cout <<
"ILBFRT02 breakpoints passed / bounds flipped = " <<
boundflips << std::endl;
960 #ifdef ENABLE_ADDITIONAL_CHECKS 985 <<
"in leave()" << std::endl;)
1008 rejectLeave(leaveNum, leaveId, leaveStat, &newVector);
1012 MSG_DEBUG(std::cout <<
"DLEAVE63 rejecting leave B (leaveIdx=" << leaveIdx
1013 <<
", theCoTest=" <<
theCoTest[leaveIdx]
1014 <<
")" << std::endl;)
1035 getLeaveVals2(leaveMax, enterId, enterBound, newUBbound, newLBbound, newCoPrhs, objChange);
1047 (*theCoPrhs)[leaveIdx] = newCoPrhs;
1060 theFvec->
value() = -((*theFvec)[leaveIdx] - leavebound)
1087 change(leaveIdx, none, 0);
1094 (*theCoPrhs)[leaveIdx] =
theLRbound[leaveNum];
1099 (*theCoPrhs)[leaveIdx] =
theLCbound[leaveNum];
1112 (*theCoPrhs)[leaveIdx] =
theURbound[leaveNum];
1117 (*theCoPrhs)[leaveIdx] =
theUCbound[leaveNum];
1152 #ifdef ENABLE_ADDITIONAL_CHECKS 1163 <<
": fVec error = " << tmp.
length() << std::endl;)
const VectorBase< R > & rhs() const
Returns right hand side vector.
void computeFtest()
compute basis feasibility test vector.
Rational spxAbs(const Rational &r)
Absolute.
int iteration() const
returns number of basis changes since last load().
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
bool isSetup() const
Returns setup status.
virtual void rejectLeave(int leaveNum, SPxId leaveId, SPxBasis::Desc::Status leaveStat, const SVector *newVec=0)
void coSolve(Vector &x, const Vector &rhs)
Cosolves linear system with basis matrix.
primal variable is fixed to both bounds
UpdateVector primVec
primal vector
int boundflips
number of performed bound flips
const VectorBase< Real > & upper() const
Returns upper bound vector.
const Vector & fTest() const
Violations of fVec.
Desc::Status dualColStatus(int i) const
dual Status for the i'th column variable of the loaded LP.
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing ...
SPxOut * spxout
message handler
bool sparsePricingLeave
These values enable or disable sparse pricing.
THREADLOCAL const Real infinity
bool leave(int i, bool polish=false)
Abstract pricer base class.
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
SSVector * solveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
void updateFtest()
update basis feasibility test vector.
void computePrimalray4Row(Real direction)
Exception classes for SoPlex.
Status & rowStatus(int i)
Abstract ratio test base class.
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
int m_maxCycle
maximum steps before cycling is detected.
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
bool NE(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| > eps
Real length() const
Floating point approximation of euclidian norm (without any approximation guarantee).
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
void clear()
removes all indices.
int lastUpdate() const
returns number of basis changes since last refactorization.
int dim() const
dimension of basis matrix.
Vector & multBaseWith(Vector &x) const
Basis-vector product.
virtual SPxId selectEnter(Real &val, int leaveIdx, bool polish=false)=0
selects variable Id to enter the basis.
Real sparsePricingFactor
enable sparse pricing when viols < factor * dim()
SSVector * solveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
int sign(const Rational &r)
Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0.
virtual void doPupdate(void)
virtual Real value()
current objective value.
Desc::Status dualRowStatus(int i) const
dual Status for the i'th row variable of the loaded LP.
virtual const std::string what() const
returns exception message
dual variable is left free, but unset
Wrapper for different output streams and verbosity levels.
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
const Vector & fRhs() const
right-hand side vector for fVec
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: ...
UpdateVector & coPvec() const
copricing vector.
int remainingRoundsLeave
number of dense rounds/refactorizations until sparsePricing is enabled again
int m_numCycle
actual number of degenerate steps so far.
SPxStatus status() const
returns current SPxStatus.
SSVector * solveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
const SVector & baseVec(int i) const
returns the i'th basic vector.
bool m_pricingViolCoUpToDate
true, if the stored violation in coDim is up to date
virtual const SVector * enterVector(const SPxId &p_id)
Get pointer to the id 'th vector.
Real m_pricingViol
maximal feasibility violation of current solution
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
void update()
Perform the update.
int size() const
returns the number of used indices.
#define MSG_INFO2(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO2.
#define MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
int size() const
Returns number of elements.
UpdateVector & fVec() const
feasibility vector.
bool isSPxColId() const
is id a column id?
dual variable is set to its upper bound
DVector theLBbound
Lower Basic Feasibility bound.
virtual void setupPupdate(void)
void addIdx(int i)
adds index i to the index set
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
Real delta() const
guaranteed primal and dual bound violation for optimal solution, returning the maximum of feastol() a...
primal variable is left free, but unset
const VectorBase< R > & lhs() const
Returns left hand side vector.
void clear()
Clears vector.
bool updateNonbasicValue(Real objChange)
DVector theURbound
Upper Row Feasibility bound.
bool isConsistent() const
consistency check.
int leaveCycles
the number of degenerate steps during the leaving algorithm
int index(int n) const
Returns index of the n 'th nonzero element.
virtual void getLeaveVals(int i, SPxBasis::Desc::Status &leaveStat, SPxId &leaveId, Real &leaveMax, Real &leavebound, int &leaveNum, StableSum< Real > &objChange)
Status & colStatus(int i)
DVector theUBbound
Upper Basic Feasibility bound.
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
virtual void change(int i, SPxId &id, const SVector *enterVec, const SSVector *eta=0)
performs basis update.
Real m_pricingViolCo
maximal feasibility violation of current solution in coDim
Real epsilon() const
values are considered to be 0.
void computeDualfarkas4Col(Real direction)
Debugging, floating point type and parameter definitions.
int totalboundflips
total number of bound flips
SSVector * solveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
DVector theLRbound
Lower Row Feasibility bound.
DVector theUCbound
Upper Column Feasibility bound.
static const Real reject_leave_tol
VectorBase< R > & multAdd(const S &x, const VectorBase< T > &vec)
Addition of scaled vector.
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
int size() const
Returns the number of nonzeros.
Everything should be within this namespace.
const IdxSet & idx() const
nonzero indices of update vector
void clear()
Remove all indices.
void solve4update(SSVector &x, const SVector &rhs)
solves linear system with basis matrix.
primal variable is set to its lower bound
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
virtual void getLeaveVals2(Real leaveMax, SPxId enterId, Real &enterBound, Real &newUBbound, Real &newLBbound, Real &newCoPrhs, StableSum< Real > &objChange)
std::streamsize precision() const
DVector theLCbound
Lower Column Feasibility bound.
Real & value()
update multiplicator , writeable
void computeFrhs()
compute feasibility vector from scratch.
virtual void perturbMinLeave(void)
bool isSPxRowId() const
is id a row id?
SPxRatioTester * theratiotester
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
dual variable is set to its lower bound
DSVector primalRay
stores primal ray in case of unboundedness
Type type() const
return current Type.
Real theShift
sum of all shifts applied to any bound.
Real length() const
Floating point approximation of euclidian norm (without any approximation guarantee).
bool isConsistent() const
DSVector dualFarkas
stores dual farkas proof in case of infeasibility
Array< UnitVector > unitVecs
array of unit vectors
dual variable has two bounds
bool recomputedVectors
flag to perform clean up step to reduce numerical errors only once
Exception class for status exceptions during the computationsThis class is derived from the SoPlex ex...
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
bool initialized
true, if all vectors are setup.
void forceRecompNonbasicValue()
void solve(Vector &x, const Vector &rhs)
SSVector & delta()
update vector , writeable
bool m_pricingViolUpToDate
true, if the stored violation is up to date
int index(int n) const
access n 'th index.
const SPxBasis & basis() const
Return current basis.
Status
Status of a variable.
LP has been proven to be primal unbounded.
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
const VectorBase< Real > & lower() const
Returns (internal and possibly scaled) lower bound vector.
const Desc & desc() const
Representation rep() const
return the current basis representation.
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
columnwise representation.
R value(int n) const
Returns value of the n 'th nonzero element.
virtual void factorize()
Factorize basis matrix.
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver's basis status.
void setMax(int newmax=1)
Reset nonzero memory to >= newmax.
LP has been proven to be primal infeasible.