76 x = (*thePvec)[i] -
lhs(i);
85 return rhs(i) - (*thePvec)[i];
93 return maxObj(i) - (*thePvec)[i];
100 x =
maxObj(i) - (*thePvec)[i];
101 return (x < 0) ? x : -x;
116 int ninfeasibilities = 0;
119 for(
int i = 0; i <
coDim(); ++i)
148 if(ninfeasibilities > sparsitythreshold)
154 ninfeasibilities = 0;
157 else if(
theTest[i] < -pricingTol)
170 (*spxout) <<
" --- using hypersparse pricing, ";
172 (*
spxout) <<
" --- using sparse pricing, ";
173 (*spxout) <<
"sparsity: " 174 << std::setw(6) << std::fixed << std::setprecision(4)
176 << std::scientific << std::setprecision(
int(prec))
250 int ninfeasibilities = 0;
254 for(i =
dim() - 1; i >= 0; --i)
282 if(ninfeasibilities > sparsitythreshold)
288 ninfeasibilities = 0;
304 (*spxout) <<
" --- using hypersparse pricing, ";
306 (*
spxout) <<
" --- using sparse pricing, ";
307 (*spxout) <<
"sparsity: " 308 << std::setw(6) << std::fixed << std::setprecision(4)
309 << (
Real) ninfeasibilities /
dim()
310 << std::scientific << std::setprecision(
int(prec))
333 for(i = idx.
size() - 1; i >= 0; --i)
335 int j = idx.
index(i);
366 else if(
theTest[j] < -pricingTol)
388 for(i = idx.
size() - 1; i >= 0; --i)
390 int j = idx.
index(i);
473 enterTest =
coTest()[enterIdx];
485 enterMax = enterLB - enterUB;
486 enterPric = (*thePvec)[enterIdx];
487 enterRO =
maxObj(enterIdx);
488 objChange -= enterVal * enterRO;
492 else if(
EQ(enterLB, enterUB))
504 enterMax = enterUB - enterLB;
505 enterPric = (*thePvec)[enterIdx];
506 enterRO =
maxObj(enterIdx);
507 objChange -= enterVal * enterRO;
511 else if(
EQ(enterLB, enterUB))
523 enterPric = (*thePvec)[enterIdx];
524 enterRO =
maxObj(enterIdx);
537 enterPric = (*theCoPvec)[enterIdx];
539 objChange -= enterRO * enterVal;
550 enterPric = (*theCoPvec)[enterIdx];
552 objChange -= enterRO * enterVal;
563 enterPric = (*theCoPvec)[enterIdx];
565 if(enterPric > enterRO)
575 enterPric = (*theCoPvec)[enterIdx];
604 MSG_DEBUG(std::cout <<
"DENTER03 SPxSolver::getEnterVals() : col " << enterIdx
607 <<
" objChange: " << objChange
628 enterTest =
coTest()[enterIdx];
640 enterMax = enterUB - enterLB;
641 enterPric = (*theCoPvec)[enterIdx];
643 objChange -= enterRO * enterVal;
647 else if(
EQ(enterLB, enterUB))
659 enterMax = enterLB - enterUB;
660 enterPric = (*theCoPvec)[enterIdx];
662 objChange -= enterRO * enterVal;
666 else if(
EQ(enterLB, enterUB))
678 MSG_ERROR(std::cerr <<
"EENTER99 ERROR: not yet debugged!" << std::endl;)
693 enterPric = (*thePvec)[enterIdx];
694 enterRO =
lhs(enterIdx);
695 objChange -= enterRO * enterVal;
706 enterPric = (*thePvec)[enterIdx];
707 enterRO =
rhs(enterIdx);
708 objChange -= enterRO * enterVal;
714 assert(
rhs(enterIdx) ==
lhs(enterIdx));
718 enterPric = (*thePvec)[enterIdx];
719 enterRO =
rhs(enterIdx);
726 enterPric = (*thePvec)[enterIdx];
728 if(enterPric >
rhs(enterIdx))
734 enterRO =
rhs(enterIdx);
743 enterRO =
lhs(enterIdx);
755 MSG_DEBUG(std::cout <<
"DENTER05 SPxSolver::getEnterVals() : row " 756 << enterIdx <<
": " << enterStat
758 <<
" objChange: " << objChange
848 MSG_ERROR(std::cerr <<
"EENTER98 ERROR: not yet debugged!" << std::endl;)
882 objChange += leavebound *
maxRowObj(leaveIdx);
890 objChange += leavebound *
maxRowObj(leaveIdx);
898 objChange += leavebound *
maxRowObj(leaveIdx);
909 objChange += leavebound *
maxRowObj(leaveIdx);
916 objChange += leavebound *
maxRowObj(leaveIdx);
926 MSG_DEBUG(std::cout <<
"DENTER06 SPxSolver::getEnterVals2(): row " 927 << idx <<
": " << leaveStat
929 <<
" objChange: " << objChange
1028 objChange +=
maxObj(idx) * leavebound;
1036 objChange +=
maxObj(idx) * leavebound;
1044 objChange +=
maxObj(idx) * leavebound;
1056 objChange +=
maxObj(idx) * leavebound;
1063 objChange +=
maxObj(idx) * leavebound;
1073 MSG_DEBUG(std::cout <<
"DENTER07 SPxSolver::getEnterVals2(): col " 1074 << idx <<
": " << leaveStat
1076 <<
" objChange: " << objChange
1128 (*theFrhs)[enterIdx] += leaveVal;
1149 int enterIdx =
number(enterId);
1153 theTest[enterIdx] = enterTest;
1166 Real sign = (direction > 0 ? 1.0 : -1.0);
1186 Real sign = (direction > 0 ? -1.0 : 1.0);
1226 enterVal, enterMax, enterPric, enterStat, enterRO, objChange);
1228 if(!polish && enterTest > -
epsilon())
1233 MSG_DEBUG(std::cout <<
"DENTER08 rejecting false enter pivot" << std::endl;)
1249 #ifdef ENABLE_ADDITIONAL_CHECKS 1265 << tmp.
length() << std::endl;)
1279 Real leaveVal = -enterMax;
1285 assert(leaveIdx < 0 || !
baseId(leaveIdx).isSPxColId()
1287 assert(leaveIdx < 0 || !
baseId(leaveIdx).isSPxRowId()
1322 (*theCoPvec) -= (*coSolveVector3);
1330 (*theCoPvec) -= (*coSolveVector3);
1351 MSG_DEBUG(std::cout <<
"IEBFRT02 breakpoints passed / bounds flipped = " <<
boundflips << std::endl;
1356 (*theCoPrhs)[leaveIdx] = enterRO;
1373 assert(!
baseId(leaveIdx).isSPxRowId()
1375 assert(!
baseId(leaveIdx).isSPxColId()
1404 (*theFvec)[leaveIdx] = enterVal - leaveVal;
1422 else if(
NE(leaveVal, -enterMax))
1442 MSG_DEBUG(std::cout <<
"DENTER09 rejecting enter pivot and looking for others" << std::endl;)
1444 rejectEnter(enterId, enterTest / 10.0, enterStat);
1449 MSG_DEBUG(std::cout <<
"DENTER10 rejecting enter pivot in instable state, resetting values" <<
1464 else if(!polish && leaveVal < infinity && leaveVal > -
infinity)
1467 assert(leaveVal == -enterMax);
1469 change(-1, enterId, enterVec);
1474 ungetEnterVal(enterId, enterStat, leaveVal, *enterVec, objChange);
1479 MSG_DEBUG(std::cout <<
"DENTER11 moving entering variable from one bound to the other" << std::endl;
1502 <<
"enter() for feasibility test" << std::endl;)
1526 MSG_INFO3((*
spxout), (*
spxout) <<
"IENTER11 clean up step to reduce numerical errors" << std::endl;)
1540 <<
"enter()" << std::endl;)
const VectorBase< R > & rhs() const
Returns right hand side vector.
Rational spxAbs(const Rational &r)
Absolute.
virtual void ungetEnterVal(SPxId enterId, SPxBasis::Desc::Status enterStat, Real leaveVal, const SVector &vec, StableSum< Real > &objChange)
bool enter(SPxId &id, bool polish=false)
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
bool isSetup() const
Returns setup status.
void coSolve(Vector &x, const Vector &rhs)
Cosolves linear system with basis matrix.
primal variable is fixed to both bounds
int boundflips
number of performed bound flips
primal or dual variable is undefined
const VectorBase< Real > & upper() const
Returns upper bound vector.
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
THREADLOCAL const Real infinity
int max() const
returns the maximal number of indices which can be stored in IdxSet.
Pricing pricing() const
return current Pricing.
virtual void rejectEnter(SPxId enterId, Real enterTest, SPxBasis::Desc::Status enterStat)
Abstract pricer base class.
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
void computeTest()
compute test vector in ENTERing Simplex.
Exception classes for SoPlex.
Status & rowStatus(int i)
virtual void getEnterVals2(int leaveIdx, Real enterMax, Real &leaveBound, StableSum< Real > &objChange)
bool sparsePricingEnterCo
true if sparsePricing is turned on in the entering Simplex
Abstract ratio test base class.
void computePrimalray4Col(Real direction, SPxId enterId)
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.
bool isId(const SPxId &p_id) const
Is p_id an SPxId ?
virtual void perturbMinEnter(void)
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.
Real sparsePricingFactor
enable sparse pricing when viols < factor * dim()
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
virtual void perturbMaxEnter(void)
perturb basis bounds.
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.
int dim() const
Dimension of VectorBase.
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: ...
int m_numCycle
actual number of degenerate steps so far.
SPxStatus status() const
returns current SPxStatus.
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 void getEnterVals(SPxId id, Real &enterTest, Real &enterUB, Real &enterLB, Real &enterVal, Real &enterMax, Real &enterPric, SPxBasis::Desc::Status &enterStat, Real &enterRO, StableSum< Real > &objChange)
SSVector * coSolveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
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.
const SVSet * thecovectors
the LP coVectors according to representation
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.
SSVector * coSolveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
bool updateNonbasicValue(Real objChange)
void updateTest()
recompute test vector.
DVector theURbound
Upper Row Feasibility bound.
bool isConsistent() const
consistency check.
bool sparsePricingEnter
true if sparsePricing is turned on in the entering Simplex for slack variables
int remainingRoundsEnterCo
const VectorBase< R > & maxRowObj() const
const Vector & test() const
Violations of pVec.
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.
Debugging, floating point type and parameter definitions.
int totalboundflips
total number of bound flips
bool EQ(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| <= eps
DVector theLRbound
Lower Row Feasibility bound.
DVector theUCbound
Upper Column Feasibility bound.
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.
SSVector * coSolveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
void updateCoTest()
recompute coTest vector.
primal variable is set to its lower bound
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
std::streamsize precision() const
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
DVector theLCbound
Lower Column Feasibility bound.
Real & value()
update multiplicator , writeable
const Vector & coTest() const
violations of coPvec.
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
int enterCycles
the number of degenerate steps during the entering algorithm
DSVector primalRay
stores primal ray in case of unboundedness
Type type() const
return current Type.
DataArray< int > isInfeasibleCo
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
int coDim() const
codimension.
virtual int selectLeave(Real &val, Real enterTest, bool polish=false)=0
selects index to leave the basis.
bool hyperPricingEnter
true if hyper sparse pricing is turned on in the entering Simplex
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.
const SVector & vector(int i) const
i 'th vector.
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.
void computePvec()
compute entire pVec().
void computeDualfarkas4Row(Real direction, SPxId enterId)
Status
Status of a variable.
SSVector * coSolveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
LP has been proven to be primal unbounded.
DIdxSet infeasibilitiesCo
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.
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.
void computeCoTest()
compute coTest vector.