49#define SOPLEX_HYPERPRICINGTHRESHOLD 5000
50#define SOPLEX_HYPERPRICINGSIZE 100
51#define SOPLEX_SPARSITYFACTOR 0.6
52#define SOPLEX_DENSEROUNDS 5
53#define SOPLEX_SPARSITY_TRADEOFF 0.8
56#define SOPLEX_MAXNCLCKSKIPS 32
57#define SOPLEX_SAFETYFACTOR 1e-2
58#define SOPLEX_NINITCALLS 200
70class SPxBoundFlippingRT;
650 const NameSet* rowNames,
const NameSet* colNames,
const bool cpxFormat =
false)
const;
658 const NameSet* colNames =
nullptr,
const bool cpxFormat =
false,
659 const bool writeZeroObjective =
false)
const;
675 virtual Status solve(
volatile bool* interrupt =
nullptr,
bool polish =
true);
873 this->entertolscale = d;
878 this->leavetolscale = d;
1045 virtual void changeObj(
int i,
const R& newVal,
bool scale =
false);
1083 virtual void changeLower(
int i,
const R& newLower,
bool scale =
false);
1095 virtual void changeUpper(
int i,
const R& newUpper,
bool scale =
false);
1104 bool scale =
false);
1106 virtual void changeBounds(
int i,
const R& newLower,
const R& newUpper,
bool scale =
false);
1119 virtual void changeLhs(
int i,
const R& newLhs,
bool scale =
false);
1131 virtual void changeRhs(
int i,
const R& newRhs,
bool scale =
false);
1140 bool scale =
false);
1142 virtual void changeRange(
int i,
const R& newLhs,
const R& newRhs,
bool scale =
false);
1273 ? (*thevectors)[this->
number(rid)]
1281 ? (*thevectors)[this->
number(cid)]
1316 ? (*thecovectors)[this->
number(rid)]
1324 ? (*thecovectors)[this->
number(cid)]
1371 return (stat *
rep() > 0);
1703 (*theUbound)[i] = to;
1711 (*theLbound)[i] = to;
1719 (*theCoUbound)[i] = to;
1727 (*theCoLbound)[i] = to;
1758 int start = 0,
int incr = 1);
1762 int start = 0,
int incr = 1);
2011 R& leaveMax, R& leavebound,
int& leaveNum,
StableSum<R>& objChange);
2014 R& enterBound, R& newUBbound,
2018 R& enterUB, R& enterLB, R& enterVal, R& enterMax,
2143 const int colsSize = -1)
const;
2227 return basis().iteration();
2321 std::stringstream s;
2322 s <<
basis().statistics()
2323 <<
"Solution time : " << std::setw(10) << std::fixed << std::setprecision(
2324 2) <<
time() << std::endl
2325 <<
"Iterations : " << std::setw(10) <<
iterations() << std::endl;
2338 return this->
rId(i);
2343 return this->
cId(i);
2408#include "spxsolver.hpp"
2409#include "spxsolve.hpp"
2410#include "changesoplex.hpp"
2413#include "spxshift.hpp"
2414#include "spxbounds.hpp"
2415#include "spxchangebasis.hpp"
2416#include "spxvecs.hpp"
2417#include "spxwritestate.hpp"
2418#include "spxfileio.hpp"
2419#include "spxquality.hpp"
Save arrays of arbitrary types.
Safe arrays of arbitrary types.
int info
user information to store values -1, 0, +1
bool isValid() const
returns TRUE, iff the DataKey is valid.
VectorBase< R > low
vector of lower bounds.
VectorBase< R > up
vector of upper bounds.
Sparse Linear Solver virtual base class.
const Desc & desc() const
void setStatus(SPxStatus stat)
sets basis SPxStatus to stat.
int iteration() const
returns number of basis changes since last load().
SPxStatus status() const
returns current SPxStatus.
Bound flipping ratio test ("long step dual") for SoPlex.
Fast shifting ratio test.
Generic Ids for LP rows or columns.
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
bool isSPxRowId() const
is id a row id?
Saving LPs in a form suitable for SoPlex.
const VectorBase< R > & rhs() const
Returns right hand side vector.
SPxSense spxSense() const
Returns the optimization sense.
const VectorBase< R > & lhs() const
Returns left hand side vector.
SPxSense
Optimization sense.
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
const LPColSetBase< R > * lpcolset() const
Returns the LP as an LPColSetBase.
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
virtual void clearRowObjs()
Clears row objective function values for all rows.
std::shared_ptr< Tolerances > _tolerances
SPxRowId rId(int n) const
Returns the row identifier for row n.
const LPRowSetBase< R > * lprowset() const
Returns the LP as an LPRowSetBase.
SPxColId cId(int n) const
Returns the column identifier for column n.
const VectorBase< R > & upper() const
Returns upper bound vector.
Wrapper for several output streams. A verbosity level is used to decide which stream to use and wheth...
Abstract pricer base class.
Abstract ratio test base class.
Sequential object-oriented SimPlex.
virtual void reLoad()
reload LP.
void setOutstream(SPxOut &newOutstream)
R objrange
absolute range of all objective coefficients in the problem
virtual void changeElement(int i, int j, const R &val, bool scale=false)
SPxId coId(int i) const
id of i 'th covector.
bool getDualNorms(int &nnormsRow, int &nnormsCol, R *norms) const
get dual norms
void scaleLeavetol(R d)
scale the leaving tolerance
virtual R terminationValue() const
return objective limit.
int boundflips
number of performed bound flips
void setSolverStatus(typename SPxSolverBase< R >::Status stat)
setting the solver status external from the solve loop.
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing
R entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
virtual void changeRange(int i, const R &newLhs, const R &newRhs, bool scale=false)
void resetClockStats()
resets clock average statistics
void shiftLPbound(int i, R to)
shift i 'th lpBound to to.
int storeBasisSimplexFreq
number of simplex pivots -1 to perform before storing stable basis
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
void shiftLCbound(int i, R to)
shift i 'th lcBound to to.
VectorBase< R > theUCbound
Upper Column Feasibility bound.
bool isCoId(const SPxId &p_id) const
Is p_id a CoId.
VectorBase< R > * theCoLbound
Lower bound for covars.
DSVectorBase< R > primalRay
stores primal ray in case of unboundedness
virtual void qualRedCostViolation(R &maxviol, R &sumviol) const
get violation of optimality criterion.
virtual void changeCol(SPxColId p_id, const LPColBase< R > &p_newCol, bool scale=false)
VectorBase< R > * theFrhs
@ PARTIAL
Partial pricing.
int iterations() const
get number of iterations of current solution.
virtual void changeElement(SPxRowId rid, SPxColId cid, const R &val, bool scale=false)
VectorBase< R > & lcBound()
lower bound for coPvec.
UpdateVector< R > * theFvec
int primalIterations()
return number of iterations done with primal algorithm
int printBasisMetric
printing the current basis metric in the log (-1: off, 0: condition estimate, 1: trace,...
const SPxPricer< R > * pricer() const
return loaded SPxPricer.
virtual void changeMaxObj(int i, const R &newVal, bool scale=false)
void updateFtest()
update basis feasibility test vector.
virtual void changeRhs(int i, const R &newRhs, bool scale=false)
bool isInitialized() const
has the internal data been initialized?
UpdateVector< R > * theCPvec
column pricing vector
virtual void doRemoveRows(int perm[])
virtual void changeSense(typename SPxLPBase< R >::SPxSense sns)
virtual bool terminate()
Termination criterion.
const VectorBase< R > & ucBound() const
void updateCoTest()
recompute coTest vector.
virtual void setTester(SPxRatioTester< R > *tester, const bool destroy=false)
setup ratio-tester to use. If destroy is true, tester will be freed in destructor.
VectorBase< R > theCoTest
bool isBasic(const SPxRowId &rid) const
is the rid 'th vector basic ?
int m_numViol
number of violations of current solution
bool freeRatioTester
true iff theratiotester should be freed inside of object
void setup4solve(SSVectorBase< R > *p_y, SSVectorBase< R > *p_rhs)
Setup vectors to be solved within Simplex loop.
bool isCoBasic(int i) const
is the i 'th covector basic ?
int multFullCalls
number of products ignoring sparsity
SPxStarter< R > * thestarter
virtual R value()
current objective value.
bool isBasic(const SPxColId &cid) const
is the cid 'th vector basic ?
SolutionPolish getSolutionPolishing()
return objective of solution polishing
bool solvingForBoosted
is this solver involved in a higher precision solving scheme?
R delta() const
guaranteed primal and dual bound violation for optimal solution, returning the maximum of floatingPoi...
Real theCumulativeTime
cumulative time spent in all calls to method solve()
VarStatus basisStatusToVarStatus(typename SPxBasisBase< R >::Desc::Status stat) const
converts basis status to VarStatus
int boundFlips() const
get number of bound flips.
virtual Status getPrimalSol(VectorBase< R > &vector) const
get solution vector for primal variables.
virtual void changeBounds(const VectorBase< R > &newLower, const VectorBase< R > &newUpper, bool scale=false)
DataArray< int > integerVariables
supplementary variable information, 0: continous variable, 1: integer variable
const VectorBase< R > & fTest() const
Violations of fVec.
virtual void setTerminationValue(R value=R(infinity))
set objective limit.
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
bool setDualNorms(int nnormsRow, int nnormsCol, R *norms)
set dual norms
virtual void computeFrhs1(const VectorBase< R > &, const VectorBase< R > &)
virtual R maxInfeas() const
maximal infeasibility of basis
SSVectorBase< R > * coSolveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
virtual void qualBoundViolation(R &maxviol, R &sumviol) const
get violations of bounds.
Pricing pricing() const
return current Pricing.
const SVSetBase< R > * thecovectors
the LP coVectors according to representation
void useFullPerturbation(bool full)
perturb entire problem or only the bounds relevant to the current pivot
virtual void changeMaxObj(SPxColId p_id, const R &p_newVal, bool scale=false)
overloading a virtual function
VarStatus getBasisColStatus(int col) const
gets basis status for a single column
virtual void changeObj(SPxColId p_id, const R &p_newVal, bool scale=false)
overloading a virtual function
SPxStarter< R > * starter() const
return current starter.
void setPrimalBounds()
setup feasibility bounds for entering algorithm
int nClckSkipsLeft
remaining number of times the clock can be safely skipped
void setup4solve2(SSVectorBase< R > *p_y2, SSVectorBase< R > *p_rhs2)
Setup vectors to be solved within Simplex loop.
int getDisplayFreq()
get display frequency
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
virtual void setStarter(SPxStarter< R > *starter, const bool destroy=false)
setup starting basis generator to use. If destroy is true, starter will be freed in destructor.
bool sparsePricingEnter
true if sparsePricing is turned on in the entering Simplex for slack variables
Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get current basis, and return solver status.
void getLhs(VectorBase< R > &p_lhs) const
copy lhs value VectorBase<R> to p_lhs.
virtual Status getSlacks(VectorBase< R > &vector) const
get VectorBase<R> of slack variables.
bool updateNonbasicValue(R objChange)
void hyperPricing(bool h)
enable or disable hyper sparse pricing
Random random
The random number generator used throughout the whole computation. Its seed can be modified.
void clearDualBounds(typename SPxBasisBase< R >::Desc::Status, R &, R &) const
bool isConsistent() const
check consistency.
virtual void changeCol(int i, const LPColBase< R > &newCol, bool scale=false)
virtual void perturbMaxEnter(void)
perturb basis bounds.
virtual void ungetEnterVal(SPxId enterId, typename SPxBasisBase< R >::Desc::Status enterStat, R leaveVal, const SVectorBase< R > &vec, StableSum< R > &objChange)
void setup4coSolve(SSVectorBase< R > *p_y, SSVectorBase< R > *p_rhs)
Setup vectors to be cosolved within Simplex loop.
SPxPricer< R > * thepricer
virtual void computeLeaveCoPrhs()
compute theCoPrhs for leaving Simplex.
bool isRowBasic(int i) const
is the i 'th row vector basic ?
int coDim() const
codimension.
bool isId(const SPxId &p_id) const
Is p_id an SPxId ?
virtual void perturbMinEnter(void)
virtual Status getRedCostSol(VectorBase< R > &vector) const
get vector of reduced costs.
DataArray< VarStatus > oldBasisStatusRows
stored stable basis met before a simplex pivot (used to warm start the solver)
DataArray< VarStatus > & getOldBasisStatusCols()
Representation theRep
row or column representation.
virtual bool precisionReached(R &newpricertol) const
is the solution precise enough, or should we increase delta() ?
virtual Real terminationTime() const
return time limit.
virtual void qualSlackViolation(R &maxviol, R &sumviol) const
get the residuum |Ax-b|.
virtual void changeRhs(const VectorBase< R > &newRhs, bool scale=false)
bool performSolutionPolishing()
void setSolvingForBoosted(bool value)
virtual void clearRowObjs()
R lastShift
for forcing feasibility.
virtual void setTolerances(std::shared_ptr< Tolerances > newTolerances)
set the _tolerances member variable
void resetCumulativeTime()
reset cumulative time counter to zero.
SPxOut * spxout
message handler
bool isTimeLimitReached(const bool forceCheck=false)
returns whether current time limit is reached; call to time() may be skipped unless forceCheck is tru...
UpdateVector< R > & pVec() const
pricing vector.
void setMemFactor(R f)
set refactor threshold for memory growth in current factor update compared to the last factorization
int enterCount
number of ENTER iterations
R m_nonbasicValue
nonbasic part of current objective value
void setDisplayFreq(int freq)
set display frequency
R leavetolscale
factor to temporarily decrease the leaving tolerance
void forceRecompNonbasicValue()
R siderange
absolute range of all side in the problem
R primalDegenSum
the sum of the primal degeneracy percentage
virtual void changeLhs(SPxRowId p_id, const R &p_newLhs, bool scale=false)
int multColwiseCalls
number of products, columnwise multiplication
void setSparsePricingFactor(R fac)
const SVectorBase< R > & vector(const SPxRowId &rid) const
void setup4coSolve2(SSVectorBase< R > *p_z, SSVectorBase< R > *p_rhs)
Setup vectors to be cosolved within Simplex loop.
SPxBasisBase< R >::SPxStatus getBasisStatus() const
gets basis status
const SVectorBase< R > & vector(const SPxId &p_id) const
VectorBase<R> associated to p_id.
void setRep(Representation p_rep)
switch to ROW or COLUMN representation if not already used.
virtual void reinitializeVecs()
setup all vecs fresh
SPxRowId rowId(int i) const
RowId of i 'th inequality.
const SVectorBase< R > & coVector(int i) const
i 'th covector of LP.
bool freeStarter
true iff thestarter should be freed inside of object
UpdateVector< R > * theRPvec
row pricing vector
R dualDegenSum
the sum of the dual degeneracy percentage
bool freePricer
true iff thepricer should be freed inside of object
DataArray< VarStatus > & getOldBasisStatusRows()
virtual Status solve(volatile bool *interrupt=nullptr, bool polish=true)
solve loaded LP.
void setMetricInformation(int type)
print basis metric within the usual output
virtual void setEnterBounds()
R coTest(int i, typename SPxBasisBase< R >::Desc::Status stat) const
test coVector i with status stat.
bool sparsePricingLeave
These values enable or disable sparse pricing.
int totalboundflips
total number of bound flips
int remainingRoundsEnterCo
void setRedCost(VectorBase< R > &p_vector)
virtual const SVectorBase< R > * enterVector(const SPxId &p_id)
Get pointer to the id 'th vector.
void computePvec()
compute entire pVec().
void computeTest()
compute test VectorBase<R> in ENTERing Simplex.
VectorBase< R > & ucBound()
upper bound for coPvec.
void invalidateBasis()
invalidates the basis, triggers refactorization
virtual void setLeaveBounds()
virtual void changeUpper(int i, const R &newUpper, bool scale=false)
virtual void changeLowerStatus(int i, R newLower, R oldLower=0.0)
VarStatus getBasisRowStatus(int row) const
gets basis status for a single row
virtual void getEnterVals(SPxId id, R &enterTest, R &enterUB, R &enterLB, R &enterVal, R &enterMax, R &enterPric, typename SPxBasisBase< R >::Desc::Status &enterStat, R &enterRO, StableSum< R > &objChange)
const SVSetBase< R > * thevectors
the LP vectors according to representation
int leaveCount
number of LEAVE iterations
Timer * theTime
time spent in last call to method solve()
void computeCoTest()
compute coTest vector.
bool m_nonbasicValueUpToDate
true, if the stored objValue is up to date
@ RUNNING
algorithm is running
@ OPTIMAL
LP has been solved to optimality.
@ INFEASIBLE
LP has been proven to be primal infeasible.
@ NO_PROBLEM
No Problem has been loaded.
@ ABORT_VALUE
solve() aborted due to objective limit.
@ ABORT_CYCLING
solve() aborted due to detection of cycling.
@ NO_PRICER
No pricer loaded.
@ UNBOUNDED
LP has been proven to be primal unbounded.
@ UNKNOWN
nothing known on loaded problem.
@ OPTIMAL_UNSCALED_VIOLATIONS
LP has beed solved to optimality but unscaled solution contains violations.
@ ABORT_ITER
solve() aborted due to iteration limit.
@ INForUNBD
LP is primal infeasible or unbounded.
@ ABORT_TIME
solve() aborted due to time limit.
@ NO_RATIOTESTER
No ratiotester loaded.
@ NOT_INIT
not initialised error
@ NO_SOLVER
No linear solver loaded.
@ SINGULAR
Basis is singular, numerical troubles?
@ REGULAR
LP has a usable Basis (maybe LP is changed).
SPxId id(int i) const
id of i 'th vector.
SPxSolverBase(Type type=LEAVE, Representation rep=ROW, Timer::TYPE ttype=Timer::USER_TIME)
default constructor.
DIdxSet infeasibilitiesCo
virtual void setupPupdate(void)
R m_pricingViol
maximal feasibility violation of current solution
virtual void changeObj(const VectorBase< R > &newObj, bool scale=false)
scale determines whether the new data needs to be scaled according to the existing LP (persistent sca...
virtual R objValue()
get objective value of current solution.
void setDual(VectorBase< R > &p_vector)
SPxBasisBase< R >::Desc::Status covarStatus(int i) const
Status of i 'th covariable.
R perturbMin(const UpdateVector< R > &uvec, VectorBase< R > &low, VectorBase< R > &up, R eps, R delta, const typename SPxBasisBase< R >::Desc::Status *stat, int start, int incr)
bool enter(SPxId &id, bool polish=false)
void setEnterBound4Row(int, int)
void computeDualfarkas4Row(R direction, SPxId enterId)
const VectorBase< R > & coTest() const
violations of coPvec.
virtual bool read(std::istream &in, NameSet *rowNames=nullptr, NameSet *colNames=nullptr, DIdxSet *intVars=nullptr)
read LP from input stream.
void getRhs(VectorBase< R > &p_rhs) const
copy rhs value VectorBase<R> to p_rhs.
Real maxTime
maximum allowed time.
R sparsePricingFactor
enable sparse pricing when viols < factor * dim()
virtual void factorize()
Factorize basis matrix.
Representation rep() const
return the current basis representation.
Timer::TYPE getTiming()
set timing type
int multSparseCalls
number of products exploiting sparsity
void calculateProblemRanges()
determine ranges of problem values for bounds, sides and objective to assess numerical difficulties
bool isColBasic(int i) const
is the i 'th column vector basic ?
Real time() const
time spent in last call to method solve().
virtual void doRemoveCols(int perm[])
bool isTerminationValueEnabled() const
true if objective limit should be used in the next solve
virtual void changeUpper(SPxColId p_id, const R &p_newUpper, bool scale=false)
overloading virtual function
R sumPrimalDegeneracy()
get the sum of primal degeneracy
virtual void changeRowObj(int i, const R &newVal, bool scale=false)
R getDegeneracyLevel(VectorBase< R > degenvec)
get level of dual degeneracy
const SLinSolver< R > * slinSolver() const
return loaded SLinSolver.
void computeEnterCoPrhs4Row(int i, int n)
const VectorBase< R > & lpBound() const
virtual void setBasisSolver(SLinSolver< R > *slu, const bool destroy=false)
setup linear solver to use. If destroy is true, slusolver will be freed in destructor.
void setFillFactor(R f)
set refactor threshold for fill-in in current factor update compared to fill-in in last factorization
int numCycle() const
actual number of degenerate simplex steps encountered so far.
void unscaleLPandReloadBasis()
unscales the LP and reloads the basis
virtual void loadLP(const SPxLPBase< R > &LP, bool initSlackBasis=true)
copy LP.
virtual void changeLower(SPxColId p_id, const R &p_newLower, bool scale=false)
SPxColId colId(int i) const
ColId of i 'th column.
bool isBasic(int i) const
is the i 'th vector basic ?
virtual void changeRange(SPxRowId p_id, const R &p_newLhs, const R &p_newRhs, bool scale=false)
UpdateVector< R > & fVec() const
feasibility vector.
VectorBase< R > & upBound()
upper bound for pVec.
@ BASIC
variable is basic.
@ ON_LOWER
variable set to its lower bound.
@ ON_UPPER
variable set to its upper bound.
@ UNDEFINED
nothing known about basis status (possibly due to a singular basis in transformed problem)
@ FIXED
variable fixed to identical bounds.
@ ZERO
free variable fixed to zero.
int subversion() const
return the internal subversion of SPxSolverBase as number
virtual void changeMaxObj(const VectorBase< R > &newObj, bool scale=false)
virtual void changeRange(const VectorBase< R > &newLhs, const VectorBase< R > &newRhs, bool scale=false)
const SVectorBase< R > & coVector(const SPxId &p_id) const
coVector associated to p_id.
R computePvec(int i)
compute and return pVec()[i].
Type theType
entering or leaving algortihm.
Timer::TYPE timerType
type of timer (user or wallclock)
void scaleEntertol(R d)
scale the entering tolerance
DSVectorBase< R > dualFarkas
stores dual farkas proof in case of infeasibility
void setNonzeroFactor(R f)
set refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix
void computeFrhs()
compute feasibility vector from scratch.
bool useTerminationValue
true, if objective limit should be used in the next solve.
VectorBase< R > coWeights
store dual norms
void scaleTolerances(R d)
R perturbMax(const UpdateVector< R > &uvec, VectorBase< R > &low, VectorBase< R > &up, R eps, R delta, const typename SPxBasisBase< R >::Desc::Status *stat, int start, int incr)
R nonbasicValue()
Compute part of objective value.
virtual void changeUpper(const VectorBase< R > &newUpper, bool scale=false)
virtual void setPricer(SPxPricer< R > *pricer, const bool destroy=false)
setup pricer to use. If destroy is true, pricer will be freed in destructor.
SSVectorBase< R > * coSolveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
SPxSolverBase(const SPxSolverBase< R > &base)
copy constructor
virtual bool noViols(R tol) const
check for violations above tol and immediately return false w/o checking the remaining values
Timer * multTimeColwise
time spent in setupPupdate(), columnwise multiplication
virtual void init()
intialize data structures.
SSVectorBase< R > * solveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
void shiftUBbound(int i, R to)
shift i 'th ubBound to to.
UpdateVector< R > * theCoPvec
void setType(Type tp)
set LEAVE or ENTER algorithm.
Status m_status
status of algorithm.
const SPxRatioTester< R > * ratiotester() const
return loaded SPxRatioTester.
int dualIterations()
return number of iterations done with primal algorithm
SolutionPolish polishObj
objective of solution polishing
virtual void computeEnterCoPrhs()
compute theCoPrhs for entering Simplex.
const SVectorBase< R > & coVector(const SPxColId &cid) const
R test(int i, typename SPxBasisBase< R >::Desc::Status stat) const
test VectorBase<R> i with status stat.
const SPxBasisBase< R > & basis() const
Return current basis.
bool fullPerturbation
whether to perturb the entire problem or just the bounds relevant for the current pivot
virtual void factorizeAndRecompute()
const SVectorBase< R > & vector(const SPxColId &cid) const
bool leave(int i, bool polish=false)
virtual void perturbMinLeave(void)
int maxIters
maximum allowed iterations.
bool sparsePricingEnterCo
true if sparsePricing is turned on in the entering Simplex
int version() const
return the version of SPxSolverBase as number like 123 for 1.2.3
Status getResult(R *value=0, VectorBase< R > *primal=0, VectorBase< R > *slacks=0, VectorBase< R > *dual=0, VectorBase< R > *reduCost=0)
get all results of last solve.
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
get number of dual norms
R epsilon() const
values are considered to be 0.
virtual void reDim()
reset dimensions of vectors according to loaded LP.
void setPricing(Pricing pr)
set FULL or PARTIAL pricing.
void setEnterBound4Col(int, int)
VectorBase< R > & lbBound()
lower bound for fVec, writable.
DataArray< int > isInfeasibleCo
0: index not violated, 1: index violated, 2: index violated and among candidate list
void localAddCols(int start)
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list
SSVectorBase< R > * solveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
void computeFtest()
compute basis feasibility test vector.
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
void setSlacks(VectorBase< R > &p_vector)
Timer * multTimeFull
time spent in setupPupdate() ignoring sparsity
virtual void unInit()
uninitialize data structures.
void setLeaveBound4Row(int i, int n)
int maxCycle() const
maximum number of degenerate simplex steps before we detect cycling.
virtual void changeLower(int i, const R &newLower, bool scale=false)
void setStoreBasisFreqForBoosting(int freq)
void localAddRows(int start)
SSVectorBase< R > * solveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
int polishCount
number of solution polishing iterations
int primalCount
number of primal iterations
bool recomputedVectors
flag to perform clean up step to reduce numerical errors only once
UpdateVector< R > primVec
primal vector
int polishIterations()
return number of iterations done with primal algorithm
VectorBase< R > & lpBound()
lower bound for pVec.
virtual void clear()
clear all data in solver.
int dim() const
dimension of basis matrix.
int leaveDegenCand
the number of degenerate candidates in the leaving algorithm
SolutionPolish
objective for solution polishing
@ POLISH_INTEGRALITY
maximize number of basic slack variables, i.e. more variables on bounds
@ POLISH_OFF
don't perform modifications on optimal basis
@ POLISH_FRACTIONALITY
minimize number of basic slack variables, i.e. more variables in between bounds
int m_numCycle
actual number of degenerate steps so far.
void shiftUCbound(int i, R to)
shift i 'th ucBound to to.
void perturbMax(const UpdateVector< R > &vec, VectorBase< R > &low, VectorBase< R > &up, R eps, R delta, int start=0, int incr=1)
const LPRowSetBase< R > & rows() const
return const lp's rows if available.
SPxBasisBase< R >::Desc::Status varStatusToBasisStatusCol(int col, VarStatus stat) const
converts VarStatus to basis status for columns
SPxBasisBase< R > & basis()
VectorBase< R > theLCbound
Lower Column Feasibility bound.
int m_maxCycle
maximum steps before cycling is detected.
virtual void printDisplayLine(const bool force=false, const bool forceHead=false)
print display line of flying table
void computeDualfarkas4Col(R direction)
virtual Status getDualfarkas(VectorBase< R > &vector) const
get dual farkas proof of infeasibility.
void setSolutionPolishing(SolutionPolish _polishObj)
set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack)
void toggleTerminationValue(bool enable)
toggle objective limit for next solve
virtual void changeLhs(int i, const R &newLhs, bool scale=false)
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver's basis.
R sumDualDegeneracy()
get the sum of dual degeneracy
void updateTest()
recompute test vector.
virtual void setTerminationTime(Real time=infinity)
set time limit.
SPxBasisBase< R >::Desc::Status varStatusToBasisStatusRow(int row, VarStatus stat) const
converts VarStatus to basis status for rows
VectorBase< R > * theCoUbound
Upper bound for covars.
VectorBase< R > weights
dual pricing norms
void computeLeaveCoPrhs4Row(int i, int n)
const SVectorBase< R > & coVector(const SPxRowId &rid) const
virtual void changeRow(int i, const LPRowBase< R > &newRow, bool scale=false)
VectorBase< R > theLRbound
Lower Row Feasibility bound.
VectorBase< R > dualRhs
rhs VectorBase<R> for computing the dual vector
const VectorBase< R > & lbBound() const
lower bound for fVec.
void setPrimal(VectorBase< R > &p_vector)
virtual void changeBounds(int i, const R &newLower, const R &newUpper, bool scale=false)
bool weightsAreSetup
are the dual norms already set up?
virtual void setTerminationIter(int iteration=-1)
set iteration limit.
int enterCycles
the number of degenerate steps during the entering algorithm
virtual void changeLower(const VectorBase< R > &newLower, bool scale=false)
void getUpper(VectorBase< R > &p_up) const
copy upper bound VectorBase<R> to p_up.
UpdateVector< R > & coPvec() const
copricing vector.
SSVectorBase< R > * coSolveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
virtual void changeLhs(const VectorBase< R > &newLhs, bool scale=false)
bool hyperPricingEnter
true if hyper sparse pricing is turned on in the entering Simplex
UpdateVector< R > addVec
storage for thePvec = &addVec
R objLimit
< the number of calls to the method isTimeLimitReached()
virtual bool writeState(const char *filename, const NameSet *rowNames=nullptr, const NameSet *colNames=nullptr, const bool cpxFormat=false, const bool writeZeroObjective=false) const
VectorBase< R > * theLbound
Lower bound for vars.
SPxSolverBase< R > & operator=(const SPxSolverBase< R > &base)
assignment operator
SPxRatioTester< R > * theratiotester
SSVectorBase< R > * solveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
virtual void changeUpperStatus(int i, R newUpper, R oldLower=0.0)
void setLeaveBound4Col(int i, int n)
VectorBase< R > theURbound
Upper Row Feasibility bound.
bool isBasisValid(DataArray< VarStatus > rows, DataArray< VarStatus > cols)
check a given basis for validity.
virtual void rejectEnter(SPxId enterId, R enterTest, typename SPxBasisBase< R >::Desc::Status enterStat)
R entertolscale
factor to temporarily decrease the entering tolerance
VectorBase< R > primRhs
rhs VectorBase<R> for computing the primal vector
int dualDegeneratePivots()
get number of dual degenerate pivots
Pricing thePricing
full or partial pricing.
const VectorBase< R > & ubBound() const
upper bound for fVec.
int getMaxIters()
the maximum number of iterations
std::string statistics() const
returns statistical information in form of a string.
virtual bool readBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
void shiftLBbound(int i, R to)
shift i 'th lbBound to to.
SPxBasisBase< R >::Desc::Status varStatus(int i) const
Status of i 'th variable.
SPxLPBase< R >::SPxSense sense() const
optimization sense.
virtual void rejectLeave(int leaveNum, SPxId leaveId, typename SPxBasisBase< R >::Desc::Status leaveStat, const SVectorBase< R > *newVec=nullptr)
R computeTest(int i)
compute and return test()[i] in ENTERing Simplex.
const VectorBase< R > & lcBound() const
virtual void changeLhsStatus(int i, R newLhs, R oldLhs=0.0)
virtual void changeRowObj(const VectorBase< R > &newObj, bool scale=false)
const VectorBase< R > & test() const
Violations of pVec.
const VectorBase< R > & upBound() const
Status status() const
Status of solution process.
const SVectorBase< R > & vector(int i) const
i 'th vector.
bool m_pricingViolUpToDate
true, if the stored violation is up to date
int primalDegeneratePivots()
get number of primal degenerate pivots
virtual void unShift(void)
remove shift as much as possible.
Type type() const
return current Type.
virtual R shift() const
total current shift amount.
int multUnsetupCalls
number of products w/o sparsity information
VectorBase< R > & ubBound()
upper bound for fVec, writable.
void getLower(VectorBase< R > &p_low) const
copy lower bound VectorBase<R> to p_low.
DataArray< VarStatus > oldBasisStatusCols
They don't have setters because only the internal simplex method is meant to fill them.
Timer * multTimeUnsetup
time spent in setupPupdate() w/o sparsity information
Array< UnitVectorBase< R > > unitVecs
array of unit vectors
SSVectorBase< R > * coSolveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
void computePrimalray4Col(R direction, SPxId enterId)
UpdateVector< R > * thePvec
void computePrimalray4Row(R direction)
virtual void clearUpdateVecs(void)
R theShift
sum of all shifts applied to any bound.
void setIntegralityInformation(int ncols, int *intInfo)
pass integrality information about the variables to the solver
virtual void getLeaveVals(int i, typename SPxBasisBase< R >::Desc::Status &leaveStat, SPxId &leaveId, R &leaveMax, R &leavebound, int &leaveNum, StableSum< R > &objChange)
const VectorBase< R > & coPrhs() const
Right-hand side vector for coPvec.
R boundrange
absolute range of all bounds in the problem
virtual void doPupdate(void)
virtual void addedCols(int n)
R m_pricingViolCo
maximal feasibility violation of current solution in coDim
void computeLeaveCoPrhs4Col(int i, int n)
virtual void addedRows(int n)
virtual void getEnterVals2(int leaveIdx, R enterMax, R &leaveBound, StableSum< R > &objChange)
bool isBasic(typename SPxBasisBase< R >::Desc::Status stat) const
does stat describe a basic index ?
bool isBasic(const SPxId &p_id) const
is the p_id 'th vector basic ?
int enterDegenCand
the number of degenerate candidates in the entering algorithm
virtual void computeFrhsXtra()
void setTiming(Timer::TYPE ttype)
set timing type
const SVectorBase< R > & unitVector(int i) const
return i 'th unit vector.
const std::shared_ptr< Tolerances > & tolerances() const
returns current tolerances
virtual void changeBounds(SPxColId p_id, const R &p_newLower, const R &p_newUpper, bool scale=false)
bool initialized
true, if all vectors are setup.
R leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
virtual void doRemoveCol(int i)
void setBasisStatus(typename SPxBasisBase< R >::SPxStatus stat)
set the lp solver's basis status.
void shiftUPbound(int i, R to)
shift i 'th upBound to to.
void computeFrhs2(VectorBase< R > &, VectorBase< R > &)
VectorBase< R > * theUbound
Upper bound for vars.
virtual void changeRow(SPxRowId p_id, const LPRowBase< R > &p_newRow, bool scale=false)
virtual void qualConstraintViolation(R &maxviol, R &sumviol) const
get violation of constraints.
virtual void changeObj(int i, const R &newVal, bool scale=false)
const LPColSet & cols() const
return const lp's cols if available.
virtual Status getPrimalray(VectorBase< R > &vector) const
get primal ray in case of unboundedness.
virtual void loadBasis(const typename SPxBasisBase< R >::Desc &)
set a start basis.
Representation
LP basis representation.
@ ROW
rowwise representation.
@ COLUMN
columnwise representation.
void perturbMin(const UpdateVector< R > &vec, VectorBase< R > &low, VectorBase< R > &up, R eps, R delta, int start=0, int incr=1)
int leaveCycles
the number of degenerate steps during the leaving algorithm
Real cumulativeTime() const
cumulative time spent in all calls to method solve().
virtual void doRemoveRow(int i)
void initRep(Representation p_rep)
initialize ROW or COLUMN representation.
virtual R getBasisMetric(int type)
virtual void changeRhsStatus(int i, R newRhs, R oldRhs=0.0)
UpdateVector< R > dualVec
dual vector
virtual Status getDualSol(VectorBase< R > &vector) const
get current solution VectorBase<R> for dual variables.
virtual void changeRhs(SPxRowId p_id, const R &p_newRhs, bool scale=false)
void computeEnterCoPrhs4Col(int i, int n)
virtual int terminationIter() const
return iteration limit.
int remainingRoundsLeave
number of dense rounds/refactorizations until sparsePricing is enabled again
VectorBase< R > theUBbound
Upper Basic Feasibility bound.
bool m_pricingViolCoUpToDate
true, if the stored violation in coDim is up to date
const VectorBase< R > & fRhs() const
right-hand side vector for fVec
VectorBase< R > theLBbound
Lower Basic Feasibility bound.
VectorBase< R > * theCoPrhs
Real getMaxTime()
the maximum runtime
virtual void changeRowObj(SPxRowId p_id, const R &p_newVal, bool scale=false)
virtual bool writeBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames, const bool cpxFormat=false) const
virtual void getLeaveVals2(R leaveMax, SPxId enterId, R &enterBound, R &newUBbound, R &newLBbound, R &newCoPrhs, StableSum< R > &objChange)
Timer * multTimeSparse
time spent in setupPupdate() exploiting sparsity
SoPlex start basis generation base class.
static Timer * switchTimer(Timer *timer, Timer::TYPE ttype)
Wrapper for the system time query methods.
virtual TYPE type()=0
return type of timer
virtual Real time() const =0
Dense Vector with semi-sparse Vector for updates.
void setTolerances(std::shared_ptr< Tolerances > &tolerances)
set tolerances
Everything should be within this namespace.
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
SPxSolverBase< Real > SPxSolver
SOPLEX_THREADLOCAL const Real infinity
Debugging, floating point type and parameter definitions.
#define SOPLEX_SUBVERSION
Saving LPs in a form suitable for SoPlex.
Saving LPs in a form suitable for SoPlex.
Dense VectorBase<R> with semi-sparse VectorBase<R> for updates.