28 #define MAX_RELAX_COUNT 2 29 #define LONGSTEP_FREQ 100 50 for(
int i = 0; i < nflips; ++i)
81 range = lower - upper;
90 range = upper - lower;
103 <<
" lower: " << lower
104 <<
" upper: " << upper
109 MSG_DEBUG(std::cout <<
"PVEC flipped from: " << stat
113 <<
" lower: " << lower
114 <<
" upper: " << upper
119 assert(
spxAbs(range) < 1e20);
136 range = lower - upper;
145 range = upper - lower;
158 <<
" lower: " << lower
159 <<
" upper: " << upper
164 MSG_DEBUG(std::cout <<
"COPVEC flipped from: " << stat
168 <<
" lower: " << lower
169 <<
" upper: " << upper
174 assert(
spxAbs(range) < 1e20);
186 if(baseId.isSPxRowId())
197 range = upper - lower;
205 range = lower - upper;
217 <<
" lower: " << lower
218 <<
" upper: " << upper
225 assert(baseId.isSPxColId());
235 range = upper - lower;
243 range = lower - upper;
255 <<
" lower: " << lower
256 <<
" upper: " << upper
262 MSG_DEBUG(std::cout <<
"basic row/col flipped from: " << stat
266 <<
" lower: " << lower
267 <<
" upper: " << upper
270 assert(
spxAbs(range) < 1e20);
319 for(; idx < last; ++idx)
328 Real y = upp[i] - vec[i];
349 Real y = low[i] - vec[i];
395 for(; idx < last; ++idx)
404 Real y = low[i] - vec[i];
426 Real y = upp[i] - vec[i];
478 val = (max * x > 0) ? upp[idx] : low[idx];
479 val = (val - vec[idx]) / x;
481 if(upp[idx] == low[idx])
485 if(vec[idx] > upp[idx])
492 else if((max > 0 && val < -degeneps) || (max < 0 && val > degeneps))
512 val = (max * x > 0.0) ? upp[idx] : low[idx];
513 val = (val - vec[idx]) / x;
515 if(upp[idx] == low[idx])
519 if(vec[idx] > upp[idx])
526 else if((max > 0 && val < -degeneps) || (max < 0 && val > degeneps))
566 val = (max * x > 0) ? upp[idx] : low[idx];
567 val = (val - vec[idx]) / x;
569 if(upp[idx] == low[idx])
575 else if((max > 0 && val < -degeneps) || (max < 0 && val > degeneps))
604 MSG_DEBUG(std::cout <<
"DLBFRT06 resetting long step history" << std::endl;)
610 MSG_DEBUG(std::cout <<
"DLBFRT07 switching to fast ratio test" << std::endl;)
709 for(npassedBp = 0; npassedBp < nBp && slope > 0; ++npassedBp)
712 if(npassedBp > sorted)
734 if(absupd > moststable)
753 if(absupd > moststable)
760 assert(npassedBp >= 0);
763 if(slope >
delta && npassedBp >= nBp - 1)
766 <<
": unboundedness in ratio test" << std::endl;)
774 <<
": number of flip candidates: " 783 for(stableBp = npassedBp + 1; stableBp < nBp; ++stableBp)
785 Real stableDelta = 0;
788 if(stableBp > sorted)
807 if(
spxAbs(x) > moststable)
810 stableDelta = (x > 0.0) ? upb[idx] : lpb[idx];
811 stableDelta = (stableDelta - pvec[idx]) / x;
813 if(stableDelta <= bestDelta)
832 if(
spxAbs(x) > moststable)
834 stableDelta = (x > 0.0) ? ucb[idx] : lcb[idx];
835 stableDelta = (stableDelta - cvec[idx]) / x;
837 if(stableDelta <= bestDelta)
846 if(stableDelta >
delta + bestDelta)
856 bool foundStable =
false;
861 if(moststable > stab)
868 foundStable =
getData(val, enterId, idx, stab, degeneps, pupd, pvec, lpb, upb,
PVEC, max);
870 foundStable =
getData(val, enterId, idx, stab, degeneps, cupd, cvec, lcb, ucb,
COPVEC, max);
877 while(!foundStable && npassedBp >= 0)
885 foundStable =
getData(val, enterId, idx, stab, degeneps, pupd, pvec, lpb, upb,
PVEC, max);
887 foundStable =
getData(val, enterId, idx, stab, degeneps, cupd, cvec, lcb, ucb,
COPVEC, max);
904 <<
": no valid enterId found - relaxing..." 917 <<
" no valid enterId found - breaking..." 949 <<
" number of candidates: " 968 MSG_DEBUG(std::cout <<
"DEBFRT06 resetting long step history" << std::endl;)
975 MSG_DEBUG(std::cout <<
"DEBFRT07 switching to fast ratio test" << std::endl;)
1046 assert(minIdx >= 0);
1054 slope =
spxAbs(enterTest);
1074 for(npassedBp = 0; npassedBp < nBp && slope > 0; ++npassedBp)
1077 if(npassedBp > sorted)
1103 slope -= (upper * absupd) - (lower * absupd);
1106 if(absupd > moststable)
1107 moststable = absupd;
1111 assert(npassedBp >= 0);
1114 if(slope >
delta && npassedBp >= nBp - 1)
1117 <<
": unboundedness in ratio test" << std::endl;)
1125 <<
": number of flip candidates: " 1134 for(stableBp = npassedBp + 1; stableBp < nBp; ++stableBp)
1136 Real stableDelta = 0;
1139 if(stableBp > sorted)
1146 Real x = upd[breakpointidx];
1148 if(
spxAbs(x) > moststable)
1150 stableDelta = (x > 0.0) ? ub[breakpointidx] : lb[breakpointidx];
1151 stableDelta = (stableDelta - vec[breakpointidx]) / x;
1153 if(stableDelta <= bestDelta)
1160 else if(stableDelta >
delta + bestDelta)
1170 bool foundStable =
false;
1175 if(moststable > stab)
1179 assert(breakpointidx >= 0);
1180 foundStable =
getData(val, leaveIdx, breakpointidx, moststable, degeneps, upd, vec, lb, ub,
FVEC,
1188 while(!foundStable && npassedBp >= 0)
1193 if(breakpointidx >= 0)
1195 foundStable =
getData(val, leaveIdx, breakpointidx, moststable, degeneps, upd, vec, lb, ub,
FVEC,
1207 assert(leaveIdx < 0);
1213 <<
": no valid leaveIdx found - relaxing..." 1226 <<
" no valid leaveIdx found - breaking..." 1256 <<
": selected Index: " 1258 <<
" number of candidates: " const VectorBase< R > & rhs() const
Returns right hand side vector.
Rational spxAbs(const Rational &r)
Absolute.
SPxId coId(int i) const
id of i 'th covector.
const Vector & ucBound() const
int iteration() const
returns number of basis changes since last load().
void collectBreakpointsMax(int &nBp, int &minIdx, const int *idx, int nnz, const Real *upd, const Real *vec, const Real *upp, const Real *low, BreakpointSource src)
bool isSetup() const
Returns setup status.
int boundflips
number of performed bound flips
const VectorBase< R > & upper() const
Returns upper bound vector.
const Vector & fTest() const
Violations of fVec.
SPxOut * spxout
message handler
THREADLOCAL const Real infinity
DVector * theUbound
Upper bound for vars.
DVector * theCoUbound
Upper bound for covars.
Real delta
allowed bound violation
Status & rowStatus(int i)
virtual int selectLeave(Real &val, Real enterTest, bool polish=false)
Real fastDelta
currently allowed infeasibility.
void setValue(int i, R x)
Sets i 'th element to x.
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
virtual int selectLeave(Real &val, Real, bool polish=false)
const Vector & lcBound() const
int dim() const
dimension of basis matrix.
void shiftLBbound(int i, Real to)
shift i 'th lbBound to to.
Real epsilon
|value| < epsilon is considered 0.
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
void relax()
relaxes stability requirements.
Desc::Status dualStatus(const SPxColId &id) const
dual Status for the column variable with ID id of the loaded LP.
void collectBreakpointsMin(int &nBp, int &minIdx, const int *idx, int nnz, const Real *upd, const Real *vec, const Real *upp, const Real *low, BreakpointSource src)
const R * get_const_ptr() const
Conversion to C-style pointer.
Wrapper for different output streams and verbosity levels.
const Vector & ubBound() const
upper bound for fVec.
Real minStability(Real maxabs)
Compute stability requirement.
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.
void resetTols()
resets tolerances (epsilon).
const R * values() const
Returns array values.
void shiftLPbound(int i, Real to)
shift i 'th lpBound to to.
Row and columns Id's SPxLP.
DVector * theLbound
Lower bound for vars.
const Vector & lbBound() const
lower bound for fVec.
SPxId id(int i) const
id of i 'th vector.
UpdateVector & fVec() const
feasibility vector.
bool isSPxColId() const
is id a column id?
DVector theLBbound
Lower Basic Feasibility bound.
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
const VectorBase< R > & lhs() const
Returns left hand side vector.
void clear()
Clears vector.
void shiftUCbound(int i, Real to)
shift i 'th ucBound to to.
bool updateNonbasicValue(Real objChange)
DVector theURbound
Upper Row Feasibility bound.
virtual SPxId selectEnter(Real &val, int leaveIdx, bool polish=false)
SSVectorBase< R > & multAdd(S xx, const SVectorBase< T > &vec)
Addition of a scaled vector.
void shiftUBbound(int i, Real to)
shift i 'th ubBound to to.
Status & colStatus(int i)
Generic QuickSort implementation.
const int * indexMem() const
Returns array indices.
DVector theUBbound
Upper Basic Feasibility bound.
Bound flipping ratio test (long step dual) for SoPlex.
DVector * theCoLbound
Lower bound for covars.
void reDim(int newdim)
Resets dimension to newdim.
Debugging, floating point type and parameter definitions.
void clearIdx(int i)
Clears element i.
UpdateVector & pVec() const
pricing vector.
SPxSolver * thesolver
the solver
const Vector & lpBound() const
DVector theLRbound
Lower Row Feasibility bound.
DVector theUCbound
Upper Column Feasibility bound.
int size() const
Returns the number of nonzeros.
Everything should be within this namespace.
void shiftUPbound(int i, Real to)
shift i 'th upBound to to.
void shiftLCbound(int i, Real to)
shift i 'th lcBound to to.
void tighten()
tightens stability requirements.
#define MSG_WARNING(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::WARNING.
primal variable is set to its lower bound
bool getData(Real &val, SPxId &enterId, int idx, Real stab, Real degeneps, const Real *upd, const Real *vec, const Real *low, const Real *upp, BreakpointSource src, Real max)
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
DVector theLCbound
Lower Column Feasibility bound.
int leaveCount
number of LEAVE iterations
int SPxQuicksortPart(T *keys, COMPARATOR &compare, int start, int end, int size, int start2=0, int end2=0, bool type=true)
Generic implementation of Partial QuickSort.
const Vector & upBound() const
virtual SPxId selectEnter(Real &val, int, bool polish=false)
bool isSPxRowId() const
is id a row id?
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
Real theShift
sum of all shifts applied to any bound.
void flipAndUpdate(int &usedBp)
DataArray< Breakpoint > breakpoints
int enterCount
number of ENTER iterations
bool isCoBasic(int i) const
is the i 'th covector basic ?
dual variable has two bounds
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
const SVector & vector(int i) const
i 'th vector.
SSVector & delta()
update vector , writeable
const SPxBasis & basis() const
Return current basis.
void setup4solve2(SSVector *p_y2, SSVector *p_rhs2)
Setup vectors to be solved within Simplex loop.
Status
Status of a variable.
void add(int i, R x)
Adds nonzero (i, x) to SSVectorBase.
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
SPxSolver::Type m_type
internal storage of type
const Desc & desc() const
Representation rep() const
return the current basis representation.
columnwise representation.
void setup4coSolve2(SSVector *p_z, SSVector *p_rhs)
Setup vectors to be cosolved within Simplex loop.