Scippy

SoPlex

Sequential object-oriented simPlex

solvereal.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 #include <iostream>
17 #include <assert.h>
18 
19 #include "soplex.h"
20 #include "soplex/statistics.h"
21 
22 #define ALLOWED_UNSCALE_PERCENTAGE 0.1
23 #define MIN_OPT_CALLS_WITH_SCALING 10
24 
25 namespace soplex
26 {
27 /// solves real LP
29 {
30  assert(_realLP != 0);
31  assert(_realLP == &_solver);
32 
35 
36  // start timing
38 
40  {
41  // scale original problem; overwriting _realLP
43  {
44 #ifdef SOPLEX_DEBUG
45  SPxLPReal* origLP = 0;
46  spx_alloc(origLP);
47  origLP = new(origLP) SPxLPReal(*_realLP);
48 #endif
49  _scaler->scale(*_realLP, true);
50  _isRealLPScaled = _realLP->isScaled(); // a scaler might decide not to apply scaling
51 #ifdef SOPLEX_DEBUG
52  _checkScaling(origLP);
53 #endif
54  }
55  // unscale previously scaled problem, overwriting _realLP
56  else if(!_scaler && _realLP->isScaled())
57  {
59  _isRealLPScaled = false;
60  ++_unscaleCalls;
61  }
62  }
63 
64  // remember that last solve was in floating-point
66 
67  // solve and store solution; if we have a starting basis, do not apply preprocessing; if we are solving from
68  // scratch, apply preprocessing according to parameter settings
72  else
74 
76 
77  // stop timing
79 }
80 
81 
82 
83 /// check whether persistent scaling is supposed to be reapplied again after unscaling
85 {
88  return false;
89  else
90  return true;
91 }
92 
93 
94 
95 /// checks result of the solving process and solves again without preprocessing if necessary
97 {
98  // if the simplifier detected infeasibility or unboundedness we optimize again
99  // just to get the proof (primal or dual ray)
100  // todo get infeasibility proof from simplifier
101  switch(simplificationStatus)
102  {
106  _hasBasis = false;
107 
109  {
111  "simplifier detected infeasibility or unboundedness - solve again without simplifying" << std::endl;
112  )
114  }
115  else
116  {
117  if(simplificationStatus == SPxSimplifier::INFEASIBLE)
119  else if(simplificationStatus == SPxSimplifier::UNBOUNDED)
121  else
123 
124  // load original LP to restore clean solver state
125  _loadRealLP(false);
126  }
127 
128  return;
129 
133  return;
134 
135  case SPxSimplifier::OKAY:
136  _status = _solver.status();
137  }
138 
139  // process result
140  switch(_status)
141  {
142  case SPxSolver::OPTIMAL:
144  // apply polishing on original problem
145  if(_applyPolishing)
146  {
147  int polishing = intParam(SoPlex::SOLUTION_POLISHING);
150  }
151 
152  break;
153 
157 
158  // in case of infeasibility or unboundedness, we currently can not unsimplify, but have to solve the original LP again
160  {
161  MSG_INFO1(spxout, spxout << " --- loading original problem" << std::endl;)
163  // we cannot do more to remove violations
164  _resolveWithoutPreprocessing(simplificationStatus);
165  }
166  else
167  {
168  _storeSolutionReal(false);
169  }
170 
171  break;
172 
173  case SPxSolver::SINGULAR:
174 
175  // if preprocessing was applied, try to run again without to avoid singularity
176  if(!_isRealLPLoaded)
177  {
178  MSG_INFO1(spxout, spxout << "encountered singularity - trying to solve again without simplifying" <<
179  std::endl;)
181  return;
182  }
183 
184  _hasBasis = false;
185  break;
186 
188 
189  // if preprocessing or scaling was applied, try to run again without to avoid cycling
191  {
192  MSG_INFO1(spxout, spxout << "encountered cycling - trying to solve again without simplifying" <<
193  std::endl;)
194  // store and unsimplify sub-optimal solution and basis, may trigger re-solve
195  _storeSolutionReal(true);
196  return;
197  }
198 
201 
202  // FALLTHROUGH
206  case SPxSolver::REGULAR:
207  case SPxSolver::RUNNING:
208  // If we aborted the solve for some reason and there is still a shift, ensure that the basis status is correct
209  if(_solver.shift() > _solver.epsilon() )
211  _storeSolutionReal(false);
212  break;
213 
214  default:
215  _hasBasis = false;
216  break;
217  }
218 }
219 
220 
221 
222 /// solves real LP with/without preprocessing
223 void SoPlex::_preprocessAndSolveReal(bool applySimplifier)
224 {
227 
228  _applyPolishing = false;
229 
230  if(applySimplifier)
232  else
234 
235  // create a copy of the LP when simplifying or when using internal scaling, i.e. w/o persistent scaling
236  bool copyLP = (_simplifier != 0 || (_scaler && !_isRealLPScaled));
237 
240 
241  if(_isRealLPLoaded)
242  {
243  assert(_realLP == &_solver);
244 
245  // preprocessing is always applied to the LP in the solver; hence we have to create a copy of the original LP
246  // if simplifier is turned on
247  if(copyLP)
248  {
249  _realLP = 0;
252  _isRealLPLoaded = false;
253  }
254  }
255  else
256  {
257  assert(_realLP != &_solver);
258 
259  // load real LP and basis if available
260  if(_hasBasis)
261  {
262  assert(_basisStatusRows.size() == numRowsReal());
263  assert(_basisStatusCols.size() == numColsReal());
264 
265  _solver.loadLP(*_realLP, false);
267  }
268  // load real LP and set up slack basis
269  else
270  _solver.loadLP(*_realLP, true);
271 
272  // if there is no simplifier, then the original and the transformed problem are identical and it is more
273  // memory-efficient to keep only the problem in the solver
274  if(!copyLP)
275  {
276  _realLP->~SPxLPReal();
277  spx_free(_realLP);
278  _realLP = &_solver;
279  _isRealLPLoaded = true;
280  }
281  }
282 
283  // assert that we have two problems if and only if we apply the simplifier
284  assert(_realLP == &_solver || copyLP);
285  assert(_realLP != &_solver || !copyLP);
286 
287  // apply problem simplification
288  SPxSimplifier::Result simplificationStatus = SPxSimplifier::OKAY;
289 
290  if(_simplifier)
291  {
292  assert(!_isRealLPLoaded);
293  // do not remove bounds of boxed variables or sides of ranged rows if bound flipping is used; also respect row-boundflip parameter
295 
299  keepbounds &= boolParam(SoPlex::ROWBOUNDFLIPS);
300 
301  simplificationStatus = _simplifier->simplify(_solver, realParam(SoPlex::EPSILON_ZERO),
304  _solver.setScalingInfo(false);
305  _applyPolishing = true;
307  }
308 
310 
311  // run the simplex method if problem has not been solved by the simplifier
312  if(simplificationStatus == SPxSimplifier::OKAY)
313  {
314  if(_scaler && !_solver.isScaled())
315  {
316  _scaler->scale(_solver, false);
317  }
318 
320  }
321 
322  _evaluateSolutionReal(simplificationStatus);
323 }
324 
325 
326 
327 /// loads original problem into solver and solves again after it has been solved to infeasibility or unboundedness with preprocessing
329 {
330  assert(!_isRealLPLoaded || _scaler != 0);
331  assert(_simplifier != 0 || _scaler != 0);
334 
335  // if simplifier was active, then we unsimplify to get the basis
336  if(_simplifier)
337  {
338  assert(!_simplifier->isUnsimplified());
339  assert(simplificationStatus == SPxSimplifier::OKAY);
340 
341  // get temporary solution vectors for transformed problem
342  DVectorReal primal(_solver.nCols());
343  DVectorReal slacks(_solver.nRows());
344  DVectorReal dual(_solver.nRows());
345  DVectorReal redCost(_solver.nCols());
346 
349  assert(_basisStatusRows.size() >= _solver.nRows());
350  assert(_basisStatusCols.size() >= _solver.nCols());
351 
352  // get solution data from transformed problem
353  _solver.getPrimal(primal);
354  _solver.getSlacks(slacks);
355  _solver.getDual(dual);
356  _solver.getRedCost(redCost);
357 
358  // unscale vectors
359  if(_scaler && _solver.isScaled())
360  {
361  _scaler->unscalePrimal(_solver, primal);
362  _scaler->unscaleSlacks(_solver, slacks);
363  _scaler->unscaleDual(_solver, dual);
364  _scaler->unscaleRedCost(_solver, redCost);
365  }
366 
367  // get basis of transformed problem
370 
371  try
372  {
373  _simplifier->unsimplify(primal, dual, slacks, redCost, _basisStatusRows.get_ptr(),
374  _basisStatusCols.get_ptr(), false);
377  _hasBasis = true;
378  }
379  catch(const SPxException& E)
380  {
381  MSG_INFO1(spxout, spxout << "Caught exception <" << E.what() <<
382  "> during unsimplification. Resolving without simplifier and scaler.\n");
383  _hasBasis = false;
384  }
385  }
386  // if the original problem is not in the solver because of scaling, we also need to store the basis
387  else if(_scaler != 0)
388  {
391  assert(_basisStatusRows.size() == _solver.nRows());
392  assert(_basisStatusCols.size() == _solver.nCols());
393 
396  _hasBasis = true;
397  }
398 
399  // resolve the original problem
401  return;
402 }
403 
404 
405 
406 /// verify computed solution based on status and resolve if claimed primal or dual feasibility is not fulfilled
408 {
409  assert(_hasSolReal);
410 
411  MSG_INFO1(spxout, spxout << " --- verifying computed solution" << std::endl;)
412 
413  Real sumviol = 0;
414  Real boundviol = 0;
415  Real rowviol = 0;
416  Real dualviol = 0;
417  Real redcostviol = 0;
418 
419  (void) getBoundViolationReal(boundviol, sumviol);
420  (void) getRowViolationReal(rowviol, sumviol);
421 
422  (void) getDualViolationReal(dualviol, sumviol);
423  (void) getRedCostViolationReal(redcostviol, sumviol);
424 
425  if(boundviol >= _solver.feastol() || rowviol >= _solver.feastol() || dualviol >= _solver.opttol()
426  || redcostviol >= _solver.opttol())
427  {
428  assert(&_solver == _realLP);
429  assert(_isRealLPLoaded);
430  MSG_INFO3(spxout, spxout << "bound violation: " << boundviol
431  << ", row violation: " << rowviol
432  << ", dual violation: " << dualviol
433  << ", redcost violation: " << redcostviol << std::endl;)
435  " --- detected violations in original problem space -- solve again without presolving/scaling" <<
436  std::endl;)
437 
438  if(_isRealLPScaled)
439  {
441  _isRealLPScaled = false;
442  ++_unscaleCalls;
443  }
444 
446  }
447 }
448 
449 
450 /// stores solution data from the solver, possibly after applying unscaling and unsimplifying
451 void SoPlex::_storeSolutionReal(bool verify)
452 {
453  // prepare storage for basis (enough to fit the original basis)
456 
457  // prepare storage for the solution data (only in transformed space due to unscaling), w/o setting it to zero
458  _solReal._primal.reDim(_solver.nCols(), false);
459  _solReal._slacks.reDim(_solver.nRows(), false);
460  _solReal._dual.reDim(_solver.nRows(), false);
461  _solReal._redCost.reDim(_solver.nCols(), false);
462 
463  // check primal status consistency and query solution status
476 
480  && _solver.shift() < 10.0 * realParam(SoPlex::EPSILON_ZERO)));
481 
483 
484  // check dual status consistency and query solution status
485  assert(_solver.basis().status() != SPxBasis::DUAL || status() != SPxSolver::ERROR);
497 
500  && _solver.shift() < 10.0 * realParam(SoPlex::EPSILON_ZERO)));
501 
503 
504  // get infeasibility or unboundedness proof if available
506  {
509  }
510 
512  {
515  }
516 
517  // get solution data from the solver; independent of solution status
520 
525 
526  _hasBasis = true;
527 
528  // get primal and/or dual objective function value depending on status
531 
532  // infeasible solutions shall also be stored and be accessible
533  _hasSolReal = true;
534 
535  // unscale vectors
538 
539  // get unsimplified solution data from simplifier
540  if(_simplifier)
541  {
542  assert(!_simplifier->isUnsimplified());
543  assert(_simplifier->result() == SPxSimplifier::OKAY);
544  assert(_realLP != &_solver);
545 
546  SPxBasis::SPxStatus simplifiedBasisStatus = _solver.getBasisStatus();
547 
548  try
549  {
550  // pass solution data of transformed problem to simplifier
553  }
554  catch(const SPxException& E)
555  {
556  MSG_INFO1(spxout, spxout << "Caught exception <" << E.what() <<
557  "> during unsimplification. Resolving without simplifier and scaler.\n");
558  _hasBasis = false;
560  return;
561  }
562 
563  // copy unsimplified solution data from simplifier (size and dimension is adapted during copy)
568 
569  // overwrite the transformed basis with the unsimplified one
572 
573  // load original problem but don't setup a slack basis
574  _loadRealLP(false);
575 
576 
577  assert(_realLP == &_solver);
578 
579  // reset basis status
580  _solver.setBasisStatus(simplifiedBasisStatus);
581 
583  // load unsimplified basis into solver
584  assert(_basisStatusRows.size() == numRowsReal());
585  assert(_basisStatusCols.size() == numColsReal());
586  _hasBasis = true;
587  }
588  // load realLP into the solver again (internal scaling was applied)
589  else if(_realLP != &_solver)
590  {
591  assert(_solver.isScaled());
592  _loadRealLP(false);
593  }
594 
595  // unscale stored solution (removes persistent scaling)
596  if(_isRealLPScaled)
598 
599  // check solution for violations and solve again if necessary
600  if(verify)
602 
603  assert(_solver.nCols() == numColsReal());
604  assert(_solver.nRows() == numRowsReal());
605 }
606 
607 
608 
610 {
611  assert(_simplifier);
613 
614  // prepare storage for basis (enough to fit the original basis)
617 
618  // prepare storage for the solution data and initialize it to zero
621  _solReal._dual.reDim(numRowsReal(), true);
623 
624  // load original LP and setup slack basis for unsimplifying
625  _loadRealLP(true);
626 
627  // store slack basis
630 
631  assert(!_simplifier->isUnsimplified());
632 
633  try
634  {
635  // unsimplify basis and solution data
638 
639  }
640  catch(const SPxException& E)
641  {
642  MSG_INFO1(spxout, spxout << "Caught exception <" << E.what() <<
643  "> during unsimplification. Resolving without simplifier and scaler.\n");
645  return;
646  }
647 
648  // copy unsimplified solution data from simplifier
653 
654  // unscale stored solution (removes persistent scaling)
655  if(_isRealLPScaled)
657 
658  // compute the original objective function value
660 
661  for(int i = 0; i < numColsReal(); ++i)
662  objVal += _solReal._primal[i] * objReal(i);
663 
664  _solReal._objVal = objVal;
665 
666  // store the unsimplified basis
669  _hasBasis = true;
670  _hasSolReal = true;
672  _solReal._isDualFeasible = true;
674 
675  // check solution for violations and solve again if necessary
677 }
678 
679 
680 
681 /// load original LP and possibly setup a slack basis
682 void SoPlex::_loadRealLP(bool initBasis)
683 {
684  _solver.loadLP(*_realLP, initBasis);
685  _isRealLPLoaded = true;
686  _realLP->~SPxLPReal();
687  spx_free(_realLP);
688  _realLP = &_solver;
689 
690  if(initBasis)
691  _solver.init();
692 }
693 
694 
695 
696 /// unscales stored solution to remove internal or external scaling of LP
697 void SoPlex::_unscaleSolutionReal(SPxLPReal& LP, bool persistent)
698 {
699  MSG_INFO1(spxout, spxout << " --- unscaling " << (persistent ? "external" : "internal") <<
700  " solution" << std::endl;)
701  assert(_scaler);
702  assert(!persistent || (boolParam(SoPlex::PERSISTENTSCALING) && _isRealLPScaled));
707 
708  if(_solReal.hasPrimalRay())
710 
711  if(_solReal.hasDualFarkas())
713 }
714 } // namespace soplex
virtual Real objValue()
get objective value of current solution.
Definition: spxsolver.h:2002
int _lastSolveMode
Definition: soplex.h:1867
SPxLPBase< Real > SPxLPReal
Definition: spxlp.h:36
DVectorBase< R > _slacks
Definition: solbase.h:219
void _checkScaling(SPxLPReal *origLP) const
check scaling of LP
Definition: testsoplex.cpp:25
virtual const Vector & unsimplifiedSlacks()=0
returns a reference to the unsimplified slack values.
virtual Real shift() const
total current shift amount.
Definition: spxsolver.h:1627
virtual void unscaleDualray(const SPxLPBase< Real > &lp, Vector &ray) const
unscale dual ray given in ray.
Definition: spxscaler.cpp:674
Basis is dual feasible.
Definition: spxbasis.h:95
bool _reapplyPersistentScaling() const
check whether persistent scaling is supposed to be reapplied again after unscaling ...
Definition: solvereal.cpp:84
not initialised error
Definition: spxsolver.h:208
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase&#39;s dimension to newdim.
Definition: dvectorbase.h:253
DVectorBase< R > _dualFarkas
Definition: solbase.h:223
Basis is not known to be dual nor primal feasible.
Definition: spxbasis.h:94
virtual void unscalePrimal(const SPxLPBase< Real > &lp, Vector &x) const
unscale dense primal solution vector given in x.
Definition: spxscaler.cpp:614
int numRowsReal() const
returns number of rows
Definition: soplex.cpp:850
SPxBasis::SPxStatus getBasisStatus() const
gets basis status
Definition: spxsolver.h:2039
void _optimizeReal()
solves real LP
Definition: solvereal.cpp:28
virtual Status getPrimal(Vector &vector) const
get solution vector for primal variables.
Definition: spxsolve.cpp:1842
upper limit on objective value
Definition: soplex.h:1338
general zero tolerance
Definition: soplex.h:1317
Result
Result of the simplification.
Definition: spxsimplifier.h:81
mode for solution polishing
Definition: soplex.h:1044
type of ratio test
Definition: soplex.h:1017
the problem was so much simplified that it vanished
Definition: spxsimplifier.h:87
LP has beed solved to optimality but unscaled solution contains violations.
Definition: spxsolver.h:224
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver&#39;s basis.
Definition: spxsolver.cpp:1975
virtual Result simplify(SPxLP &lp, Real eps, Real delta)=0
simplify SPxLP lp with identical primal and dual feasibility tolerance.
type of computational form, i.e., column or row representation
Definition: soplex.h:978
T * get_ptr()
get a C pointer to the data.
Definition: dataarray.h:110
objective offset
Definition: soplex.h:1380
void setSolutionPolishing(SolutionPolish _polishObj)
set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack) ...
Definition: spxsolver.h:644
Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get current basis, and return solver status.
Definition: spxsolver.cpp:1900
#define ALLOWED_UNSCALE_PERCENTAGE
Definition: solvereal.cpp:22
Basis is optimal, i.e. dual and primal feasible.
Definition: spxbasis.h:97
Real feastol() const
allowed primal feasibility tolerance.
Definition: spxsolver.h:803
void unscaleLPandReloadBasis()
unscales the LP and reloads the basis
Definition: spxsolver.cpp:534
DVectorBase< R > _primalRay
Definition: solbase.h:220
bool isScaled() const
Returns true if and only if the LP is scaled.
Definition: spxlpbase.h:140
DVectorBase< R > _redCost
Definition: solbase.h:222
int _unscaleCalls
Definition: soplex.h:1886
primal feasibility tolerance
Definition: soplex.h:1311
void _storeSolutionRealFromPresol()
stores solution from the simplifier because problem vanished in presolving step
Definition: solvereal.cpp:609
solve() aborted due to iteration limit.
Definition: spxsolver.h:213
SPxScaler * _scaler
Definition: soplex.h:1638
apply standard floating-point algorithm
Definition: soplex.h:1246
bool hasDualFarkas() const
is a dual farkas ray available?
Definition: solbase.h:110
No Problem has been loaded.
Definition: spxsolver.h:216
virtual void unscaleRedCost(const SPxLPBase< Real > &lp, Vector &r) const
unscale dense reduced cost vector given in r.
Definition: spxscaler.cpp:650
void _unscaleSolutionReal(SPxLPReal &LP, bool persistent=true)
unscales stored solution to remove internal or external scaling of LP
Definition: solvereal.cpp:697
bool getRowViolationReal(Real &maxviol, Real &sumviol)
gets violation of constraints; returns true on success
Definition: soplex.cpp:3203
re-optimize the original problem to get a proof (ray) of infeasibility/unboundedness?
Definition: soplex.h:965
virtual void unscaleDual(const SPxLPBase< Real > &lp, Vector &pi) const
unscale dense dual solution vector given in pi.
Definition: spxscaler.cpp:638
void _disableSimplifierAndScaler()
disables simplifier and scaler
Definition: soplex.cpp:8501
unsigned int _hasPrimalRay
Definition: solbase.h:228
objective sense
Definition: soplex.h:975
LP has been proven to be primal infeasible.
Definition: spxsolver.h:222
int intParam(const IntParam param) const
returns integer parameter value
Definition: soplex.cpp:5773
virtual void changeObjOffset(const R &o)
Definition: spxlpbase.h:1841
automatic choice according to number of rows and columns
Definition: soplex.h:1079
virtual const std::string what() const
returns exception message
Definition: exceptions.h:57
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:152
No ratiotester loaded.
Definition: spxsolver.h:205
No pricer loaded.
Definition: spxsolver.h:206
virtual void start()=0
start timer, resume accounting user, system and real time.
virtual Real stop()=0
stop timer, return accounted user time.
void spx_alloc(T &p, int n=1)
Allocate memory.
Definition: spxalloc.h:48
simplification could be done
Definition: spxsimplifier.h:83
virtual Status getDualfarkas(Vector &vector) const
get dual farkas proof of infeasibility.
Definition: spxsolve.cpp:2030
row representation (lower,lhs) <= (x,Ax) <= (upper,rhs)
Definition: soplex.h:1085
LP is primal infeasible or unbounded.
Definition: spxsolver.h:223
DataArray< SPxSolver::VarStatus > _basisStatusCols
Definition: soplex.h:1870
SPxStatus status() const
Definition: spxbasis.h:425
double Real
Definition: spxdefines.h:218
bool _isRealLPLoaded
Definition: soplex.h:1641
void _solveRealLPAndRecordStatistics()
call floating-point solver and update statistics on iterations etc.
Definition: soplex.cpp:8555
DVectorBase< R > _primal
Definition: solbase.h:218
Status status() const
Status of solution process.
Definition: spxsolve.cpp:2213
virtual Real getObjoffset() const
get objective offset.
LP has been solved to optimality.
Definition: spxsolver.h:220
use persistent scaling?
Definition: soplex.h:959
bool _hasBasis
Definition: soplex.h:1876
use bound flipping also for row representation?
Definition: soplex.h:956
bool getDualViolationReal(Real &maxviol, Real &sumviol)
gets violation of dual multipliers; returns true on success
Definition: soplex.cpp:3309
unsigned int _hasDualFarkas
Definition: solbase.h:230
Class for collecting statistical information.
solve() aborted due to time limit.
Definition: spxsolver.h:212
an error occured.
Definition: spxsolver.h:204
const T * get_const_ptr() const
get a const C pointer to the data.
Definition: dataarray.h:115
Statistics * _statistics
statistics since last call to solveReal() or solveRational()
Definition: soplex.h:1586
void _evaluateSolutionReal(SPxSimplifier::Result simplificationStatus)
checks result of the solving process and solves again without preprocessing if necessary ...
Definition: solvereal.cpp:96
bool isPrimalFeasible() const
is the stored solution primal feasible?
Definition: solbase.h:51
virtual void getBasis(SPxSolver::VarStatus[], SPxSolver::VarStatus[], const int rowsSize=-1, const int colsSize=-1) const =0
get optimal basis.
Real realParam(const RealParam param) const
returns real parameter value
Definition: soplex.cpp:5783
primal infeasibility was detected
Definition: spxsimplifier.h:84
void _verifySolutionReal()
verify computed solution and resolve if necessary
Definition: solvereal.cpp:407
virtual Real getFastCondition()
Definition: spxsolver.h:898
SPxOut spxout
Definition: soplex.h:1485
infinity threshold
Definition: soplex.h:1329
algorithm is running
Definition: spxsolver.h:218
void _loadRealLP(bool initBasis)
load original LP and possibly setup a slack basis
Definition: solvereal.cpp:682
virtual const Vector & unsimplifiedPrimal()=0
returns a reference to the unsimplified primal solution.
virtual void loadLP(const SPxLP &LP, bool initSlackBasis=true)
copy LP.
Definition: spxsolver.cpp:71
Preconfigured SoPlex LP solver.
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
Definition: spxdefines.h:122
void setScalingInfo(bool scaled)
set whether the LP is scaled or not
Definition: spxlpbase.h:146
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:784
bool isDualFeasible() const
is a dual solution available?
Definition: solbase.h:88
Timer * preprocessingTime
preprocessing time
Definition: statistics.h:89
threshold on number of rows vs. number of columns for switching from column to row representations in...
Definition: soplex.h:1359
virtual void scale(SPxLPBase< Real > &lp, bool persistent=true)=0
scale SPxLP.
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
Definition: exceptions.h:32
Everything should be within this namespace.
SPxLPReal * _realLP
Definition: soplex.h:1635
void _preprocessAndSolveReal(bool applyPreprocessing)
solves real LP with/without preprocessing
Definition: solvereal.cpp:223
Real objReal(int i) const
returns objective value of column i
Definition: soplex.cpp:1080
solve() aborted due to detection of cycling.
Definition: spxsolver.h:211
bound flipping ratio test for long steps in the dual simplex
Definition: soplex.h:1216
Saving LPs in a form suitable for SoPlex.Class SPxLPBase provides the data structures required for sa...
Definition: spxlpbase.h:80
primal unboundedness was detected
Definition: spxsimplifier.h:86
virtual void unsimplify(const Vector &, const Vector &, const Vector &, const Vector &, const SPxSolver::VarStatus[], const SPxSolver::VarStatus[], bool isOptimal=true)=0
reconstructs an optimal solution for the unsimplified LP.
virtual Result result() const =0
returns result status of the simplification
bool getBoundViolationReal(Real &maxviol, Real &sumviol)
gets violation of bounds; returns true on success
Definition: soplex.cpp:3160
#define MIN_OPT_CALLS_WITH_SCALING
Definition: solvereal.cpp:23
SPxSolver _solver
Definition: soplex.h:1611
don&#39;t perform modifications on optimal basis
Definition: spxsolver.h:230
void _resolveWithoutPreprocessing(SPxSimplifier::Result simplificationStatus)
loads original problem into solver and solves again after it has been solved to optimality with prepr...
Definition: solvereal.cpp:328
int _optimizeCalls
Definition: soplex.h:1885
virtual bool isUnsimplified() const
specifies whether an optimal solution has already been unsimplified.
Real finalBasisCondition
condition number estimate of the optimal basis matrix
Definition: statistics.h:138
DataArray< SPxSolver::VarStatus > _basisStatusRows
Definition: soplex.h:1869
virtual const Vector & unsimplifiedDual()=0
returns a reference to the unsimplified dual solution.
Timer * solvingTime
solving time
Definition: statistics.h:88
int size() const
return nr. of elements.
Definition: dataarray.h:214
bool boolParam(const BoolParam param) const
returns boolean parameter value
Definition: soplex.cpp:5763
virtual Status getRedCost(Vector &vector) const
get vector of reduced costs.
Definition: spxsolve.cpp:1951
void _storeSolutionReal(bool verify=true)
stores solution of the real LP; before calling this, the real LP must be loaded in the solver and sol...
Definition: solvereal.cpp:451
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
Definition: spxdefines.h:118
bool _applyPolishing
Definition: soplex.h:1644
SPxStatus
basis status.
Definition: spxbasis.h:90
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:158
unsigned int _isPrimalFeasible
Definition: solbase.h:227
SPxSolver::Status status() const
returns the current solver status
Definition: soplex.cpp:2998
SolReal _solReal
Definition: soplex.h:1872
lower limit on objective value
Definition: soplex.h:1335
bool getRedCostViolationReal(Real &maxviol, Real &sumviol)
gets violation of reduced costs; returns true on success
Definition: soplex.cpp:3249
bool _hasSolReal
Definition: soplex.h:1877
virtual void init()
intialize data structures.
Definition: spxsolver.cpp:319
dual feasibility tolerance
Definition: soplex.h:1314
void forceRecompNonbasicValue()
Definition: spxsolver.h:670
void invalidate()
invalidate solution
Definition: solbase.h:209
bool hasPrimalRay() const
is a primal unbounded ray available?
Definition: solbase.h:73
bool setIntParam(const IntParam param, const int value, const bool init=true)
sets integer parameter value; returns true on success
Definition: soplex.cpp:5885
virtual const Vector & unsimplifiedRedCost()=0
returns a reference to the unsimplified reduced costs.
Real opttol() const
allowed optimality, i.e., dual feasibility tolerance.
Definition: spxsolver.h:811
void _enableSimplifierAndScaler()
enables simplifier and scaler according to current parameters
Definition: soplex.cpp:8443
unsigned int _isDualFeasible
Definition: solbase.h:229
virtual void unscaleSlacks(const SPxLPBase< Real > &lp, Vector &s) const
unscale dense slack vector given in s.
Definition: spxscaler.cpp:626
DVectorBase< R > _dual
Definition: solbase.h:221
virtual void setTerminationValue(Real value=infinity)
set objective limit.
Definition: spxsolver.cpp:1697
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1761
virtual void unscalePrimalray(const SPxLPBase< Real > &lp, Vector &ray) const
unscale primal ray given in ray.
Definition: spxscaler.cpp:662
int numColsReal() const
returns number of columns
Definition: soplex.cpp:859
LP has been proven to be primal unbounded.
Definition: spxbasis.h:98
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:226
bool _isRealLPScaled
Definition: soplex.h:1643
SPxSolver::Status _status
Definition: soplex.h:1866
solve() aborted due to objective limit.
Definition: spxsolver.h:214
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:110
SPxSimplifier * _simplifier
Definition: soplex.h:1637
virtual Status getDual(Vector &vector) const
get current solution vector for dual variables.
Definition: spxsolve.cpp:1899
Basis is singular, numerical troubles?
Definition: spxsolver.h:215
virtual Status getPrimalray(Vector &vector) const
get primal ray in case of unboundedness.
Definition: spxsolve.cpp:2012
Basis is primal feasible.
Definition: spxbasis.h:96
LP has a usable Basis (maybe LP is changed).
Definition: spxsolver.h:217
dual infeasibility was detected
Definition: spxsimplifier.h:85
virtual Status getSlacks(Vector &vector) const
get vector of slack variables.
Definition: spxsolve.cpp:2048
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2051
LP has been proven to be primal unbounded.
Definition: spxsolver.h:221
LP has been proven to be primal infeasible.
Definition: spxbasis.h:99
No Problem has been loaded to the basis.
Definition: spxbasis.h:92
No linear solver loaded.
Definition: spxsolver.h:207