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-2018 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
71  else
73 
75 
76  // stop timing
78  }
79 
80 
81 
82  /// check whether persistent scaling is supposed to be reapplied again after unscaling
84  {
86  return false;
87  else
88  return true;
89  }
90 
91 
92 
93  /// checks result of the solving process and solves again without preprocessing if necessary
95  {
96  // if the simplifier detected infeasibility or unboundedness we optimize again
97  // just to get the proof (primal or dual ray)
98  // todo get infeasibility proof from simplifier
99  switch( simplificationStatus )
100  {
104  _hasBasis = false;
106  {
107  MSG_INFO1( spxout, spxout << "simplifier detected infeasibility or unboundedness - solve again without simplifying" << std::endl; )
109  }
110  else
111  {
112  if( simplificationStatus == SPxSimplifier::INFEASIBLE )
114  else if( simplificationStatus == SPxSimplifier::UNBOUNDED )
116  else
118  // load original LP to restore clean solver state
119  _loadRealLP(false);
120  }
121  return;
122 
126  return;
127 
128  case SPxSimplifier::OKAY:
129  _status = _solver.status();
130  }
131 
132  // process result
133  switch( _status )
134  {
135  case SPxSolver::OPTIMAL:
137  // apply polishing on original problem
138  if( _applyPolishing )
139  {
140  int polishing = intParam(SoPlex::SOLUTION_POLISHING);
143  }
144  break;
145 
149  // in case of infeasibility or unboundedness, we currently can not unsimplify, but have to solve the original LP again
151  {
152  MSG_INFO1( spxout, spxout << " --- loading original problem" << std::endl; )
154  // we cannot do more to remove violations
155  _resolveWithoutPreprocessing(simplificationStatus);
156  }
157  else
158  {
159  _storeSolutionReal(false);
160  }
161  break;
162 
163  case SPxSolver::SINGULAR:
164  // if preprocessing was applied, try to run again without to avoid singularity
165  if( !_isRealLPLoaded )
166  {
167  MSG_INFO1( spxout, spxout << "encountered singularity - trying to solve again without simplifying" << std::endl; )
169  return;
170  }
171  _hasBasis = false;
172  break;
173 
175  // if preprocessing was applied, try to run again without to avoid cycling
176  if( !_isRealLPLoaded )
177  {
178  MSG_INFO1( spxout, spxout << "encountered cycling - trying to solve again without simplifying" << std::endl; )
180  return;
181  }
184  break;
185  // FALLTHROUGH
189  case SPxSolver::REGULAR:
190  case SPxSolver::RUNNING:
191  _storeSolutionReal(false);
192  break;
193 
194  default:
195  _hasBasis = false;
196  break;
197  }
198  }
199 
200 
201 
202  /// solves real LP with/without preprocessing
203  void SoPlex::_preprocessAndSolveReal(bool applySimplifier)
204  {
207 
208  _applyPolishing = false;
209 
210  if( applySimplifier )
212  else
214 
215  // create a copy of the LP when simplifying or when using internal scaling, i.e. w/o persistent scaling
216  bool copyLP = (_simplifier != 0 || (_scaler && !_isRealLPScaled));
217 
220 
221  if( _isRealLPLoaded )
222  {
223  assert(_realLP == &_solver);
224 
225  // preprocessing is always applied to the LP in the solver; hence we have to create a copy of the original LP
226  // if simplifier is turned on
227  if( copyLP )
228  {
229  _realLP = 0;
231  _realLP = new (_realLP) SPxLPReal(_solver);
232  _isRealLPLoaded = false;
233  }
234  }
235  else
236  {
237  assert(_realLP != &_solver);
238 
239  // load real LP and basis if available
240  if( _hasBasis )
241  {
242  assert(_basisStatusRows.size() == numRowsReal());
243  assert(_basisStatusCols.size() == numColsReal());
244 
245  _solver.loadLP(*_realLP, false);
247  }
248  // load real LP and set up slack basis
249  else
250  _solver.loadLP(*_realLP, true);
251 
252  // if there is no simplifier, then the original and the transformed problem are identical and it is more
253  // memory-efficient to keep only the problem in the solver
254  if( !copyLP )
255  {
256  _realLP->~SPxLPReal();
257  spx_free(_realLP);
258  _realLP = &_solver;
259  _isRealLPLoaded = true;
260  }
261  }
262 
263  // assert that we have two problems if and only if we apply the simplifier
264  assert(_realLP == &_solver || copyLP);
265  assert(_realLP != &_solver || !copyLP);
266 
267  // apply problem simplification
268  SPxSimplifier::Result simplificationStatus = SPxSimplifier::OKAY;
269  if( _simplifier )
270  {
271  assert(!_isRealLPLoaded);
272  // do not remove bounds of boxed variables or sides of ranged rows if bound flipping is used; also respect row-boundflip parameter
277  keepbounds &= boolParam(SoPlex::ROWBOUNDFLIPS);
280  _solver.setScalingInfo(false);
281  _applyPolishing = true;
283  }
284 
286 
287  // run the simplex method if problem has not been solved by the simplifier
288  if( simplificationStatus == SPxSimplifier::OKAY )
289  {
290  if( _scaler && !_solver.isScaled() )
291  {
292  _scaler->scale(_solver, false);
293  }
294 
296  }
297 
298  _evaluateSolutionReal(simplificationStatus);
299  }
300 
301 
302 
303  /// loads original problem into solver and solves again after it has been solved to infeasibility or unboundedness with preprocessing
305  {
306  assert(!_isRealLPLoaded || _scaler != 0);
307  assert(_simplifier != 0 || _scaler != 0);
309 
310  // if simplifier was active, then we unsimplify to get the basis
311  if( _simplifier )
312  {
313  assert(!_simplifier->isUnsimplified());
314  assert(simplificationStatus == SPxSimplifier::OKAY);
315 
316  // get temporary solution vectors for transformed problem
317  DVectorReal primal(_solver.nCols());
318  DVectorReal slacks(_solver.nRows());
319  DVectorReal dual(_solver.nRows());
320  DVectorReal redCost(_solver.nCols());
321 
324  assert(_basisStatusRows.size() >= _solver.nRows());
325  assert(_basisStatusCols.size() >= _solver.nCols());
326 
327  // get solution data from transformed problem
328  _solver.getPrimal(primal);
329  _solver.getSlacks(slacks);
330  _solver.getDual(dual);
331  _solver.getRedCost(redCost);
332 
333  // unscale vectors
334  if( _scaler && _solver.isScaled())
335  {
336  _scaler->unscalePrimal(_solver, primal);
337  _scaler->unscaleSlacks(_solver, slacks);
338  _scaler->unscaleDual(_solver, dual);
339  _scaler->unscaleRedCost(_solver, redCost);
340  }
341 
342  // get basis of transformed problem
344 
345  try
346  {
347  _simplifier->unsimplify(primal, dual, slacks, redCost, _basisStatusRows.get_ptr(), _basisStatusCols.get_ptr(), false);
349  _hasBasis = true;
350  }
351  catch( const SPxException& E )
352  {
353  MSG_INFO1( spxout, spxout << "Caught exception <" << E.what() << "> during unsimplification. Resolving without simplifier and scaler.\n" );
354  _hasBasis = false;
355  }
356  }
357  // if the original problem is not in the solver because of scaling, we also need to store the basis
358  else if( _scaler != 0 )
359  {
362  assert(_basisStatusRows.size() == _solver.nRows());
363  assert(_basisStatusCols.size() == _solver.nCols());
364 
366  _hasBasis = true;
367  }
368 
369  // resolve the original problem
371  return;
372  }
373 
374 
375 
376  /// verify computed solution based on status and resolve if claimed primal or dual feasibility is not fulfilled
378  {
379  assert(_hasSolReal);
381  {
382  _hasSolReal = false;
383  return;
384  }
385 
386  MSG_INFO1( spxout, spxout << " --- verifying computed solution" << std::endl; )
387 
388  Real sumviol = 0;
389  Real boundviol = 0;
390  Real rowviol = 0;
391  Real dualviol = 0;
392  Real redcostviol = 0;
393 
395  {
396  (void) getBoundViolationReal(boundviol, sumviol);
397  (void) getRowViolationReal(rowviol, sumviol);
398  }
400  {
401  (void) getDualViolationReal(dualviol, sumviol);
402  (void) getRedCostViolationReal(redcostviol, sumviol);
403  }
404 
405  if( boundviol >= _solver.feastol() || rowviol >= _solver.feastol() || dualviol >= _solver.opttol() || redcostviol >= _solver.opttol())
406  {
407  assert(&_solver == _realLP);
408  assert(_isRealLPLoaded);
409  MSG_INFO3( spxout, spxout << "bound violation: " << boundviol
410  << ", row violation: " << rowviol
411  << ", dual violation: " << dualviol
412  << ", redcost violation: " << redcostviol << std::endl; )
413  MSG_INFO1( spxout, spxout << " --- detected violations in original problem space -- solve again without presolving/scaling" << std::endl; )
414 
415  if( _isRealLPScaled )
416  {
418  _isRealLPScaled = false;
419  ++_unscaleCalls;
420  }
421 
423  }
424  }
425 
426 
427  /// stores solution data from the solver, possibly after applying unscaling and unsimplifying
428  void SoPlex::_storeSolutionReal(bool verify)
429  {
430  // prepare storage for basis (enough to fit the original basis)
433 
434  // prepare storage for the solution data (only in transformed space due to unscaling), w/o setting it to zero
435  _solReal._primal.reDim(_solver.nCols(), false);
436  _solReal._slacks.reDim(_solver.nRows(), false);
437  _solReal._dual.reDim(_solver.nRows(), false);
438  _solReal._redCost.reDim(_solver.nCols(), false);
439 
440  // check primal status consistency and query solution status
452 
455  && _solver.shift() < 10.0 * realParam(SoPlex::EPSILON_ZERO)));
456 
458 
459  // check dual status consistency and query solution status
460  assert(_solver.basis().status() != SPxBasis::DUAL || status() != SPxSolver::ERROR);
471 
474  && _solver.shift() < 10.0 * realParam(SoPlex::EPSILON_ZERO)));
475 
477 
478  // get infeasibility or unboundedness proof if available
479  if( _solReal._hasPrimalRay )
480  {
483  }
484 
486  {
489  }
490 
491  // get solution data from the solver; independent of solution status
494 
499 
500  _hasBasis = true;
501 
502  // get primal and/or dual objective function value depending on status
505 
506  // infeasible solutions shall also be stored and be accessible
507  _hasSolReal = true;
508 
509  // unscale vectors
510  if( _solver.isScaled() && !_isRealLPLoaded )
512 
513  // get unsimplified solution data from simplifier
514  if( _simplifier )
515  {
516  assert(!_simplifier->isUnsimplified());
517  assert(_simplifier->result() == SPxSimplifier::OKAY);
518  assert(_realLP != &_solver);
519 
520  try
521  {
522  // pass solution data of transformed problem to simplifier
525  }
526  catch( const SPxException& E )
527  {
528  MSG_INFO1( spxout, spxout << "Caught exception <" << E.what() << "> during unsimplification. Resolving without simplifier and scaler.\n" );
529  _hasBasis = false;
531  return;
532  }
533 
534  // copy unsimplified solution data from simplifier (size and dimension is adapted during copy)
539 
540  // overwrite the transformed basis with the unsimplified one
542 
543  // load original problem but don't setup a slack basis
544  _loadRealLP(false);
545 
546  assert(_realLP == &_solver);
547 
548  // load unsimplified basis into solver
549  assert(_basisStatusRows.size() == numRowsReal());
550  assert(_basisStatusCols.size() == numColsReal());
553  _hasBasis = true;
554  }
555  // load realLP into the solver again (internal scaling was applied)
556  else if( _realLP != &_solver )
557  {
558  assert(_solver.isScaled());
559  _loadRealLP(false);
560  }
561 
562  // unscale stored solution (removes persistent scaling)
563  if( _isRealLPScaled )
565 
566  // check solution for violations and solve again if necessary
567  if( verify )
569 
570  assert(_solver.nCols() == numColsReal());
571  assert(_solver.nRows() == numRowsReal());
572  }
573 
574 
575 
577  {
578  assert(_simplifier);
580 
581  // prepare storage for basis (enough to fit the original basis)
584 
585  // prepare storage for the solution data and initialize it to zero
588  _solReal._dual.reDim(numRowsReal(), true);
590 
591  // load original LP and setup slack basis for unsimplifying
592  _loadRealLP(true);
593 
594  // store slack basis
597 
598  assert(!_simplifier->isUnsimplified());
599 
600  try
601  {
602  // unsimplify basis and solution data
605 
606  }
607  catch( const SPxException& E )
608  {
609  MSG_INFO1( spxout, spxout << "Caught exception <" << E.what() << "> during unsimplification. Resolving without simplifier and scaler.\n" );
611  return;
612  }
613 
614  // copy unsimplified solution data from simplifier
619 
620  // unscale stored solution (removes persistent scaling)
621  if( _isRealLPScaled )
623 
624  // compute the original objective function value
626  for( int i = 0; i < numColsReal(); ++i )
628 
629  // store the unsimplified basis
631  _hasBasis = true;
632  _hasSolReal = true;
634  _solReal._isDualFeasible = true;
635 
636  // check solution for violations and solve again if necessary
638  }
639 
640 
641 
642  /// load original LP and possibly setup a slack basis
643  void SoPlex::_loadRealLP(bool initBasis)
644  {
645  _solver.loadLP(*_realLP, initBasis);
646  _isRealLPLoaded = true;
647  _realLP->~SPxLPReal();
648  spx_free(_realLP);
649  _realLP = &_solver;
650  if( initBasis )
651  _solver.init();
652  }
653 
654 
655 
656  /// unscales stored solution to remove internal or external scaling of LP
657  void SoPlex::_unscaleSolutionReal(SPxLPReal& LP, bool persistent)
658  {
659  MSG_INFO1( spxout, spxout << " --- unscaling " << (persistent ? "external" : "internal") <<" solution" << std::endl; )
660  assert(_scaler);
661  assert(!persistent || (boolParam(SoPlex::PERSISTENTSCALING) && _isRealLPScaled));
666  if( _solReal.hasPrimalRay() )
668  if( _solReal.hasDualFarkas() )
670  }
671 } // namespace soplex
virtual Real objValue()
get objective value of current solution.
Definition: spxsolver.h:1981
int _lastSolveMode
Definition: soplex.h:1826
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:1606
virtual void unscaleDualray(const SPxLPBase< Real > &lp, Vector &ray) const
unscale dual ray given in ray.
Definition: spxscaler.cpp:664
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:83
not initialised error
Definition: spxsolver.h:207
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase&#39;s dimension to newdim.
Definition: dvectorbase.h:249
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:604
int numRowsReal() const
returns number of rows
Definition: soplex.cpp:800
void _optimizeReal()
solves real LP
Definition: solvereal.cpp:28
virtual Status getPrimal(Vector &vector) const
get solution vector for primal variables.
Definition: spxsolve.cpp:1729
upper limit on objective value
Definition: soplex.h:1314
general zero tolerance
Definition: soplex.h:1293
Result
Result of the simplification.
Definition: spxsimplifier.h:81
mode for solution polishing
Definition: soplex.h:1020
type of ratio test
Definition: soplex.h:993
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:223
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver&#39;s basis.
Definition: spxsolver.cpp:1870
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:954
T * get_ptr()
get a C pointer to the data.
Definition: dataarray.h:110
objective offset
Definition: soplex.h:1356
void setSolutionPolishing(SolutionPolish _polishObj)
set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack) ...
Definition: spxsolver.h:625
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:1797
#define ALLOWED_UNSCALE_PERCENTAGE
Definition: solvereal.cpp:22
Real feastol() const
allowed primal feasibility tolerance.
Definition: spxsolver.h:784
void unscaleLPandReloadBasis()
unscales the LP and reloads the basis
Definition: spxsolver.cpp:513
DVectorBase< R > _primalRay
Definition: solbase.h:220
bool isScaled() const
Returns true if and only if the LP is scaled.
Definition: spxlpbase.h:139
DVectorBase< R > _redCost
Definition: solbase.h:222
int _unscaleCalls
Definition: soplex.h:1845
primal feasibility tolerance
Definition: soplex.h:1287
void _storeSolutionRealFromPresol()
stores solution from the simplifier because problem vanished in presolving step
Definition: solvereal.cpp:576
solve() aborted due to iteration limit.
Definition: spxsolver.h:212
SPxScaler * _scaler
Definition: soplex.h:1608
bool hasDualFarkas() const
is a dual farkas ray available?
Definition: solbase.h:110
No Problem has been loaded.
Definition: spxsolver.h:215
virtual void unscaleRedCost(const SPxLPBase< Real > &lp, Vector &r) const
unscale dense reduced cost vector given in r.
Definition: spxscaler.cpp:640
void _unscaleSolutionReal(SPxLPReal &LP, bool persistent=true)
unscales stored solution to remove internal or external scaling of LP
Definition: solvereal.cpp:657
bool getRowViolationReal(Real &maxviol, Real &sumviol)
gets violation of constraints; returns true on success
Definition: soplex.cpp:3105
re-optimize the original problem to get a proof (ray) of infeasibility/unboundedness?
Definition: soplex.h:941
virtual void unscaleDual(const SPxLPBase< Real > &lp, Vector &pi) const
unscale dense dual solution vector given in pi.
Definition: spxscaler.cpp:628
void _disableSimplifierAndScaler()
disables simplifier and scaler
Definition: soplex.cpp:8010
unsigned int _hasPrimalRay
Definition: solbase.h:228
objective sense
Definition: soplex.h:951
LP has been proven to be primal infeasible.
Definition: spxsolver.h:221
int intParam(const IntParam param) const
returns integer parameter value
Definition: soplex.cpp:5541
bound flipping ratio test for long steps in the dual simplex
Definition: soplex.h:1192
virtual void changeObjOffset(const R &o)
Definition: spxlpbase.h:1773
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:151
No ratiotester loaded.
Definition: spxsolver.h:204
No pricer loaded.
Definition: spxsolver.h:205
virtual void start()=0
start timer, resume accounting user, system and real time.
virtual Real stop()=0
stop timer, return accounted user time.
row representation (lower,lhs) <= (x,Ax) <= (upper,rhs)
Definition: soplex.h:1061
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:1870
LP is primal infeasible or unbounded.
Definition: spxsolver.h:222
DataArray< SPxSolver::VarStatus > _basisStatusCols
Definition: soplex.h:1829
SPxStatus status() const
returns current SPxStatus.
Definition: spxbasis.h:425
double Real
Definition: spxdefines.h:218
bool _isRealLPLoaded
Definition: soplex.h:1611
void _solveRealLPAndRecordStatistics()
call floating-point solver and update statistics on iterations etc.
Definition: soplex.cpp:8064
DVectorBase< R > _primal
Definition: solbase.h:218
Status status() const
Status of solution process.
Definition: spxsolve.cpp:2046
virtual Real getObjoffset() const
get objective offset.
LP has been solved to optimality.
Definition: spxsolver.h:219
use persistent scaling?
Definition: soplex.h:935
bool _hasBasis
Definition: soplex.h:1835
use bound flipping also for row representation?
Definition: soplex.h:932
bool getDualViolationReal(Real &maxviol, Real &sumviol)
gets violation of dual multipliers; returns true on success
Definition: soplex.cpp:3201
unsigned int _hasDualFarkas
Definition: solbase.h:230
Class for collecting statistical information.
solve() aborted due to time limit.
Definition: spxsolver.h:211
an error occured.
Definition: spxsolver.h:203
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:1557
void _evaluateSolutionReal(SPxSimplifier::Result simplificationStatus)
checks result of the solving process and solves again without preprocessing if necessary ...
Definition: solvereal.cpp:94
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:5551
primal infeasibility was detected
Definition: spxsimplifier.h:84
void _verifySolutionReal()
verify computed solution and resolve if necessary
Definition: solvereal.cpp:377
virtual Real getFastCondition()
Definition: spxsolver.h:879
SPxOut spxout
Definition: soplex.h:1457
infinity threshold
Definition: soplex.h:1305
algorithm is running
Definition: spxsolver.h:217
void _loadRealLP(bool initBasis)
load original LP and possibly setup a slack basis
Definition: solvereal.cpp:643
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:68
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
automatic choice according to number of rows and columns
Definition: soplex.h:1055
void setScalingInfo(bool scaled)
set whether the LP is scaled or not
Definition: spxlpbase.h:145
apply standard floating-point algorithm
Definition: soplex.h:1222
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:1335
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:1605
void _preprocessAndSolveReal(bool applyPreprocessing)
solves real LP with/without preprocessing
Definition: solvereal.cpp:203
Real objReal(int i) const
returns objective value of column i
Definition: soplex.cpp:1030
solve() aborted due to detection of cycling.
Definition: spxsolver.h:210
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:3066
#define MIN_OPT_CALLS_WITH_SCALING
Definition: solvereal.cpp:23
SPxSolver _solver
Definition: soplex.h:1582
don&#39;t perform modifications on optimal basis
Definition: spxsolver.h:229
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:304
int _optimizeCalls
Definition: soplex.h:1844
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:1828
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:211
bool boolParam(const BoolParam param) const
returns boolean parameter value
Definition: soplex.cpp:5531
virtual Status getRedCost(Vector &vector) const
get vector of reduced costs.
Definition: spxsolve.cpp:1809
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:428
#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:1614
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:157
unsigned int _isPrimalFeasible
Definition: solbase.h:227
SPxSolver::Status status() const
returns the current solver status
Definition: soplex.cpp:2899
SolReal _solReal
Definition: soplex.h:1831
lower limit on objective value
Definition: soplex.h:1311
bool getRedCostViolationReal(Real &maxviol, Real &sumviol)
gets violation of reduced costs; returns true on success
Definition: soplex.cpp:3147
bool _hasSolReal
Definition: soplex.h:1836
virtual void init()
intialize data structures.
Definition: spxsolver.cpp:305
dual feasibility tolerance
Definition: soplex.h:1290
void forceRecompNonbasicValue()
Definition: spxsolver.h:651
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:5637
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:792
void _enableSimplifierAndScaler()
enables simplifier and scaler according to current parameters
Definition: soplex.cpp:7961
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:616
DVectorBase< R > _dual
Definition: solbase.h:221
virtual void setTerminationValue(Real value=infinity)
set objective limit.
Definition: spxsolver.cpp:1617
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1740
virtual void unscalePrimalray(const SPxLPBase< Real > &lp, Vector &ray) const
unscale primal ray given in ray.
Definition: spxscaler.cpp:652
int numColsReal() const
returns number of columns
Definition: soplex.cpp:809
LP has been proven to be primal unbounded.
Definition: spxbasis.h:98
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:223
bool _isRealLPScaled
Definition: soplex.h:1613
SPxSolver::Status _status
Definition: soplex.h:1825
solve() aborted due to objective limit.
Definition: spxsolver.h:213
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:109
SPxSimplifier * _simplifier
Definition: soplex.h:1607
virtual Status getDual(Vector &vector) const
get current solution vector for dual variables.
Definition: spxsolve.cpp:1778
Basis is singular, numerical troubles?
Definition: spxsolver.h:214
virtual Status getPrimalray(Vector &vector) const
get primal ray in case of unboundedness.
Definition: spxsolve.cpp:1852
Basis is primal feasible.
Definition: spxbasis.h:96
LP has a usable Basis (maybe LP is changed).
Definition: spxsolver.h:216
dual infeasibility was detected
Definition: spxsimplifier.h:85
virtual Status getSlacks(Vector &vector) const
get vector of slack variables.
Definition: spxsolve.cpp:1888
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2029
LP has been proven to be primal unbounded.
Definition: spxsolver.h:220
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:206