Scippy

SoPlex

Sequential object-oriented simPlex

soplex.h
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-2017 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 /**@file soplex.h
17  * @brief Preconfigured SoPlex LP solver
18  */
19 
20 #ifndef _SOPLEX_H_
21 #define _SOPLEX_H_
22 
23 #ifndef SOPLEX_LEGACY
24 #include <string.h>
25 
26 ///@todo SoPlex should also have an spxout object to avoid using a global one
27 #include "spxdefines.h"
28 #include "basevectors.h"
29 #include "spxsolver.h"
30 #include "slufactor.h"
31 #include "slufactor_rational.h"
32 
33 ///@todo try to move to cpp file by forward declaration
34 #include "spxsimplifier.h"
35 #include "spxmainsm.h"
36 
37 #include "spxscaler.h"
38 #include "spxequilisc.h"
39 #include "spxleastsqsc.h"
40 #include "spxgeometsc.h"
41 
42 #include "spxstarter.h"
43 #include "spxweightst.h"
44 #include "spxsumst.h"
45 #include "spxvectorst.h"
46 
47 #include "spxpricer.h"
48 #include "spxautopr.h"
49 #include "spxdantzigpr.h"
50 #include "spxparmultpr.h"
51 #include "spxdevexpr.h"
52 #include "spxsteeppr.h"
53 #include "spxsteepexpr.h"
54 #include "spxhybridpr.h"
55 
56 #include "spxratiotester.h"
57 #include "spxdefaultrt.h"
58 #include "spxharrisrt.h"
59 #include "spxfastrt.h"
60 #include "spxboundflippingrt.h"
61 
62 #include "sol.h"
63 
64 #define DEFAULT_RANDOM_SEED 0 // used to suppress output when the seed was not changed
65 
66 ///@todo implement automatic rep switch, based on row/col dim
67 ///@todo introduce status codes for SoPlex, especially for rational solving
68 
69 ///@todo record and return "best" solutions found during IR (Ambros)
70 ///@todo implement main IR loop for primal and dual feasible case with fail otherwise (Ambros)
71 ///@todo implement statistical info (time, factor time, iters, ...) since last call to solveReal() or solveRational() (Ambros?)
72 ///@todo implement performInfeasibilityIR (Ambros?)
73 ///@todo extend IR loop to infeasible case (Dan?)
74 ///@todo extend IR loop to unbounded case (Dan?)
75 
76 ///@todo interface rational reconstruction code for rational vectors
77 ///@todo integrate rational reconstruction into IR loop
78 ///@todo templatize SPxSolver and necessary components (SLUFactor, pricer, ratiotester)
79 ///@todo integrate rational SPxSolver and distinguish between original and transformed rational LP
80 ///@todo rational scalers
81 ///@todo rational simplifier
82 
83 namespace soplex
84 {
85 
86 /**@class SoPlex
87  * @brief Preconfigured SoPlex LP-solver.
88  * @ingroup Algo
89  */
90 class SoPlex
91 {
92 public:
93 
94  //**@name Construction and destruction */
95  //@{
96 
97  /// default constructor
98  SoPlex();
99 
100  /// assignment operator
101  SoPlex& operator=(const SoPlex& rhs);
102 
103  /// copy constructor
104  SoPlex(const SoPlex& rhs);
105 
106  /// destructor
107  virtual ~SoPlex();
108 
109  //@}
110 
111 
112  //**@name Access to the real LP */
113  //@{
114 
115  /// returns number of rows
116  int numRowsReal() const;
117 
118  /// returns number of columns
119  int numColsReal() const;
120 
121  /// returns number of nonzeros
122  int numNonzerosReal() const;
123 
124  /// returns smallest non-zero element in absolute value
125  Real minAbsNonzeroReal() const;
126 
127  /// returns biggest non-zero element in absolute value
128  Real maxAbsNonzeroReal() const;
129 
130  /// returns (unscaled) coefficient
131  Real coefReal(int row, int col) const;
132 
133  /// returns vector of row \p i, ignoring scaling
134  const SVectorReal& rowVectorRealInternal(int i) const;
135 
136  /// gets vector of row \p i
137  void getRowVectorReal(int i, DSVectorReal& row) const;
138 
139  /// returns right-hand side vector, ignoring scaling
140  const VectorReal& rhsRealInternal() const;
141 
142  /// gets right-hand side vector
143  void getRhsReal(DVectorReal& rhs) const;
144 
145  /// returns right-hand side of row \p i
146  Real rhsReal(int i) const;
147 
148  /// returns left-hand side vector, ignoring scaling
149  const VectorReal& lhsRealInternal() const;
150 
151  /// gets left-hand side vector
152  void getLhsReal(DVectorReal& lhs) const;
153 
154  /// returns left-hand side of row \p i
155  Real lhsReal(int i) const;
156 
157  /// returns inequality type of row \p i
158  LPRowReal::Type rowTypeReal(int i) const;
159 
160  /// returns vector of col \p i, ignoring scaling
161  const SVectorReal& colVectorRealInternal(int i) const;
162 
163  /// gets vector of col \p i
164  void getColVectorReal(int i, DSVectorReal& col) const;
165 
166  /// returns upper bound vector
167  const VectorReal& upperRealInternal() const;
168 
169  /// returns upper bound of column \p i
170  Real upperReal(int i) const;
171 
172  /// gets upper bound vector
173  void getUpperReal(DVectorReal& upper) const;
174 
175  /// returns lower bound vector
176  const VectorReal& lowerRealInternal() const;
177 
178  /// returns lower bound of column \p i
179  Real lowerReal(int i) const;
180 
181  /// gets lower bound vector
182  void getLowerReal(DVectorReal& lower) const;
183 
184  /// gets objective function vector
185  void getObjReal(VectorReal& obj) const;
186 
187  /// returns objective value of column \p i
188  Real objReal(int i) const;
189 
190  /// returns objective function vector after transformation to a maximization problem; since this is how it is stored
191  /// internally, this is generally faster
192  const VectorReal& maxObjRealInternal() const;
193 
194  /// returns objective value of column \p i after transformation to a maximization problem; since this is how it is
195  /// stored internally, this is generally faster
196  Real maxObjReal(int i) const;
197 
198  /// gets number of available dual norms
199  void getNdualNorms(int& nnormsRow, int& nnormsCol) const;
200 
201  /// gets steepest edge norms and returns false if they are not available
202  bool getDualNorms(int& nnormsRow, int& nnormsCol, Real* norms) const;
203 
204  /// sets steepest edge norms and returns false if that's not possible
205  bool setDualNorms(int nnormsRow, int nnormsCol, Real* norms);
206 
207  /// pass integrality information about the variables to the solver
208  void setIntegralityInformation(int ncols, int* intInfo);
209 
210  //@}
211 
212 
213  //**@name Access to the rational LP */
214  //@{
215 
216  /// returns number of rows
217  int numRowsRational() const;
218 
219  /// returns number of columns
220  int numColsRational() const;
221 
222  /// returns number of nonzeros
223  int numNonzerosRational() const;
224 
225  /// returns smallest non-zero element in absolute value
227 
228  /// returns biggest non-zero element in absolute value
230 
231  /// gets row \p i
232  void getRowRational(int i, LPRowRational& lprow) const;
233 
234  /// gets rows \p start, ..., \p end.
235  void getRowsRational(int start, int end, LPRowSetRational& lprowset) const;
236 
237  /// returns vector of row \p i
238  const SVectorRational& rowVectorRational(int i) const;
239 
240  /// returns right-hand side vector
241  const VectorRational& rhsRational() const;
242 
243  /// returns right-hand side of row \p i
244  const Rational& rhsRational(int i) const;
245 
246  /// returns left-hand side vector
247  const VectorRational& lhsRational() const;
248 
249  /// returns left-hand side of row \p i
250  const Rational& lhsRational(int i) const;
251 
252  /// returns inequality type of row \p i
254 
255  /// gets column \p i
256  void getColRational(int i, LPColRational& lpcol) const;
257 
258  /// gets columns \p start, ..., \p end
259  void getColsRational(int start, int end, LPColSetRational& lpcolset) const;
260 
261  /// returns vector of column \p i
262  const SVectorRational& colVectorRational(int i) const;
263 
264  /// returns upper bound vector
265  const VectorRational& upperRational() const;
266 
267  /// returns upper bound of column \p i
268  const Rational& upperRational(int i) const;
269 
270  /// returns lower bound vector
271  const VectorRational& lowerRational() const;
272 
273  /// returns lower bound of column \p i
274  const Rational& lowerRational(int i) const;
275 
276  /// gets objective function vector
277  void getObjRational(VectorRational& obj) const;
278 
279  /// gets objective value of column \p i
280  void getObjRational(int i, Rational& obj) const;
281 
282  /// returns objective value of column \p i
283  Rational objRational(int i) const;
284 
285  /// returns objective function vector after transformation to a maximization problem; since this is how it is stored
286  /// internally, this is generally faster
287  const VectorRational& maxObjRational() const;
288 
289  /// returns objective value of column \p i after transformation to a maximization problem; since this is how it is
290  /// stored internally, this is generally faster
291  const Rational& maxObjRational(int i) const;
292 
293  //@}
294 
295 
296  //**@name Modification of the real LP */
297  //@{
298 
299  /// adds a single row
300  void addRowReal(const LPRowReal& lprow);
301 
302  /// adds multiple rows
303  void addRowsReal(const LPRowSetReal& lprowset);
304 
305  /// adds a single column
306  void addColReal(const LPCol& lpcol);
307 
308  /// adds multiple columns
309  void addColsReal(const LPColSetReal& lpcolset);
310 
311  /// replaces row \p i with \p lprow
312  void changeRowReal(int i, const LPRowReal& lprow);
313 
314  /// changes left-hand side vector for constraints to \p lhs
315  void changeLhsReal(const VectorReal& lhs);
316 
317  /// changes left-hand side of row \p i to \p lhs
318  void changeLhsReal(int i, const Real& lhs);
319 
320  /// changes right-hand side vector to \p rhs
321  void changeRhsReal(const VectorReal& rhs);
322 
323  /// changes right-hand side of row \p i to \p rhs
324  void changeRhsReal(int i, const Real& rhs);
325 
326  /// changes left- and right-hand side vectors
327  void changeRangeReal(const VectorReal& lhs, const VectorReal& rhs);
328 
329  /// changes left- and right-hand side of row \p i
330  void changeRangeReal(int i, const Real& lhs, const Real& rhs);
331 
332  /// replaces column \p i with \p lpcol
333  void changeColReal(int i, const LPColReal& lpcol);
334 
335  /// changes vector of lower bounds to \p lower
336  void changeLowerReal(const VectorReal& lower);
337 
338  /// changes lower bound of column i to \p lower
339  void changeLowerReal(int i, const Real& lower);
340 
341  /// changes vector of upper bounds to \p upper
342  void changeUpperReal(const VectorReal& upper);
343 
344  /// changes \p i 'th upper bound to \p upper
345  void changeUpperReal(int i, const Real& upper);
346 
347  /// changes vectors of column bounds to \p lower and \p upper
348  void changeBoundsReal(const VectorReal& lower, const VectorReal& upper);
349 
350  /// changes bounds of column \p i to \p lower and \p upper
351  void changeBoundsReal(int i, const Real& lower, const Real& upper);
352 
353  /// changes objective function vector to \p obj
354  void changeObjReal(const VectorReal& obj);
355 
356  /// changes objective coefficient of column i to \p obj
357  void changeObjReal(int i, const Real& obj);
358 
359  /// changes matrix entry in row \p i and column \p j to \p val
360  void changeElementReal(int i, int j, const Real& val);
361 
362  /// removes row \p i
363  void removeRowReal(int i);
364 
365  /// removes all rows with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the
366  /// new index where row \p i has been moved to; note that \p perm must point to an array of size at least
367  /// #numRowsReal()
368  void removeRowsReal(int perm[]);
369 
370  /// remove all rows with indices in array \p idx of size \p n; an array \p perm of size #numRowsReal() may be passed
371  /// as buffer memory
372  void removeRowsReal(int idx[], int n, int perm[] = 0);
373 
374  /// removes rows \p start to \p end including both; an array \p perm of size #numRowsReal() may be passed as buffer
375  /// memory
376  void removeRowRangeReal(int start, int end, int perm[] = 0);
377 
378  /// removes column i
379  void removeColReal(int i);
380 
381  /// removes all columns with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the
382  /// new index where column \p i has been moved to; note that \p perm must point to an array of size at least
383  /// #numColsReal()
384  void removeColsReal(int perm[]);
385 
386  /// remove all columns with indices in array \p idx of size \p n; an array \p perm of size #numColsReal() may be
387  /// passed as buffer memory
388  void removeColsReal(int idx[], int n, int perm[] = 0);
389 
390  /// removes columns \p start to \p end including both; an array \p perm of size #numColsReal() may be passed as
391  /// buffer memory
392  void removeColRangeReal(int start, int end, int perm[] = 0);
393 
394  /// clears the LP
395  void clearLPReal();
396 
397  /// synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP, if sync mode is manual
398  void syncLPReal();
399 
400  //@}
401 
402 
403  //**@name Modification of the rational LP */
404  //@{
405 
406  /// adds a single row
407  void addRowRational(const LPRowRational& lprow);
408 
409 #ifdef SOPLEX_WITH_GMP
410  /// adds a single row
411  void addRowRational(const mpq_t* lhs, const mpq_t* rowValues, const int* rowIndices, const int rowSize, const mpq_t* rhs);
412 
413  /// adds a set of rows
414  void addRowsRational(const mpq_t* lhs, const mpq_t* rowValues, const int* rowIndices, const int* rowStarts, const int* rowLengths, const int numRows, const int numValues, const mpq_t* rhs);
415 #endif
416 
417  /// adds multiple rows
418  void addRowsRational(const LPRowSetRational& lprowset);
419 
420  /// adds a single column
421  void addColRational(const LPColRational& lpcol);
422 
423 #ifdef SOPLEX_WITH_GMP
424  /// adds a single column
425  void addColRational(const mpq_t* obj, const mpq_t* lower, const mpq_t* colValues, const int* colIndices, const int colSize, const mpq_t* upper);
426 
427  /// adds a set of columns
428  void addColsRational(const mpq_t* obj, const mpq_t* lower, const mpq_t* colValues, const int* colIndices, const int* colStarts, const int* colLengths, const int numCols, const int numValues, const mpq_t* upper);
429 #endif
430 
431  /// adds multiple columns
432  void addColsRational(const LPColSetRational& lpcolset);
433 
434  /// replaces row \p i with \p lprow
435  void changeRowRational(int i, const LPRowRational& lprow);
436 
437  /// changes left-hand side vector for constraints to \p lhs
438  void changeLhsRational(const VectorRational& lhs);
439 
440  /// changes left-hand side of row \p i to \p lhs
441  void changeLhsRational(int i, const Rational& lhs);
442 
443 #ifdef SOPLEX_WITH_GMP
444  /// changes left-hand side of row \p i to \p lhs
445  void changeLhsRational(int i, const mpq_t* lhs);
446 #endif
447 
448  /// changes right-hand side vector to \p rhs
449  void changeRhsRational(const VectorRational& rhs);
450 
451 #ifdef SOPLEX_WITH_GMP
452  /// changes right-hand side vector to \p rhs
453  void changeRhsRational(const mpq_t* rhs, int rhsSize);
454 #endif
455 
456  /// changes right-hand side of row \p i to \p rhs
457  void changeRhsRational(int i, const Rational& rhs);
458 
459  /// changes left- and right-hand side vectors
460  void changeRangeRational(const VectorRational& lhs, const VectorRational& rhs);
461 
462  /// changes left- and right-hand side of row \p i
463  void changeRangeRational(int i, const Rational& lhs, const Rational& rhs);
464 
465 #ifdef SOPLEX_WITH_GMP
466  /// changes left- and right-hand side of row \p i
467  void changeRangeRational(int i, const mpq_t* lhs, const mpq_t* rhs);
468 #endif
469 
470  /// replaces column \p i with \p lpcol
471  void changeColRational(int i, const LPColRational& lpcol);
472 
473  /// changes vector of lower bounds to \p lower
474  void changeLowerRational(const VectorRational& lower);
475 
476  /// changes lower bound of column i to \p lower
477  void changeLowerRational(int i, const Rational& lower);
478 
479 #ifdef SOPLEX_WITH_GMP
480  /// changes lower bound of column i to \p lower
481  void changeLowerRational(int i, const mpq_t* lower);
482 #endif
483 
484  /// changes vector of upper bounds to \p upper
485  void changeUpperRational(const VectorRational& upper);
486 
487  /// changes \p i 'th upper bound to \p upper
488  void changeUpperRational(int i, const Rational& upper);
489 
490 #ifdef SOPLEX_WITH_GMP
491  /// changes upper bound of column i to \p upper
492  void changeUpperRational(int i, const mpq_t* upper);
493 #endif
494 
495  /// changes vectors of column bounds to \p lower and \p upper
496  void changeBoundsRational(const VectorRational& lower, const VectorRational& upper);
497 
498  /// changes bounds of column \p i to \p lower and \p upper
499  void changeBoundsRational(int i, const Rational& lower, const Rational& upper);
500 
501 #ifdef SOPLEX_WITH_GMP
502  /// changes bounds of column \p i to \p lower and \p upper
503  void changeBoundsRational(int i, const mpq_t* lower, const mpq_t* upper);
504 #endif
505 
506  /// changes objective function vector to \p obj
507  void changeObjRational(const VectorRational& obj);
508 
509  /// changes objective coefficient of column i to \p obj
510  void changeObjRational(int i, const Rational& obj);
511 
512 #ifdef SOPLEX_WITH_GMP
513  /// changes objective coefficient of column i to \p obj
514  void changeObjRational(int i, const mpq_t* obj);
515 #endif
516 
517  /// changes matrix entry in row \p i and column \p j to \p val
518  void changeElementRational(int i, int j, const Rational& val);
519 
520 #ifdef SOPLEX_WITH_GMP
521  /// changes matrix entry in row \p i and column \p j to \p val
522  void changeElementRational(int i, int j, const mpq_t* val);
523 #endif
524 
525  /// removes row \p i
526  void removeRowRational(int i);
527 
528  /// removes all rows with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the new
529  /// index where row \p i has been moved to; note that \p perm must point to an array of size at least
530  /// #numRowsRational()
531  void removeRowsRational(int perm[]);
532 
533  /// remove all rows with indices in array \p idx of size \p n; an array \p perm of size #numRowsRational() may be
534  /// passed as buffer memory
535  void removeRowsRational(int idx[], int n, int perm[] = 0);
536 
537  /// removes rows \p start to \p end including both; an array \p perm of size #numRowsRational() may be passed as
538  /// buffer memory
539  void removeRowRangeRational(int start, int end, int perm[] = 0);
540 
541  /// removes column i
542  void removeColRational(int i);
543 
544  /// removes all columns with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the
545  /// new index where column \p i has been moved to; note that \p perm must point to an array of size at least
546  /// #numColsRational()
547  void removeColsRational(int perm[]);
548 
549  /// remove all columns with indices in array \p idx of size \p n; an array \p perm of size #numColsRational() may be
550  /// passed as buffer memory
551  void removeColsRational(int idx[], int n, int perm[] = 0);
552 
553  /// removes columns \p start to \p end including both; an array \p perm of size #numColsRational() may be passed as
554  /// buffer memory
555  void removeColRangeRational(int start, int end, int perm[] = 0);
556 
557  /// clears the LP
558  void clearLPRational();
559 
560  /// synchronizes rational LP with real LP, i.e., copies real LP to rational LP, if sync mode is manual
561  void syncLPRational();
562 
563  //@}
564 
565 
566  //**@name Solving and general solution query */
567  //@{
568 
569  /// optimize the given LP
571 
572  // old name for backwards compatibility
574  {
575  return optimize();
576  }
577 
578  /// returns the current solver status
579  SPxSolver::Status status() const;
580 
581  /// is stored primal solution feasible?
582  bool isPrimalFeasible() const;
583 
584  /// is a primal feasible solution available?
585  bool hasPrimal() const;
586 
587  /// is a primal unbounded ray available?
588  bool hasPrimalRay() const;
589 
590  /// is stored dual solution feasible?
591  bool isDualFeasible() const;
592 
593  /// is a dual feasible solution available?
594  bool hasDual() const;
595 
596  /// is Farkas proof of infeasibility available?
597  bool hasDualFarkas() const;
598 
599  //@}
600 
601 
602  //**@name Query for the real solution data */
603  //@{
604 
605  /// returns the objective value if a primal solution is available
606  Real objValueReal();
607 
608  /// gets the primal solution vector if available; returns true on success
609  bool getPrimalReal(VectorReal& vector);
610 
611  /// gets the vector of slack values if available; returns true on success
612  bool getSlacksReal(VectorReal& vector);
613 
614  /// gets the primal ray if available; returns true on success
615  bool getPrimalRayReal(VectorReal& vector);
616 
617  /// gets the dual solution vector if available; returns true on success
618  bool getDualReal(VectorReal& vector);
619 
620  /// gets the vector of reduced cost values if available; returns true on success
621  bool getRedCostReal(VectorReal& vector);
622 
623  /// gets the Farkas proof if available; returns true on success
624  bool getDualFarkasReal(VectorReal& vector);
625 
626  /// gets violation of bounds; returns true on success
627  bool getBoundViolationReal(Real& maxviol, Real& sumviol);
628 
629  /// gets violation of constraints; returns true on success
630  bool getRowViolationReal(Real& maxviol, Real& sumviol);
631 
632  /// gets violation of reduced costs; returns true on success
633  bool getRedCostViolationReal(Real& maxviol, Real& sumviol);
634 
635  /// gets violation of dual multipliers; returns true on success
636  bool getDualViolationReal(Real& maxviol, Real& sumviol);
637 
638  //@}
639 
640 
641  //**@name Query for the rational solution data */
642  //@{
643 
644  /// returns the objective value if a primal solution is available
646 
647  /// gets the primal solution vector if available; returns true on success
648  bool getPrimalRational(VectorRational& vector);
649 
650  /// gets the vector of slack values if available; returns true on success
651  bool getSlacksRational(VectorRational& vector);
652 
653  /// gets the primal ray if LP is unbounded; returns true on success
654  bool getPrimalRayRational(VectorRational& vector);
655 
656  /// gets the dual solution vector if available; returns true on success
657  bool getDualRational(VectorRational& vector);
658 
659  /// gets the vector of reduced cost values if available; returns true on success
660  bool getRedCostRational(VectorRational& vector);
661 
662  /// gets the Farkas proof if LP is infeasible; returns true on success
664 
665  /// gets violation of bounds; returns true on success
666  bool getBoundViolationRational(Rational& maxviol, Rational& sumviol);
667 
668  /// gets violation of constraints; returns true on success
669  bool getRowViolationRational(Rational& maxviol, Rational& sumviol);
670 
671  /// gets violation of reduced costs; returns true on success
672  bool getRedCostViolationRational(Rational& maxviol, Rational& sumviol);
673 
674  /// gets violation of dual multipliers; returns true on success
675  bool getDualViolationRational(Rational& maxviol, Rational& sumviol);
676 
677 #ifdef SOPLEX_WITH_GMP
678  /// gets the primal solution vector if available; returns true on success
679  bool getPrimalRational(mpq_t* vector, const int size);
680 
681  /// gets the vector of slack values if available; returns true on success
682  bool getSlacksRational(mpq_t* vector, const int size);
683 
684  /// gets the primal ray if LP is unbounded; returns true on success
685  bool getPrimalRayRational(mpq_t* vector, const int size);
686 
687  /// gets the dual solution vector if available; returns true on success
688  bool getDualRational(mpq_t* vector, const int size);
689 
690  /// gets the vector of reduced cost values if available; returns true on success
691  bool getRedCostRational(mpq_t* vector, const int size);
692 
693  /// gets the Farkas proof if LP is infeasible; returns true on success
694  bool getDualFarkasRational(mpq_t* vector, const int size);
695 #endif
696 
697  /// get size of primal solution
698  int totalSizePrimalRational(const int base = 2);
699 
700  /// get size of dual solution
701  int totalSizeDualRational(const int base = 2);
702 
703  /// get size of least common multiple of denominators in primal solution
704  int dlcmSizePrimalRational(const int base = 2);
705 
706  /// get size of least common multiple of denominators in dual solution
707  int dlcmSizeDualRational(const int base = 2);
708 
709  /// get size of largest denominator in primal solution
710  int dmaxSizePrimalRational(const int base = 2);
711 
712  /// get size of largest denominator in dual solution
713  int dmaxSizeDualRational(const int base = 2);
714 
715  //@}
716 
717 
718  //**@name Access and modification of basis information */
719  //@{
720 
721  /// is an advanced starting basis available?
722  bool hasBasis() const;
723 
724  /// returns the current basis status
726 
727  /// returns basis status for a single row
728  SPxSolver::VarStatus basisRowStatus(int row) const;
729 
730  /// returns basis status for a single column
731  SPxSolver::VarStatus basisColStatus(int col) const;
732 
733  /// gets current basis via arrays of statuses
734  void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[]) const;
735 
736  /// gets the indices of the basic columns and rows; basic column n gives value n, basic row m gives value -1-m
737  void getBasisInd(int* bind) const;
738 
739  /// compute condition number estimate based on the diagonal of the LU factorization; returns true on success
740  /// type = 0: max/min ratio
741  /// type = 1: trace of U (sum of diagonal elements)
742  /// type = 2: product of diagonal elements
743  bool getFastCondition(Real& condition, int type = 0);
744 
745  /// computes an estimated condition number for the current basis matrix using the power method; returns true on success
746  bool getEstimatedCondition(Real& condition);
747 
748  /// computes the exact condition number for the current basis matrix using the power method; returns true on success
749  bool getExactCondition(Real& condition);
750 
751  /// computes row \p r of basis inverse; returns true on success
752  /// @param r which row of the basis inverse is computed
753  /// @param coef values of result vector (not packed but scattered)
754  /// @param inds indices of result vector (NULL if not to be used)
755  /// @param ninds number of nonzeros in result vector
756  /// @param unscale determines whether the result should be unscaled according to the original LP data
757  bool getBasisInverseRowReal(int r, Real* coef, int* inds = NULL, int* ninds = NULL, bool unscale = true);
758 
759  /// computes column \p c of basis inverse; returns true on success
760  /// @param c which column of the basis inverse is computed
761  /// @param coef values of result vector (not packed but scattered)
762  /// @param inds indices of result vector (NULL if not to be used)
763  /// @param ninds number of nonzeros in result vector
764  /// @param unscale determines whether the result should be unscaled according to the original LP data
765  bool getBasisInverseColReal(int c, Real* coef, int* inds = NULL, int* ninds = NULL, bool unscale = true);
766 
767  /// computes dense solution of basis matrix B * \p sol = \p rhs; returns true on success
768  bool getBasisInverseTimesVecReal(Real* rhs, Real* sol, bool unscale = true);
769 
770  /// multiply with basis matrix; B * \p vec (inplace)
771  /// @param vec (dense) vector to be multiplied with
772  /// @param unscale determines whether the result should be unscaled according to the original LP data
773  bool multBasis(Real* vec, bool unscale = true);
774 
775  /// multiply with transpose of basis matrix; \p vec * B^T (inplace)
776  /// @param vec (dense) vector to be multiplied with
777  /// @param unscale determines whether the result should be unscaled according to the original LP data
778  bool multBasisTranspose(Real* vec, bool unscale = true);
779 
780  /// compute rational basis inverse; returns true on success
782 
783  /// gets an array of indices for the columns of the rational basis matrix; bind[i] >= 0 means that the i-th column of
784  /// the basis matrix contains variable bind[i]; bind[i] < 0 means that the i-th column of the basis matrix contains
785  /// the slack variable for row -bind[i]-1; performs rational factorization if not available; returns true on success
787 
788  /// computes row r of basis inverse; performs rational factorization if not available; returns true on success
789  bool getBasisInverseRowRational(const int r, SSVectorRational& vec);
790 
791  /// computes column c of basis inverse; performs rational factorization if not available; returns true on success
792  bool getBasisInverseColRational(const int c, SSVectorRational& vec);
793 
794  /// computes solution of basis matrix B * sol = rhs; performs rational factorization if not available; returns true
795  /// on success
797 
798  /// sets starting basis via arrays of statuses
799  void setBasis(const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[]);
800 
801  /// clears starting basis
802  void clearBasis();
803 
804  //@}
805 
806 
807  //**@name Statistical information */
808  //@{
809 
810  /// number of iterations since last call to solve
811  int numIterations() const;
812 
813  /// time spent in last call to solve
814  Real solveTime() const;
815 
816  /// statistical information in form of a string
817  std::string statisticString() const;
818 
819  /// name of starter
820  const char* getStarterName();
821 
822  /// name of simplifier
823  const char* getSimplifierName();
824 
825  /// name of scaling method
826  const char* getScalerName();
827 
828  /// name of currently loaded pricer
829  const char* getPricerName();
830 
831  /// name of currently loaded ratiotester
832  const char* getRatiotesterName();
833 
834  //@}
835 
836 
837  //**@name File I/O */
838  //@{
839 
840  /// reads LP file in LP or MPS format according to READMODE parameter; gets row names, column names, and
841  /// integer variables if desired; returns true on success
842  bool readFile(const char* filename, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0);
843 
844  /// writes real LP to file; LP or MPS format is chosen from the extension in \p filename; if \p rowNames and \p
845  /// colNames are \c NULL, default names are used; if \p intVars is not \c NULL, the variables contained in it are
846  /// marked as integer; returns true on success
847  bool writeFileReal(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const DIdxSet* intvars = 0, const bool unscale = true) const;
848 
849  /// writes rational LP to file; LP or MPS format is chosen from the extension in \p filename; if \p rowNames and \p
850  /// colNames are \c NULL, default names are used; if \p intVars is not \c NULL, the variables contained in it are
851  /// marked as integer; returns true on success
852  bool writeFileRational(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const DIdxSet* intvars = 0) const;
853 
854  /// writes the dual of the real LP to file; LP or MPS format is chosen from the extension in \p filename;
855  /// if \p rowNames and \p colNames are \c NULL, default names are used; if \p intVars is not \c NULL,
856  /// the variables contained in it are marked as integer; returns true on success
857  bool writeDualFileReal(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const DIdxSet* intvars = 0) const;
858 
859  /// reads basis information from \p filename and returns true on success; if \p rowNames and \p colNames are \c NULL,
860  /// default names are assumed; returns true on success
861  bool readBasisFile(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0);
862 
863  /// writes basis information to \p filename; if \p rowNames and \p colNames are \c NULL, default names are used;
864  /// returns true on success
865  bool writeBasisFile(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const bool cpxFormat = false) const;
866 
867  /// writes internal LP, basis information, and parameter settings; if \p rowNames and \p colNames are \c NULL,
868  /// default names are used
869  void writeStateReal(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const bool cpxFormat = false) const;
870 
871  /// writes internal LP, basis information, and parameter settings; if \p rowNames and \p colNames are \c NULL,
872  /// default names are used
873  void writeStateRational(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const bool cpxFormat = false) const;
874 
875  //@}
876 
877 
878  //**@name Parameters */
879  //@{
880 
881  /// boolean parameters
882  typedef enum
883  {
884  /// should lifting be used to reduce range of nonzero matrix coefficients?
885  LIFTING = 0,
886 
887  /// should LP be transformed to equality form before a rational solve?
888  EQTRANS = 1,
889 
890  /// should dual infeasibility be tested in order to try to return a dual solution even if primal infeasible?
892 
893  /// should a rational factorization be performed after iterative refinement?
894  RATFAC = 3,
895 
896  /// should the decomposition based dual simplex be used to solve the LP? Setting this to true forces the solve mode to
897  /// SOLVEMODE_REAL and the basis representation to REPRESENTATION_ROW
899 
900  /// should the degeneracy be computed for each basis?
902 
903  /// should the dual of the complementary problem be used in the decomposition simplex?
905 
906  /// should row and bound violations be computed explicitly in the update of reduced problem in the decomposition simplex
908 
909  /// should cycling solutions be accepted during iterative refinement?
911 
912  /// apply rational reconstruction after each iterative refinement?
913  RATREC = 9,
914 
915  /// round scaling factors for iterative refinement to powers of two?
917 
918  /// continue iterative refinement with exact basic solution if not optimal?
920 
921  /// use bound flipping also for row representation?
923 
924  /// use persistent scaling?
926 
927  /// perturb the entire problem or only the relevant bounds of s single pivot?
929 
930  /// number of boolean parameters
932  } BoolParam;
933 
934  /// integer parameters
935  typedef enum
936  {
937  /// objective sense
938  OBJSENSE = 0,
939 
940  /// type of computational form, i.e., column or row representation
942 
943  /// type of algorithm, i.e., primal or dual
945 
946  /// type of LU update
948 
949  /// maximum number of updates without fresh factorization
951 
952  /// iteration limit (-1 if unlimited)
954 
955  /// refinement limit (-1 if unlimited)
956  REFLIMIT = 6,
957 
958  /// stalling refinement limit (-1 if unlimited)
960 
961  /// display frequency
963 
964  /// verbosity level
966 
967  /// type of simplifier
969 
970  /// type of scaler
971  SCALER = 11,
972 
973  /// type of starter used to create crash basis
974  STARTER = 12,
975 
976  /// type of pricer
977  PRICER = 13,
978 
979  /// type of ratio test
981 
982  /// mode for synchronizing real and rational LP
983  SYNCMODE = 15,
984 
985  /// mode for reading LP files
986  READMODE = 16,
987 
988  /// mode for iterative refinement strategy
989  SOLVEMODE = 17,
990 
991  /// mode for a posteriori feasibility checks
992  CHECKMODE = 18,
993 
994  /// type of timer
995  TIMER = 19,
996 
997  /// mode for hyper sparse pricing
999 
1000  /// minimum number of stalling refinements since last pivot to trigger rational factorization
1002 
1003  /// maximum number of conjugate gradient iterations in least square scaling
1005 
1006  /// mode for solution polishing
1008 
1009  /// the number of iterations before the decomposition simplex initialisation is terminated.
1011 
1012  /// the maximum number of rows that are added in each iteration of the decomposition based simplex
1014 
1015  /// the iteration frequency at which the decomposition solve output is displayed.
1017 
1018  /// the verbosity of the decomposition based simplex
1020 
1021  /// print condition number during the solve
1023 
1024  /// number of integer parameters
1026  } IntParam;
1027 
1028  /// values for parameter OBJSENSE
1029  enum
1030  {
1031  /// minimization
1033 
1034  /// maximization
1036  };
1037 
1038  /// values for parameter REPRESENTATION
1039  enum
1040  {
1041  /// automatic choice according to number of rows and columns
1043 
1044  /// column representation Ax - s = 0, lower <= x <= upper, lhs <= s <= rhs
1046 
1047  /// row representation (lower,lhs) <= (x,Ax) <= (upper,rhs)
1049  };
1050 
1051  /// values for parameter ALGORITHM
1052  enum
1053  {
1054  /// primal simplex algorithm, i.e., entering for column and leaving for row representation
1056 
1057  /// dual simplex algorithm, i.e., leaving for column and entering for row representation
1059  };
1060 
1061  /// values for parameter FACTOR_UPDATE_TYPE
1062  enum
1063  {
1064  /// product form update
1066 
1067  /// Forrest-Tomlin type update
1069  };
1070 
1071  /// values for parameter VERBOSITY
1072  enum
1073  {
1074  /// only error output
1076 
1077  /// only error and warning output
1079 
1080  /// only error, warning, and debug output
1082 
1083  /// standard verbosity level
1085 
1086  /// high verbosity level
1088 
1089  /// full verbosity level
1091  };
1092 
1093  /// values for parameter SIMPLIFIER
1094  enum
1095  {
1096  /// no simplifier
1098 
1099  /// automatic choice
1101  };
1102 
1103  /// values for parameter SCALER
1104  enum
1105  {
1106  /// no scaler
1108 
1109  /// equilibrium scaling on rows or columns
1111 
1112  /// equilibrium scaling on rows and columns
1114 
1115  /// geometric mean scaling on rows and columns, max 1 round
1117 
1118  /// geometric mean scaling on rows and columns, max 8 rounds
1120 
1121  /// least square scaling
1123 
1124  /// geometric mean scaling (max 8 rounds) followed by equilibrium scaling (rows and columns)
1126  };
1127 
1128  /// values for parameter STARTER
1129  enum
1130  {
1131  /// slack basis
1133 
1134  /// greedy crash basis weighted by objective, bounds, and sides
1136 
1137  /// crash basis from a greedy solution
1139 
1140  /// generic solution-based crash basis
1142  };
1143 
1144  /// values for parameter PRICER
1145  enum
1146  {
1147  /// automatic pricer
1149 
1150  /// Dantzig pricer
1152 
1153  /// partial multiple pricer based on Dantzig pricing
1155 
1156  /// devex pricer
1158 
1159  /// steepest edge pricer with initialization to unit norms
1161 
1162  /// steepest edge pricer with exact initialization of norms
1164  };
1165 
1166  /// values for parameter RATIOTESTER
1167  enum
1168  {
1169  /// textbook ratio test without stabilization
1171 
1172  /// standard Harris ratio test
1174 
1175  /// modified Harris ratio test
1177 
1178  /// bound flipping ratio test for long steps in the dual simplex
1180  };
1181 
1182  /// values for parameter SYNCMODE
1183  enum
1184  {
1185  /// store only real LP
1187 
1188  /// automatic sync of real and rational LP
1190 
1191  /// user sync of real and rational LP
1193  };
1194 
1195  /// values for parameter READMODE
1196  enum
1197  {
1198  /// standard floating-point parsing
1200 
1201  /// rational parsing
1203  };
1204 
1205  /// values for parameter SOLVEMODE
1206  enum
1207  {
1208  /// apply standard floating-point algorithm
1210 
1211  /// decide depending on tolerances whether to apply iterative refinement
1213 
1214  /// force iterative refinement
1216  };
1217 
1218  /// values for parameter CHECKMODE
1219  enum
1220  {
1221  /// floating-point check
1223 
1224  /// decide according to READMODE
1226 
1227  /// rational check
1229  };
1230 
1231  /// values for parameter TIMER
1232  enum
1233  {
1234  /// disable timing
1236 
1237  /// cpu or user time
1239 
1240  /// wallclock time
1242  };
1243 
1244  /// values for parameter HYPER_PRICING
1245  enum
1246  {
1247  /// never
1249 
1250  /// decide according to problem size
1252 
1253  /// always
1255  };
1256 
1257  /// values for parameter SOLUTION_POLISHING
1258  enum
1259  {
1260  /// no solution polishing
1262 
1263  /// maximize number of basic slack variables, i.e. more variables on bounds
1265 
1266  /// minimize number of basic slack variables, i.e. more variables between bounds
1268  };
1269 
1270  /// real parameters
1271  typedef enum
1272  {
1273  /// primal feasibility tolerance
1274  FEASTOL = 0,
1275 
1276  /// dual feasibility tolerance
1277  OPTTOL = 1,
1278 
1279  /// general zero tolerance
1281 
1282  /// zero tolerance used in factorization
1284 
1285  /// zero tolerance used in update of the factorization
1287 
1288  /// pivot zero tolerance used in factorization
1290 
1291  /// infinity threshold
1292  INFTY = 6,
1293 
1294  /// time limit in seconds (INFTY if unlimited)
1296 
1297  /// lower limit on objective value
1299 
1300  /// upper limit on objective value
1302 
1303  /// working tolerance for feasibility in floating-point solver during iterative refinement
1305 
1306  /// working tolerance for optimality in floating-point solver during iterative refinement
1307  FPOPTTOL = 11,
1308 
1309  /// maximum increase of scaling factors between refinements
1311 
1312  /// lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)
1314 
1315  /// upper threshold in lifting (nonzero matrix coefficients with larger absolute value will be reformulated)
1317 
1318  /// sparse pricing threshold (\#violations < dimension * SPARSITY_THRESHOLD activates sparse pricing)
1320 
1321  /// threshold on number of rows vs. number of columns for switching from column to row representations in auto mode
1323 
1324  /// geometric frequency at which to apply rational reconstruction
1326 
1327  /// minimal reduction (sum of removed rows/cols) to continue simplification
1328  MINRED = 18,
1329 
1330  /// refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix
1332 
1333  /// refactor threshold for fill-in in current factor update compared to fill-in in last factorization
1335 
1336  /// refactor threshold for memory growth in factorization since last refactorization
1338 
1339  /// accuracy of conjugate gradient method in least squares scaling (higher value leads to more iterations)
1341 
1342  /// objective offset
1344 
1345  /// number of real parameters
1347  } RealParam;
1348 
1349 #ifdef SOPLEX_WITH_RATIONALPARAM
1350  /// rational parameters
1351  typedef enum
1352  {
1353  /// number of rational parameters
1354  RATIONALPARAM_COUNT = 0
1355  } RationalParam;
1356 #endif
1357 
1358  /// class of parameter settings
1359  class Settings
1360  {
1361  public:
1362  static struct BoolParam {
1363  /// constructor
1364  BoolParam();
1365  /// array of names for boolean parameters
1367  /// array of descriptions for boolean parameters
1369  /// array of default values for boolean parameters
1371  } boolParam;
1372 
1373  static struct IntParam {
1374  /// constructor
1375  IntParam();
1376  /// array of names for integer parameters
1378  /// array of descriptions for integer parameters
1380  /// array of default values for integer parameters
1382  /// array of lower bounds for int parameter values
1384  /// array of upper bounds for int parameter values
1386  } intParam;
1387 
1388  static struct RealParam {
1389  /// constructor
1390  RealParam();
1391  /// array of names for real parameters
1393  /// array of descriptions for real parameters
1395  /// array of default values for real parameters
1397  /// array of lower bounds for real parameter values
1399  /// array of upper bounds for real parameter values
1401  } realParam;
1402 
1403 #ifdef SOPLEX_WITH_RATIONALPARAM
1404  static struct RationalParam {
1405  /// constructor
1406  RationalParam();
1407  /// array of names for rational parameters
1408  std::string name[SoPlex::RATIONALPARAM_COUNT];
1409  /// array of descriptions for rational parameters
1410  std::string description[SoPlex::RATIONALPARAM_COUNT];
1411  /// array of default values for rational parameters
1412  Rational defaultValue[SoPlex::RATIONALPARAM_COUNT];
1413  /// array of lower bounds for rational parameter values
1414  Rational lower[SoPlex::RATIONALPARAM_COUNT];
1415  /// array of upper bounds for rational parameter values
1416  Rational upper[SoPlex::RATIONALPARAM_COUNT];
1417  } rationalParam;
1418 #endif
1419 
1420  /// array of current boolean parameter values
1422 
1423  /// array of current integer parameter values
1425 
1426  /// array of current real parameter values
1428 
1429 #ifdef SOPLEX_WITH_RATIONALPARAM
1430  /// array of current rational parameter values
1431  Rational _rationalParamValues[SoPlex::RATIONALPARAM_COUNT];
1432 #endif
1433 
1434  /// default constructor initializing default settings
1435  Settings();
1436 
1437  /// copy constructor
1438  Settings(const Settings& settings);
1439 
1440  /// assignment operator
1442  };
1443 
1444  mutable SPxOut spxout;
1445 
1446  /// returns boolean parameter value
1447  bool boolParam(const BoolParam param) const;
1448 
1449  /// returns integer parameter value
1450  int intParam(const IntParam param) const;
1451 
1452  /// returns real parameter value
1453  Real realParam(const RealParam param) const;
1454 
1455 #ifdef SOPLEX_WITH_RATIONALPARAM
1456  /// returns rational parameter value
1457  Rational rationalParam(const RationalParam param) const;
1458 #endif
1459 
1460  /// returns current parameter settings
1461  const Settings& settings() const;
1462 
1463  /// sets boolean parameter value; returns true on success
1464  bool setBoolParam(const BoolParam param, const bool value, const bool init = true);
1465 
1466  /// sets integer parameter value; returns true on success
1467  bool setIntParam(const IntParam param, const int value, const bool init = true);
1468 
1469  /// sets real parameter value; returns true on success
1470  bool setRealParam(const RealParam param, const Real value, const bool init = true);
1471 
1472 #ifdef SOPLEX_WITH_RATIONALPARAM
1473  /// sets rational parameter value; returns true on success
1474  bool setRationalParam(const RationalParam param, const Rational value, const bool init = true);
1475 #endif
1476 
1477  /// sets parameter settings; returns true on success
1478  bool setSettings(const Settings& newSettings, const bool init = true);
1479 
1480  /// resets default parameter settings
1481  void resetSettings(const bool quiet = false, const bool init = true);
1482 
1483  /// print non-default parameter values
1484  void printUserSettings();
1485 
1486  /// writes settings file; returns true on success
1487  bool saveSettingsFile(const char* filename, const bool onlyChanged = false) const;
1488 
1489  /// reads settings file; returns true on success
1490  bool loadSettingsFile(const char* filename);
1491 
1492  /// parses one setting string and returns true on success; note that string is modified
1493  bool parseSettingsString(char* line);
1494 
1495  //@}
1496 
1497 
1498  //**@name Statistics */
1499  //@{
1500 
1501  /// prints solution statistics
1502  void printSolutionStatistics(std::ostream& os);
1503 
1504  /// prints statistics on solving process
1505  void printSolvingStatistics(std::ostream& os);
1506 
1507  /// prints short statistics
1508  void printShortStatistics(std::ostream& os);
1509 
1510  /// prints complete statistics
1511  void printStatistics(std::ostream& os);
1512 
1513  /// prints status
1514  void printStatus(std::ostream& os, SPxSolver::Status status);
1515 
1516  //@}
1517 
1518 
1519  //**@name Miscellaneous */
1520  //@{
1521 
1522  /// prints version and compilation options
1523  void printVersion() const;
1524 
1525  /// checks if real LP and rational LP are in sync; dimensions will always be compared,
1526  /// vector and matrix values only if the respective parameter is set to true.
1527  /// If quiet is set to true the function will only display which vectors are different.
1528  bool areLPsInSync(const bool checkVecVals = true, const bool checkMatVals = false, const bool quiet = false) const;
1529 
1530  /// set the random seeds of the solver instance
1531  void setRandomSeed(unsigned int seed);
1532 
1533  /// returns the current random seed of the solver instance
1534  unsigned int randomSeed() const;
1535 
1536  //@}
1537 
1538 private:
1539 
1540  //**@name Statistics on solving process */
1541  //@{
1542 
1543  /// class of statistics
1544  class Statistics;
1545 
1546  /// statistics since last call to solveReal() or solveRational()
1548 
1549  //@}
1550 
1551 
1552  //**@name Parameter settings */
1553  //@{
1554 
1556 
1562 
1563  //@}
1564 
1565 
1566  //**@name Data for the real LP */
1567  //@{
1568 
1591 
1592  SPxLPReal* _realLP; // the real LP is also used as the original LP for the decomposition dual simplex
1593  SPxLPReal* _decompLP; // used to store the original LP for the decomposition dual simplex
1597 
1598  bool _isRealLPLoaded; // true indicates that the original LP is loaded in the _solver variable, hence all actions
1599  // are performed on the original LP.
1602 
1609 
1610  //@}
1611 
1612 
1613  //**@name Data for the rational LP */
1614  //@{
1615 
1619 
1643 
1644  /// type of bounds and sides
1645  typedef enum
1646  {
1647  /// both bounds are infinite
1649 
1650  /// lower bound is finite, upper bound is infinite
1652 
1653  /// upper bound is finite, lower bound is infinite
1655 
1656  /// lower and upper bound finite, but different
1658 
1659  /// lower bound equals upper bound
1661  } RangeType;
1662 
1665 
1666  //@}
1667 
1668 
1669  //**@name Data for the Decomposition Based Dual Simplex */
1670  //@{
1671 
1672  /** row violation structure
1673  */
1675  {
1676  Real violation; /**< the violation of the row */
1677  int idx; /**< index of corresponding row */
1678  };
1679 
1680  /** Compare class for row violations
1681  */
1683  {
1684  public:
1685  /** constructor
1686  */
1688  : entry(0)
1689  {
1690  }
1691 
1693 
1694  Real operator() (
1695  RowViolation i,
1696  RowViolation j
1697  ) const
1698  {
1699  return i.violation - j.violation;
1700  }
1701  };
1702 
1703 
1704  typedef enum
1705  {
1706  // is the original problem currently being solved.
1708 
1709  // is the reduced problem currently being solved.
1711 
1712  // is the complementary problem currently being solved.
1714  } decompStatus;
1715 
1716  // the expected sign of the dual variables.
1718  {
1719  IS_POS = 0,
1720  IS_NEG = 1,
1722  };
1723 
1724  SPxSolver _compSolver; // adding a solver to contain the complementary problem. It is too confusing to switch
1725  // the LP for the reduced and complementary problem in the one solver variable. The reduced
1726  // problem will be stored in _solver and the complementary problem will be stored in
1727  // _compSolver.
1728  SLUFactor _compSlufactor; // I don't know whether this is necessary, but it is a test for now.
1729 
1730  SPxBasis _decompTransBasis; // the basis required for the transformation to form the reduced problem
1731 
1732  DVector _transformedObj; // the objective coefficients of the transformed problem
1733  DVector _decompFeasVector; // feasibility vector calculated using unshifted bounds.
1734  LPRowSet _transformedRows; // a set of the original rows that have been transformed using the original basis.
1735  SPxColId _compSlackColId; // column id of the primal complementary problem slack column.
1736  SPxRowId _compSlackDualRowId; // row id in the dual of complementary problem related to the slack column.
1737  bool* _decompReducedProbRows; // flag to indicate the inclusion of a row in the reduced problem.
1738  bool* _decompReducedProbCols; // flag to indicate the inclusion of a col in the reduced problem.
1741  int* _decompCompProbColIDsIdx; // the index to _decompPrimalColIDs for a given original col.
1742  DataArray < SPxRowId > _decompReducedProbRowIDs; // the row IDs for the related rows in the reduced problem
1743  DataArray < SPxRowId > _decompReducedProbColRowIDs;// the row IDs for the related cols in the reduced problem
1744  DataArray < SPxColId > _decompReducedProbColIDs; // the col IDs for the related cols in the reduced problem
1745  DataArray < SPxRowId > _decompPrimalRowIDs; // the primal row IDs from the original problem
1746  DataArray < SPxColId > _decompPrimalColIDs; // the primal col IDs from the original problem
1747  DataArray < SPxRowId > _decompElimPrimalRowIDs; // the primal row IDs eliminated in the complementary problem
1748  DataArray < SPxRowId > _decompDualRowIDs; // the dual row IDs from the complementary problem
1749  DataArray < SPxColId > _decompDualColIDs; // the dual col IDs from the complementary problem
1750  DataArray < SPxColId > _decompFixedVarDualIDs; // the column ids related to the fixed variables.
1751  DataArray < SPxColId > _decompVarBoundDualIDs; // the column ids related to the variable bound constraints.
1752 
1753  DataArray < SPxColId > _decompCompPrimalFixedVarIDs; // the column ids related to the fixed variables in the complementary primal.
1754  DataArray < SPxColId > _decompCompPrimalVarBoundIDs; // the column ids related to the variable bound constraints in the complementary primal.
1755 
1756  DataArray < SPxRowId > _decompCompPrimalRowIDs; // the primal row IDs from the complementary problem
1757  DataArray < SPxColId > _decompCompPrimalColIDs; // the primal col IDs from the complementary problem
1758 
1759  int _nDecompViolBounds; // the number of violated bound constraints
1760  int _nDecompViolRows; // the number of violated rows
1761  int* _decompViolatedBounds; // the violated bounds given by the solution to the IDS reduced problem
1762  int* _decompViolatedRows; // the violated rows given by the solution to the IDS reduced problem
1763 
1764 
1765  int* _fixedOrigVars; // the original variables that are at their bounds in the reduced problem.
1766  // 1: fixed to upper, -1: fixed to lower, 0: unfixed.
1767  int _nPrimalRows; // the number of original problem rows included in the complementary problem
1768  int _nPrimalCols; // the number of original problem columns included in the complementary problem
1769  int _nElimPrimalRows; // the number of primal rows from the original problem eliminated from the complementary prob
1770  int _nDualRows; // the number of dual rows in the complementary problem. NOTE: _nPrimalRows = _nDualCols
1771  int _nDualCols; // the number of dual columns in the complementary problem. NOTE: _nPrimalRows = _nDualCols
1772  int _nCompPrimalRows; // the number of rows in the complementary primal problem. NOTE: _nPrimalRows = _nCompPrimalRows
1773  int _nCompPrimalCols; // the number of dual columns in the complementary problem. NOTE: _nPrimalCols = _nCompPrimalCols
1774 
1775  int _decompDisplayLine; // the count for the display line
1776 
1777  NameSet* _rowNames; // the row names from the input file
1778  NameSet* _colNames; // the col names from the input file
1779 
1780  // Statistic information
1781  int numIncludedRows; // the number of rows currently included in the reduced problem.
1782  int numDecompIter; // the number of iterations of the decomposition dual simplex algorithm.
1783  int numRedProbIter; // the number of simplex iterations performed in the reduced problem.
1784  int numCompProbIter; // the number of iterations of the complementary problem.
1785 
1786  // problem statistics
1792 
1797 
1802 
1803 
1805 
1806  //@}
1807 
1808 
1809  //**@name Solution data */
1810  //@{
1811 
1814 
1817 
1821 
1825 
1826  //@}
1827 
1828  //**@name Miscellaneous */
1829  //@{
1830 
1833 
1837 
1838  //@}
1839 
1840  //**@name Constant helper methods */
1841  //@{
1842 
1843  /// extends sparse vector to hold newmax entries if and only if it holds no more free entries
1844  void _ensureDSVectorRationalMemory(DSVectorRational& vec, const int newmax) const;
1845 
1846  /// creates a permutation for removing rows/columns from an array of indices
1847  void _idxToPerm(int* idx, int idxSize, int* perm, int permSize) const;
1848 
1849  /// creates a permutation for removing rows/columns from a range of indices
1850  void _rangeToPerm(int start, int end, int* perm, int permSize) const;
1851 
1852  /// checks consistency
1853  bool _isConsistent() const;
1854 
1855  /// should solving process be stopped?
1856  bool _isSolveStopped(bool& stoppedTime, bool& stoppedIter) const;
1857 
1858  /// determines RangeType from real bounds
1859  RangeType _rangeTypeReal(const Real& lower, const Real& upper) const;
1860 
1861  /// determines RangeType from rational bounds
1862  RangeType _rangeTypeRational(const Rational& lower, const Rational& upper) const;
1863 
1864  /// switches RANGETYPE_LOWER to RANGETYPE_UPPER and vice versa
1865  RangeType _switchRangeType(const RangeType& rangeType) const;
1866 
1867  /// checks whether RangeType corresponds to finite lower bound
1868  bool _lowerFinite(const RangeType& rangeType) const;
1869 
1870  /// checks whether RangeType corresponds to finite upper bound
1871  bool _upperFinite(const RangeType& rangeType) const;
1872 
1873  //@}
1874 
1875 
1876  //**@name Non-constant helper methods */
1877  //@{
1878 
1879  /// adds a single row to the real LP and adjusts basis
1880  void _addRowReal(const LPRowReal& lprow);
1881 
1882  /// adds a single row to the real LP and adjusts basis
1883  void _addRowReal(Real lhs, const SVectorReal& lprow, Real rhs);
1884 
1885  /// adds multiple rows to the real LP and adjusts basis
1886  void _addRowsReal(const LPRowSetReal& lprowset);
1887 
1888  /// adds a single column to the real LP and adjusts basis
1889  void _addColReal(const LPColReal& lpcol);
1890 
1891  /// adds a single column to the real LP and adjusts basis
1892  void _addColReal(Real obj, Real lower, const SVectorReal& lpcol, Real upper);
1893 
1894  /// adds multiple columns to the real LP and adjusts basis
1895  void _addColsReal(const LPColSetReal& lpcolset);
1896 
1897  /// replaces row \p i with \p lprow and adjusts basis
1898  void _changeRowReal(int i, const LPRowReal& lprow);
1899 
1900  /// changes left-hand side vector for constraints to \p lhs and adjusts basis
1901  void _changeLhsReal(const VectorReal& lhs);
1902 
1903  /// changes left-hand side of row \p i to \p lhs and adjusts basis
1904  void _changeLhsReal(int i, const Real& lhs);
1905 
1906  /// changes right-hand side vector to \p rhs and adjusts basis
1907  void _changeRhsReal(const VectorReal& rhs);
1908 
1909  /// changes right-hand side of row \p i to \p rhs and adjusts basis
1910  void _changeRhsReal(int i, const Real& rhs);
1911 
1912  /// changes left- and right-hand side vectors and adjusts basis
1913  void _changeRangeReal(const VectorReal& lhs, const VectorReal& rhs);
1914 
1915  /// changes left- and right-hand side of row \p i and adjusts basis
1916  void _changeRangeReal(int i, const Real& lhs, const Real& rhs);
1917 
1918  /// replaces column \p i with \p lpcol and adjusts basis
1919  void _changeColReal(int i, const LPColReal& lpcol);
1920 
1921  /// changes vector of lower bounds to \p lower and adjusts basis
1922  void _changeLowerReal(const VectorReal& lower);
1923 
1924  /// changes lower bound of column i to \p lower and adjusts basis
1925  void _changeLowerReal(int i, const Real& lower);
1926 
1927  /// changes vector of upper bounds to \p upper and adjusts basis
1928  void _changeUpperReal(const VectorReal& upper);
1929 
1930  /// changes \p i 'th upper bound to \p upper and adjusts basis
1931  void _changeUpperReal(int i, const Real& upper);
1932 
1933  /// changes vectors of column bounds to \p lower and \p upper and adjusts basis
1934  void _changeBoundsReal(const VectorReal& lower, const VectorReal& upper);
1935 
1936  /// changes bounds of column \p i to \p lower and \p upper and adjusts basis
1937  void _changeBoundsReal(int i, const Real& lower, const Real& upper);
1938 
1939  /// changes matrix entry in row \p i and column \p j to \p val and adjusts basis
1940  void _changeElementReal(int i, int j, const Real& val);
1941 
1942  /// removes row \p i and adjusts basis
1943  void _removeRowReal(int i);
1944 
1945  /// removes all rows with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the
1946  /// new index where row \p i has been moved to; note that \p perm must point to an array of size at least
1947  /// #numRowsReal()
1948  void _removeRowsReal(int perm[]);
1949 
1950  /// remove all rows with indices in array \p idx of size \p n; an array \p perm of size #numRowsReal() may be passed
1951  /// as buffer memory
1952  void _removeRowsReal(int idx[], int n, int perm[]);
1953 
1954  /// removes rows \p start to \p end including both; an array \p perm of size #numRowsReal() may be passed as buffer
1955  /// memory
1956  void _removeRowRangeReal(int start, int end, int perm[]);
1957 
1958  /// removes column i
1959  void _removeColReal(int i);
1960 
1961  /// removes all columns with an index \p i such that \p perm[i] < 0; upon completion, \p perm[i] >= 0 indicates the
1962  /// new index where column \p i has been moved to; note that \p perm must point to an array of size at least
1963  /// #numColsReal()
1964  void _removeColsReal(int perm[]);
1965 
1966  /// remove all columns with indices in array \p idx of size \p n; an array \p perm of size #numColsReal() may be
1967  /// passed as buffer memory
1968  void _removeColsReal(int idx[], int n, int perm[]);
1969 
1970  /// removes columns \p start to \p end including both; an array \p perm of size #numColsReal() may be passed as
1971  /// buffer memory
1972  void _removeColRangeReal(int start, int end, int perm[]);
1973 
1974  /// invalidates solution
1975  void _invalidateSolution();
1976 
1977  /// enables simplifier and scaler according to current parameters
1979 
1980  /// disables simplifier and scaler
1982 
1983  /// ensures that the rational LP is available; performs no sync
1984  void _ensureRationalLP();
1985 
1986  /// ensures that the real LP and the basis are loaded in the solver; performs no sync
1987  void _ensureRealLPLoaded();
1988 
1989  /// call floating-point solver and update statistics on iterations etc.
1991 
1992  /// reads real LP in LP or MPS format from file and returns true on success; gets row names, column names, and
1993  /// integer variables if desired
1994  bool _readFileReal(const char* filename, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0);
1995 
1996  /// reads rational LP in LP or MPS format from file and returns true on success; gets row names, column names, and
1997  /// integer variables if desired
1998  bool _readFileRational(const char* filename, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0);
1999 
2000  /// completes range type arrays after adding columns and/or rows
2002 
2003  /// recomputes range types from scratch using real LP
2004  void _recomputeRangeTypesReal();
2005 
2006  /// recomputes range types from scratch using rational LP
2008 
2009  /// synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP, without looking at the sync mode
2010  void _syncLPReal(bool time = true);
2011 
2012  /// synchronizes rational LP with real LP, i.e., copies real LP to rational LP, without looking at the sync mode
2013  void _syncLPRational(bool time = true);
2014 
2015  /// synchronizes rational solution with real solution, i.e., copies (rounded) rational solution to real solution
2016  void _syncRealSolution();
2017 
2018  /// synchronizes real solution with rational solution, i.e., copies real solution to rational solution
2019  void _syncRationalSolution();
2020 
2021  /// returns pointer to a constant unit vector available until destruction of the SoPlex class
2022  const UnitVectorRational* _unitVectorRational(const int i);
2023 
2024  /// parses one line in a settings file and returns true on success; note that the string is modified
2025  bool _parseSettingsLine(char* line, const int lineNumber);
2026 
2027  //@}
2028 
2029 
2030  //**@name Private solving methods implemented in solverational.cpp */
2031  //@{
2032 
2033  /// solves rational LP
2034  void _optimizeRational();
2035 
2036  /// solves current problem with iterative refinement and recovery mechanism
2037  void _performOptIRStable(SolRational& sol,
2038  bool acceptUnbounded,
2039  bool acceptInfeasible,
2040  int minRounds,
2041  bool& primalFeasible,
2042  bool& dualFeasible,
2043  bool& infeasible,
2044  bool& unbounded,
2045  bool& stopped,
2046  bool& stoppedIter,
2047  bool& error);
2048 
2049  /// performs iterative refinement on the auxiliary problem for testing unboundedness
2050  void _performUnboundedIRStable(SolRational& sol, bool& hasUnboundedRay, bool& stopped, bool& stoppedIter, bool& error);
2051 
2052  /// performs iterative refinement on the auxiliary problem for testing feasibility
2053  void _performFeasIRStable(SolRational& sol, bool& withDualFarkas, bool& stopped, bool& stoppedIter, bool& error);
2054 
2055  /// reduces matrix coefficient in absolute value by the lifting procedure of Thiele et al. 2013
2056  void _lift();
2057 
2058  /// undoes lifting
2059  void _project(SolRational& sol);
2060 
2061  /// store basis
2062  void _storeBasis();
2063 
2064  /// restore basis
2065  void _restoreBasis();
2066 
2067  /// stores objective, bounds, and sides of real LP
2068  void _storeLPReal();
2069 
2070  /// restores objective, bounds, and sides of real LP
2071  void _restoreLPReal();
2072 
2073  /// introduces slack variables to transform inequality constraints into equations for both rational and real LP,
2074  /// which should be in sync
2075  void _transformEquality();
2076 
2077  /// undoes transformation to equality form
2078  void _untransformEquality(SolRational& sol);
2079 
2080  /// transforms LP to unboundedness problem by moving the objective function to the constraints, changing right-hand
2081  /// side and bounds to zero, and adding an auxiliary variable for the decrease in the objective function
2082  void _transformUnbounded();
2083 
2084  /// undoes transformation to unboundedness problem
2085  void _untransformUnbounded(SolRational& sol, bool unbounded);
2086 
2087  /// transforms LP to feasibility problem by removing the objective function, shifting variables, and homogenizing the
2088  /// right-hand side
2089  void _transformFeasibility();
2090 
2091  /// undoes transformation to feasibility problem
2092  void _untransformFeasibility(SolRational& sol, bool infeasible);
2093 
2094  /** computes radius of infeasibility box implied by an approximate Farkas' proof
2095 
2096  Given constraints of the form \f$ lhs <= Ax <= rhs \f$, a farkas proof y should satisfy \f$ y^T A = 0 \f$ and
2097  \f$ y_+^T lhs - y_-^T rhs > 0 \f$, where \f$ y_+, y_- \f$ denote the positive and negative parts of \f$ y \f$.
2098  If \f$ y \f$ is approximate, it may not satisfy \f$ y^T A = 0 \f$ exactly, but the proof is still valid as long
2099  as the following holds for all potentially feasible \f$ x \f$:
2100 
2101  \f[
2102  y^T Ax < (y_+^T lhs - y_-^T rhs) (*)
2103  \f]
2104 
2105  we may therefore calculate \f$ y^T A \f$ and \f$ y_+^T lhs - y_-^T rhs \f$ exactly and check if the upper and lower
2106  bounds on \f$ x \f$ imply that all feasible \f$ x \f$ satisfy (*), and if not then compute bounds on \f$ x \f$ to
2107  guarantee (*). The simplest way to do this is to compute
2108 
2109  \f[
2110  B = (y_+^T lhs - y_-^T rhs) / \sum_i(|(y^T A)_i|)
2111  \f]
2112 
2113  noting that if every component of \f$ x \f$ has \f$ |x_i| < B \f$, then (*) holds.
2114 
2115  \f$ B \f$ can be increased by iteratively including variable bounds smaller than \f$ B \f$. The speed of this
2116  method can be further improved by using interval arithmetic for all computations. For related information see
2117  Sec. 4 of Neumaier and Shcherbina, Mathematical Programming A, 2004.
2118 
2119  Set transformed to true if this method is called after _transformFeasibility().
2120  */
2121  void _computeInfeasBox(SolRational& sol, bool transformed);
2122 
2123  /// solves real LP during iterative refinement
2124  SPxSolver::Status _solveRealForRational(bool fromscratch, VectorReal& primal, VectorReal& dual,
2125  DataArray< SPxSolver::VarStatus >& basisStatusRows,
2126  DataArray< SPxSolver::VarStatus >& basisStatusCols, bool& returnedBasis);
2127 
2128  /// solves real LP with recovery mechanism
2129  SPxSolver::Status _solveRealStable(bool acceptUnbounded, bool acceptInfeasible, VectorReal& primal, VectorReal& dual,
2130  DataArray< SPxSolver::VarStatus >& basisStatusRows,
2131  DataArray< SPxSolver::VarStatus >& basisStatusCols, bool& returnedBasis, const bool forceNoSimplifier = false);
2132 
2133  /// computes rational inverse of basis matrix as defined by _rationalLUSolverBind
2135 
2136  /// factorizes rational basis matrix in column representation
2137  void _factorizeColumnRational(SolRational& sol, DataArray< SPxSolver::VarStatus >& basisStatusRows, DataArray< SPxSolver::VarStatus >& basisStatusCols, bool& stoppedTime, bool& stoppedIter, bool& error, bool& optimal);
2138 
2139  /// attempts rational reconstruction of primal-dual solution
2140  bool _reconstructSolutionRational(SolRational& sol, DataArray< SPxSolver::VarStatus >& basisStatusRows, DataArray< SPxSolver::VarStatus >& basisStatusCols, const Rational& denomBoundSquared);
2141  //@}
2142 
2143 
2144  //**@name Private solving methods implemented in solvereal.cpp */
2145  //@{
2146 
2147  /// solves real LP
2148  void _optimizeReal();
2149 
2150  /// checks result of the solving process and solves again without preprocessing if necessary
2151  void _evaluateSolutionReal(SPxSimplifier::Result simplificationStatus);
2152 
2153  /// solves real LP with/without preprocessing
2154  void _preprocessAndSolveReal(bool applyPreprocessing);
2155 
2156  /// loads original problem into solver and solves again after it has been solved to optimality with preprocessing
2157  void _resolveWithoutPreprocessing(SPxSimplifier::Result simplificationStatus);
2158 
2159  /// verify computed solution and resolve if necessary
2160  void _verifySolutionReal();
2161 
2162  /// stores solution of the real LP; before calling this, the real LP must be loaded in the solver and solved (again)
2163  void _storeSolutionReal(bool verify = true);
2164 
2165  /// stores solution from the simplifier because problem vanished in presolving step
2167 
2168  /// unscales stored solution to remove internal or external scaling of LP
2169  void _unscaleSolutionReal(SPxLPReal& LP, bool persistent = true);
2170 
2171  /// load original LP and possibly setup a slack basis
2172  void _loadRealLP(bool initBasis);
2173 
2174  /// check scaling of LP
2175  void _checkScaling(SPxLPReal* origLP) const;
2176 
2177  /// check correctness of (un)scaled basis matrix operations
2178  void _checkBasisScaling();
2179 
2180  /// check whether persistent scaling is supposed to be reapplied again after unscaling
2181  bool _reapplyPersistentScaling() const;
2182 
2183  /// solves LP using the decomposition based dual simplex
2185 
2186  /// creating copies of the original problem that will be manipulated to form the reduced and complementary problems
2188 
2189  /// forms the reduced problem
2190  void _formDecompReducedProblem(bool& stop);
2191 
2192  /// solves the reduced problem
2194 
2195  /// forms the complementary problem
2197 
2198  /// simplifies the problem and solves
2199  void _decompSimplifyAndSolve(SPxSolver& solver, SLUFactor& sluFactor, bool fromScratch, bool applyPreprocessing);
2200 
2201  /// loads original problem into solver and solves again after it has been solved to optimality with preprocessing
2203 
2204  /// identifies the columns of the row-form basis that correspond to rows with zero dual multipliers.
2205  void _getZeroDualMultiplierIndices(Vector feasVector, int* nonposind, int* colsforremoval,
2206  int* nnonposind, bool& stop);
2207 
2208  /// retrieves the compatible columns from the constraint matrix
2209  void _getCompatibleColumns(Vector feasVector, int* nonposind, int* compatind, int* rowsforremoval, int* colsforremoval,
2210  int nnonposind, int* ncompatind, bool formRedProb, bool& stop);
2211 
2212  /// computes the reduced problem objective coefficients
2213  void _computeReducedProbObjCoeff(bool& stop);
2214 
2215  /// computes the compatible bound constraints and adds them to the reduced problem
2216  void _getCompatibleBoundCons(LPRowSet& boundcons, int* compatboundcons, int* nonposind, int* ncompatboundcons,
2217  int nnonposind, bool& stop);
2218 
2219  /// computes the rows to remove from the complementary problem
2220  void _getRowsForRemovalComplementaryProblem(int* nonposind, int* bind, int* rowsforremoval, int* nrowsforremoval,
2221  int nnonposind);
2222 
2223  /// removing rows from the complementary problem.
2224  void _deleteAndUpdateRowsComplementaryProblem(SPxRowId rangedRowIds[], int& naddedrows);
2225 
2226  /// evaluates the solution of the reduced problem for the DBDS
2227  void _evaluateSolutionDecomp(SPxSolver& solver, SLUFactor& sluFactor, SPxSimplifier::Result result);
2228 
2229  /// update the reduced problem with additional columns and rows
2230  void _updateDecompReducedProblem(Real objVal, DVector dualVector, DVector redcostVector, DVector compPrimalVector,
2231  DVector compDualVector);
2232 
2233  /// update the reduced problem with additional columns and rows based upon the violated original bounds and rows
2234  void _updateDecompReducedProblemViol(bool allrows);
2235 
2236  /// builds the update rows with those violated in the complmentary problem
2237  void _findViolatedRows(Real compObjValue, DataArray<RowViolation>& violatedrows, int& nviolatedrows);
2238 
2239  /// update the dual complementary problem with additional columns and rows
2240  void _updateDecompComplementaryDualProblem(bool origObj);
2241 
2242  /// update the primal complementary problem with additional columns and rows
2243  void _updateDecompComplementaryPrimalProblem(bool origObj);
2244 
2245  /// checking the optimality of the original problem.
2246  void _checkOriginalProblemOptimality(Vector primalVector, bool printViol);
2247 
2248  /// updating the slack column coefficients to adjust for equality constraints
2250 
2251  /// updating the slack column coefficients to adjust for equality constraints
2253 
2254  /// removing the dual columns related to the fixed variables
2255  void _removeComplementaryDualFixedPrimalVars(int* currFixedVars);
2256 
2257  /// removing the dual columns related to the fixed variables
2258  void _identifyComplementaryDualFixedPrimalVars(int* currFixedVars);
2259 
2260  /// updating the dual columns related to the fixed primal variables.
2261  void _updateComplementaryDualFixedPrimalVars(int* currFixedVars);
2262 
2263  /// removing the dual columns related to the fixed variables
2264  void _identifyComplementaryPrimalFixedPrimalVars(int* currFixedVars);
2265 
2266  /// updating the dual columns related to the fixed primal variables.
2267  void _updateComplementaryPrimalFixedPrimalVars(int* currFixedVars);
2268 
2269  /// updating the complementary dual problem with the original objective function
2271 
2272  /// updating the complementary primal problem with the original objective function
2274 
2275  /// determining which bound the primal variables will be fixed to.
2276  int getOrigVarFixedDirection(int colNum);
2277 
2278  /// checks the dual feasibility of the current basis
2279  bool checkBasisDualFeasibility(Vector feasVec);
2280 
2281  /// returns the expected sign of the dual variables for the reduced problem
2282  DualSign getExpectedDualVariableSign(int rowNumber);
2283 
2284  /// returns the expected sign of the dual variables for the original problem
2285  DualSign getOrigProbDualVariableSign(int rowNumber);
2286 
2287  /// prints a display line of the flying table for the DBDS
2288  void printDecompDisplayLine(SPxSolver& solver, const SPxOut::Verbosity origVerb, bool force, bool forceHead);
2289 
2290  /// stores the problem statistics of the original problem
2292 
2293  /// stores the problem statistics of the original problem
2294  void printOriginalProblemStatistics(std::ostream& os);
2295 
2296  /// gets the coefficient of the slack variable in the primal complementary problem
2297  Real getCompSlackVarCoeff(int primalRowNum);
2298 
2299  /// gets violation of bounds; returns true on success
2300  bool getDecompBoundViolation(Real& maxviol, Real& sumviol);
2301 
2302  /// gets violation of constraints; returns true on success
2303  bool getDecompRowViolation(Real& maxviol, Real& sumviol);
2304 
2305  /// function call to terminate the decomposition simplex
2306  bool decompTerminate(Real timeLimit);
2307 
2308  /// function to build a basis for the original problem as given by the solution to the reduced problem
2309  void _writeOriginalProblemBasis(const char* filename, NameSet* rowNames, NameSet* colNames, bool cpxFormat);
2310 
2311  /// function to retrieve the original problem row basis status from the reduced and complementary problems
2312  void getOriginalProblemBasisRowStatus(DataArray< int >& degenerateRowNums,
2313  DataArray< SPxSolver::VarStatus >& degenerateRowStatus, int& nDegenerateRows, int& nNonBasicRows);
2314 
2315  /// function to retrieve the column status for the original problem basis from the reduced and complementary problems
2316  void getOriginalProblemBasisColStatus(int& nNonBasicCols);
2317 
2318  //@}
2319 };
2320 }
2321 #else
2322 #include "soplexlegacy.h"
2323 
2324 namespace soplex
2325 {
2326  typedef SoPlexLegacy SoPlex;
2327 }
2328 #endif
2329 #endif // _SOPLEX_H_
void changeLhsRational(const VectorRational &lhs)
changes left-hand side vector for constraints to lhs
Definition: soplex.cpp:2102
int _lastSolveMode
Definition: soplex.h:1813
const VectorRational & rhsRational() const
returns right-hand side vector
Definition: soplex.cpp:1161
floating-point check
Definition: soplex.h:1222
Fast shifting ratio test.
RangeType
type of bounds and sides
Definition: soplex.h:1645
const char * getRatiotesterName()
name of currently loaded ratiotester
Definition: soplex.cpp:5109
textbook ratio test without stabilization
Definition: soplex.h:1170
void getRowsRational(int start, int end, LPRowSetRational &lprowset) const
gets rows start, ..., end.
Definition: soplex.cpp:1143
const VectorReal & maxObjRealInternal() const
returns objective function vector after transformation to a maximization problem; since this is how i...
Definition: soplex.cpp:1037
void _computeBasisInverseRational()
computes rational inverse of basis matrix as defined by _rationalLUSolverBind
void _checkScaling(SPxLPReal *origLP) const
check scaling of LP
Definition: testsoplex.cpp:26
bool multBasisTranspose(Real *vec, bool unscale=true)
multiply with transpose of basis matrix; vec * B^T (inplace)
Definition: soplex.cpp:4770
void _changeUpperReal(const VectorReal &upper)
changes vector of upper bounds to upper and adjusts basis
Definition: soplex.cpp:7683
int _nCompPrimalCols
Definition: soplex.h:1773
accuracy of conjugate gradient method in least squares scaling (higher value leads to more iterations...
Definition: soplex.h:1340
SoPlex start basis generation base class.
zero tolerance used in factorization
Definition: soplex.h:1283
void getUpperReal(DVectorReal &upper) const
gets upper bound vector
Definition: soplex.cpp:981
Rational _rationalMaxscaleincr
Definition: soplex.h:1561
Bound flipping ratio test ("long step dual") for SoPlex.Class SPxBoundFlippingRT provides an implemen...
DVectorRational _unboundedRhs
Definition: soplex.h:1624
bool _reapplyPersistentScaling() const
check whether persistent scaling is supposed to be reapplied again after unscaling ...
Definition: solvereal.cpp:84
void printVersion() const
prints version and compilation options
Definition: soplex.cpp:6856
SoPlex()
default constructor
Definition: soplex.cpp:559
bool getDualViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of dual multipliers; returns true on success
Definition: soplex.cpp:3558
Types of solution classes.
SolRational _workSol
Definition: soplex.h:1820
void printSolutionStatistics(std::ostream &os)
prints solution statistics
Definition: soplex.cpp:6668
refactor threshold for memory growth in factorization since last refactorization
Definition: soplex.h:1337
void _transformEquality()
introduces slack variables to transform inequality constraints into equations for both rational and r...
SPxColId _compSlackColId
Definition: soplex.h:1735
void _updateComplementaryPrimalSlackColCoeff()
updating the slack column coefficients to adjust for equality constraints
Implementation of Sparse Linear Solver with Rational precision.This class implements a SLinSolverRati...
bool getDualNorms(int &nnormsRow, int &nnormsCol, Real *norms) const
gets steepest edge norms and returns false if they are not available
Definition: soplex.cpp:1064
void _addColReal(const LPColReal &lpcol)
adds a single column to the real LP and adjusts basis
Definition: soplex.cpp:7387
int numRowsReal() const
returns number of rows
Definition: soplex.cpp:797
bool getBasisInverseRowReal(int r, Real *coef, int *inds=NULL, int *ninds=NULL, bool unscale=true)
computes row r of basis inverse; returns true on success
Definition: soplex.cpp:4104
Rational minAbsNonzeroRational() const
returns smallest non-zero element in absolute value
Definition: soplex.cpp:1116
void removeRowsRational(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
Definition: soplex.cpp:2604
int _nDecompViolRows
Definition: soplex.h:1760
type of starter used to create crash basis
Definition: soplex.h:974
void removeColsReal(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
Definition: soplex.cpp:1814
const RowViolation * entry
Definition: soplex.h:1692
void _optimizeReal()
solves real LP
Definition: solvereal.cpp:29
const Settings & settings() const
returns current parameter settings
Definition: soplex.cpp:5570
upper limit on objective value
Definition: soplex.h:1301
Devex pricer.The Devex Pricer for SoPlex implements an approximate steepest edge pricing, that does without solving an extra linear system and computing the scalar products.
Definition: spxdevexpr.h:43
void _updateDecompReducedProblem(Real objVal, DVector dualVector, DVector redcostVector, DVector compPrimalVector, DVector compDualVector)
update the reduced problem with additional columns and rows
Definition: solvedbds.cpp:1116
void _changeElementReal(int i, int j, const Real &val)
changes matrix entry in row i and column j to val and adjusts basis
Definition: soplex.cpp:7774
void _transformUnbounded()
transforms LP to unboundedness problem by moving the objective function to the constraints, changing right-hand side and bounds to zero, and adding an auxiliary variable for the decrease in the objective function
general zero tolerance
Definition: soplex.h:1280
Result
Result of the simplification.
Definition: spxsimplifier.h:81
mode for solution polishing
Definition: soplex.h:1007
Real _realParamValues[SoPlex::REALPARAM_COUNT]
array of current real parameter values
Definition: soplex.h:1427
void _changeRangeReal(const VectorReal &lhs, const VectorReal &rhs)
changes left- and right-hand side vectors and adjusts basis
Definition: soplex.cpp:7565
type of ratio test
Definition: soplex.h:980
void removeColReal(int i)
removes column i
Definition: soplex.cpp:1788
Steepest edge pricer.Class SPxSteepExPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteepexpr.h:40
maximum increase of scaling factors between refinements
Definition: soplex.h:1310
SPxMainSM _simplifierMainSM
Definition: soplex.h:1571
Geometric mean row/column scaling.This SPxScaler implementation performs geometric mean scaling of th...
Definition: spxgeometsc.h:35
Real maxAbsNonzeroReal() const
returns biggest non-zero element in absolute value
Definition: soplex.cpp:833
verbosity level
Definition: soplex.h:965
continue iterative refinement with exact basic solution if not optimal?
Definition: soplex.h:919
int origCountLower
Definition: soplex.h:1793
type of timer
Definition: soplex.h:995
const SVectorReal & colVectorRealInternal(int i) const
returns vector of col i, ignoring scaling
Definition: soplex.cpp:945
int numRedProbIter
Definition: soplex.h:1783
DVectorRational _feasLhs
Definition: soplex.h:1627
void _findViolatedRows(Real compObjValue, DataArray< RowViolation > &violatedrows, int &nviolatedrows)
builds the update rows with those violated in the complmentary problem
Definition: solvedbds.cpp:1460
DataArray< SPxRowId > _decompPrimalRowIDs
Definition: soplex.h:1745
DataArray< SPxRowId > _decompElimPrimalRowIDs
Definition: soplex.h:1747
number of real parameters
Definition: soplex.h:1346
apply standard floating-point algorithm
Definition: soplex.h:1209
int origCountRhs
Definition: soplex.h:1799
void _checkOriginalProblemOptimality(Vector primalVector, bool printViol)
checking the optimality of the original problem.
Definition: solvedbds.cpp:2694
void _removeComplementaryDualFixedPrimalVars(int *currFixedVars)
removing the dual columns related to the fixed variables
Definition: solvedbds.cpp:2844
type of computational form, i.e., column or row representation
Definition: soplex.h:941
void changeColRational(int i, const LPColRational &lpcol)
replaces column i with lpcol
Definition: soplex.cpp:2285
void _setComplementaryPrimalOriginalObjective()
updating the complementary primal problem with the original objective function
Definition: solvedbds.cpp:3182
bool getBasisIndRational(DataArray< int > &bind)
gets an array of indices for the columns of the rational basis matrix; bind[i] >= 0 means that the i-...
Definition: soplex.cpp:4906
Abstract pricer base class.
bool getPrimalReal(VectorReal &vector)
gets the primal solution vector if available; returns true on success
Definition: soplex.cpp:2973
int origCountUpper
Definition: soplex.h:1794
pivot zero tolerance used in factorization
Definition: soplex.h:1289
equilibrium scaling on rows or columns
Definition: soplex.h:1110
int numRowsRational() const
returns number of rows
Definition: soplex.cpp:1089
bool writeDualFileReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0) const
writes the dual of the real LP to file; LP or MPS format is chosen from the extension in filename; if...
Definition: soplex.cpp:5181
SPxSolver::Status solve()
Definition: soplex.h:573
objective offset
Definition: soplex.h:1343
DataArray< SPxRowId > _decompReducedProbColRowIDs
Definition: soplex.h:1743
refinement limit (-1 if unlimited)
Definition: soplex.h:956
bool getDualRational(VectorRational &vector)
gets the dual solution vector if available; returns true on success
Definition: soplex.cpp:3328
class of parameter settings
Definition: soplex.h:1359
SPxLPRational * _rationalLP
Definition: soplex.h:1616
void printShortStatistics(std::ostream &os)
prints short statistics
Definition: soplex.cpp:6754
Solution vector based start basis.
Real coefReal(int row, int col) const
returns (unscaled) coefficient
Definition: soplex.cpp:842
bool getSlacksRational(VectorRational &vector)
gets the vector of slack values if available; returns true on success
Definition: soplex.cpp:3298
standard Harris ratio test
Definition: soplex.h:1173
bool multBasis(Real *vec, bool unscale=true)
multiply with basis matrix; B * vec (inplace)
Definition: soplex.cpp:4660
void getColsRational(int start, int end, LPColSetRational &lpcolset) const
gets columns start, ..., end
Definition: soplex.cpp:1215
SPxSolver::Status _solveRealStable(bool acceptUnbounded, bool acceptInfeasible, VectorReal &primal, VectorReal &dual, DataArray< SPxSolver::VarStatus > &basisStatusRows, DataArray< SPxSolver::VarStatus > &basisStatusCols, bool &returnedBasis, const bool forceNoSimplifier=false)
solves real LP with recovery mechanism
int totalSizePrimalRational(const int base=2)
get size of primal solution
Definition: soplex.cpp:3764
void _addColsReal(const LPColSetReal &lpcolset)
adds multiple columns to the real LP and adjusts basis
Definition: soplex.cpp:7430
unsigned int randomSeed() const
returns the current random seed of the solver instance
Definition: soplex.cpp:7163
LPRowSet _transformedRows
Definition: soplex.h:1734
int _nDecompViolBounds
Definition: soplex.h:1759
DVector _transformedObj
Definition: soplex.h:1732
time limit in seconds (INFTY if unlimited)
Definition: soplex.h:1295
mode for iterative refinement strategy
Definition: soplex.h:989
SPxGeometSC _scalerGeo8
Definition: soplex.h:1575
void changeRangeReal(const VectorReal &lhs, const VectorReal &rhs)
changes left- and right-hand side vectors
Definition: soplex.cpp:1482
Rational _rationalFeastol
Definition: soplex.h:1559
void writeStateReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes internal LP, basis information, and parameter settings; if rowNames and colNames are NULL...
Definition: soplex.cpp:5487
void _removeColsReal(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
Definition: soplex.cpp:7890
modified Harris ratio test
Definition: soplex.h:1176
virtual ~SoPlex()
destructor
Definition: soplex.cpp:756
bool getRedCostRational(VectorRational &vector)
gets the vector of reduced cost values if available; returns true on success
Definition: soplex.cpp:3343
LP geometric mean scaling.
int _unscaleCalls
Definition: soplex.h:1832
crash basis from a greedy solution
Definition: soplex.h:1138
primal feasibility tolerance
Definition: soplex.h:1274
static struct soplex::SoPlex::Settings::RealParam realParam
Definition: soplex.cpp:553
standard verbosity level
Definition: soplex.h:1084
bound flipping ratio test for long steps in the dual simplex
Definition: soplex.h:1179
void _storeSolutionRealFromPresol()
stores solution from the simplifier because problem vanished in presolving step
Definition: solvereal.cpp:560
bool writeBasisFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes basis information to filename; if rowNames and colNames are NULL, default names are used; retu...
Definition: soplex.cpp:5389
Abstract ratio test base class.
void _addRowReal(const LPRowReal &lprow)
adds a single row to the real LP and adjusts basis
Definition: soplex.cpp:7334
DVectorRational _feasLower
Definition: soplex.h:1629
DVectorRational _feasRhs
Definition: soplex.h:1628
bool defaultValue[SoPlex::BOOLPARAM_COUNT]
array of default values for boolean parameters
Definition: soplex.h:1370
SPxScaler * _scaler
Definition: soplex.h:1595
std::string name[SoPlex::BOOLPARAM_COUNT]
array of names for boolean parameters
Definition: soplex.h:1366
cpu or user time
Definition: soplex.h:1238
bool readBasisFile(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0)
reads basis information from filename and returns true on success; if rowNames and colNames are NULL...
Definition: soplex.cpp:5196
void changeRangeRational(const VectorRational &lhs, const VectorRational &rhs)
changes left- and right-hand side vectors
Definition: soplex.cpp:2225
Least squares scaling.This SPxScaler implementation performs least squares scaling as suggested by Cu...
Definition: spxleastsqsc.h:36
mode for reading LP files
Definition: soplex.h:986
mode for synchronizing real and rational LP
Definition: soplex.h:983
void _syncLPReal(bool time=true)
synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP...
Definition: soplex.cpp:8275
void _optimizeRational()
solves rational LP
bool getDualFarkasReal(VectorReal &vector)
gets the Farkas proof if available; returns true on success
Definition: soplex.cpp:3048
void resetSettings(const bool quiet=false, const bool init=true)
resets default parameter settings
Definition: soplex.cpp:6198
automatic sync of real and rational LP
Definition: soplex.h:1189
void _recomputeRangeTypesRational()
recomputes range types from scratch using rational LP
Definition: soplex.cpp:8262
void _unscaleSolutionReal(SPxLPReal &LP, bool persistent=true)
unscales stored solution to remove internal or external scaling of LP
Definition: solvereal.cpp:641
iteration limit (-1 if unlimited)
Definition: soplex.h:953
void _transformFeasibility()
transforms LP to feasibility problem by removing the objective function, shifting variables...
void changeObjReal(const VectorReal &obj)
changes objective function vector to obj
Definition: soplex.cpp:1649
void changeRowRational(int i, const LPRowRational &lprow)
replaces row i with lprow
Definition: soplex.cpp:2082
Implementation of Sparse Linear Solver.
bool getRowViolationReal(Real &maxviol, Real &sumviol)
gets violation of constraints; returns true on success
Definition: soplex.cpp:3102
SPxFastRT _ratiotesterFast
Definition: soplex.h:1589
should cycling solutions be accepted during iterative refinement?
Definition: soplex.h:910
void _disableSimplifierAndScaler()
disables simplifier and scaler
Definition: soplex.cpp:7989
bool getRowViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of constraints; returns true on success
Definition: soplex.cpp:3424
static struct soplex::SoPlex::Settings::IntParam intParam
Definition: soplex.cpp:552
should the decomposition based dual simplex be used to solve the LP? Setting this to true forces the ...
Definition: soplex.h:898
DataArray< SPxSolver::VarStatus > _storedBasisStatusCols
Definition: soplex.h:1638
Real lowerReal(int i) const
returns lower bound of column i
Definition: soplex.cpp:999
bool getBasisInverseRowRational(const int r, SSVectorRational &vec)
computes row r of basis inverse; performs rational factorization if not available; returns true on su...
Definition: soplex.cpp:4922
Implementation of Sparse Linear Solver with Rational precision.
bool * _decompReducedProbCols
Definition: soplex.h:1738
int _nDualCols
Definition: soplex.h:1771
void _performFeasIRStable(SolRational &sol, bool &withDualFarkas, bool &stopped, bool &stoppedIter, bool &error)
performs iterative refinement on the auxiliary problem for testing feasibility
NameSet * _rowNames
Definition: soplex.h:1777
void _removeRowReal(int i)
removes row i and adjusts basis
Definition: soplex.cpp:7797
lower bound is finite, upper bound is infinite
Definition: soplex.h:1651
void _storeBasis()
store basis
bool _readFileReal(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads real LP in LP or MPS format from file and returns true on success; gets row names...
Definition: soplex.cpp:8148
decide according to problem size
Definition: soplex.h:1251
SoPlex start basis generation base class.SPxStarter is the virtual base class for classes generating ...
Definition: spxstarter.h:41
int _nElimPrimalRows
Definition: soplex.h:1769
void addColsRational(const LPColSetRational &lpcolset)
adds multiple columns
Definition: soplex.cpp:2063
Real upperReal(int i) const
returns upper bound of column i
Definition: soplex.cpp:972
void _computeReducedProbObjCoeff(bool &stop)
computes the reduced problem objective coefficients
Definition: solvedbds.cpp:1792
void getColRational(int i, LPColRational &lpcol) const
gets column i
Definition: soplex.cpp:1206
const char * getStarterName()
name of starter
Definition: soplex.cpp:5068
DVectorReal _manualObj
Definition: soplex.h:1607
int origCountBoxed
Definition: soplex.h:1795
objective sense
Definition: soplex.h:938
Dantzig pricer.
void _checkBasisScaling()
check correctness of (un)scaled basis matrix operations
Definition: testsoplex.cpp:89
SPxSolver::Status _solveRealForRational(bool fromscratch, VectorReal &primal, VectorReal &dual, DataArray< SPxSolver::VarStatus > &basisStatusRows, DataArray< SPxSolver::VarStatus > &basisStatusCols, bool &returnedBasis)
solves real LP during iterative refinement
int getOrigVarFixedDirection(int colNum)
determining which bound the primal variables will be fixed to.
Definition: solvedbds.cpp:3200
General methods in LP preprocessing.
void _untransformUnbounded(SolRational &sol, bool unbounded)
undoes transformation to unboundedness problem
bool readFile(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads LP file in LP or MPS format according to READMODE parameter; gets row names, column names, and integer variables if desired; returns true on success
Definition: soplex.cpp:5118
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
Definition: spxid.h:36
display frequency
Definition: soplex.h:962
void _ensureRationalLP()
ensures that the rational LP is available; performs no sync
Definition: soplex.cpp:8003
minimum number of stalling refinements since last pivot to trigger rational factorization ...
Definition: soplex.h:1001
Auto pricer.This pricer switches between Devex and Steepest edge pricer based on the difficulty of th...
Definition: spxautopr.h:41
minimal reduction (sum of removed rows/cols) to continue simplification
Definition: soplex.h:1328
void getRowVectorReal(int i, DSVectorReal &row) const
gets vector of row i
Definition: soplex.cpp:865
Wrapper for GMP type mpq_class.We wrap mpq_class so that we can replace it by a double type if GMP is...
Definition: rational.h:45
geometric mean scaling (max 8 rounds) followed by equilibrium scaling (rows and columns) ...
Definition: soplex.h:1125
bool setSettings(const Settings &newSettings, const bool init=true)
sets parameter settings; returns true on success
Definition: soplex.cpp:6170
void _changeRhsReal(const VectorReal &rhs)
changes right-hand side vector to rhs and adjusts basis
Definition: soplex.cpp:7523
void changeElementReal(int i, int j, const Real &val)
changes matrix entry in row i and column j to val
Definition: soplex.cpp:1681
Devex pricer.
disable timing
Definition: soplex.h:1235
void printStatistics(std::ostream &os)
prints complete statistics
Definition: soplex.cpp:6767
Real rhsReal(int i) const
returns right-hand side of row i
Definition: soplex.cpp:900
bool getDecompBoundViolation(Real &maxviol, Real &sumviol)
gets violation of bounds; returns true on success
Definition: solvedbds.cpp:3605
should a rational factorization be performed after iterative refinement?
Definition: soplex.h:894
int origCountRanged
Definition: soplex.h:1800
mode for hyper sparse pricing
Definition: soplex.h:998
void _getCompatibleBoundCons(LPRowSet &boundcons, int *compatboundcons, int *nonposind, int *ncompatboundcons, int nnonposind, bool &stop)
computes the compatible bound constraints and adds them to the reduced problem
Definition: solvedbds.cpp:1858
void getRhsReal(DVectorReal &rhs) const
gets right-hand side vector
Definition: soplex.cpp:891
maximum number of updates without fresh factorization
Definition: soplex.h:950
SPxSolver _compSolver
Definition: soplex.h:1724
void removeColRangeRational(int start, int end, int perm[]=0)
removes columns start to end including both; an array perm of size numColsRational() may be passed as...
Definition: soplex.cpp:2748
void changeUpperRational(const VectorRational &upper)
changes vector of upper bounds to upper
Definition: soplex.cpp:2365
bool _boolParamValues[SoPlex::BOOLPARAM_COUNT]
array of current boolean parameter values
Definition: soplex.h:1421
Rational _rationalPosInfty
Definition: soplex.h:1557
int numDecompIter
Definition: soplex.h:1782
number of integer parameters
Definition: soplex.h:1025
DataArray< SPxColId > _decompCompPrimalColIDs
Definition: soplex.h:1757
Rational _rationalOpttol
Definition: soplex.h:1560
RealParam
real parameters
Definition: soplex.h:1271
bool setDualNorms(int nnormsRow, int nnormsCol, Real *norms)
sets steepest edge norms and returns false if that&#39;s not possible
Definition: soplex.cpp:1072
static struct soplex::SoPlex::Settings::BoolParam boolParam
Definition: soplex.cpp:551
LP simplification base class.
const VectorRational & lhsRational() const
returns left-hand side vector
Definition: soplex.cpp:1179
bool writeFileRational(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0) const
writes rational LP to file; LP or MPS format is chosen from the extension in filename; if rowNames an...
Definition: soplex.cpp:5162
SPxEquiliSC _scalerBiequi
Definition: soplex.h:1573
int numNonzerosRational() const
returns number of nonzeros
Definition: soplex.cpp:1107
steepest edge pricer with exact initialization of norms
Definition: soplex.h:1163
int origCountFreeRow
Definition: soplex.h:1801
DataArray< SPxColId > _decompReducedProbColIDs
Definition: soplex.h:1744
bool isDualFeasible() const
is stored dual solution feasible?
Definition: soplex.cpp:2928
full verbosity level
Definition: soplex.h:1090
only error, warning, and debug output
Definition: soplex.h:1081
Partial multiple pricing.Class SPxParMultPr is an implementation class for SPxPricer implementing Dan...
Definition: spxparmultpr.h:47
void removeColRangeReal(int start, int end, int perm[]=0)
removes columns start to end including both; an array perm of size numColsReal() may be passed as buf...
Definition: soplex.cpp:1862
void addColReal(const LPCol &lpcol)
adds a single column
Definition: soplex.cpp:1353
Rational objRational(int i) const
returns objective value of column i
Definition: soplex.cpp:1288
void clearLPRational()
clears the LP
Definition: soplex.cpp:2766
void _solveDecompReducedProblem()
solves the reduced problem
DVectorRational _modLhs
Definition: soplex.h:1633
DataArray< SPxRowId > _decompReducedProbRowIDs
Definition: soplex.h:1742
DVectorReal _manualLower
Definition: soplex.h:1603
void _removeColRangeReal(int start, int end, int perm[])
removes columns start to end including both; an array perm of size numColsReal() may be passed as buf...
void addRowsRational(const LPRowSetRational &lprowset)
adds multiple rows
Definition: soplex.cpp:1977
void printOriginalProblemStatistics(std::ostream &os)
stores the problem statistics of the original problem
Definition: solvedbds.cpp:3536
SPxSolver::Status optimize()
optimize the given LP
Definition: soplex.cpp:2801
Steepest edge pricer.
void getObjReal(VectorReal &obj) const
gets objective function vector
Definition: soplex.cpp:1018
void getLowerReal(DVectorReal &lower) const
gets lower bound vector
Definition: soplex.cpp:1008
void addRowRational(const LPRowRational &lprow)
adds a single row
Definition: soplex.cpp:1912
void addColRational(const LPColRational &lpcol)
adds a single column
Definition: soplex.cpp:1996
SPxGeometSC _scalerGeoequi
Definition: soplex.h:1576
const UnitVectorRational * _unitVectorRational(const int i)
returns pointer to a constant unit vector available until destruction of the SoPlex class ...
Definition: soplex.cpp:8342
void _rangeToPerm(int start, int end, int *perm, int permSize) const
creates a permutation for removing rows/columns from a range of indices
Definition: soplex.cpp:7202
void _syncRealSolution()
synchronizes rational solution with real solution, i.e., copies (rounded) rational solution to real s...
Definition: soplex.cpp:8318
SLUFactor _compSlufactor
Definition: soplex.h:1728
void _formDecompReducedProblem(bool &stop)
forms the reduced problem
Definition: solvedbds.cpp:624
void removeColsRational(int perm[])
removes all columns with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates th...
Definition: soplex.cpp:2699
Fast shifting ratio test.Class SPxFastRT is an implementation class of SPxRatioTester providing fast ...
Definition: spxfastrt.h:41
refactor threshold for fill-in in current factor update compared to fill-in in last factorization ...
Definition: soplex.h:1334
void changeRhsRational(const VectorRational &rhs)
changes right-hand side vector to rhs
Definition: soplex.cpp:2162
standard floating-point parsing
Definition: soplex.h:1199
int dmaxSizeDualRational(const int base=2)
get size of largest denominator in dual solution
Definition: soplex.cpp:3834
void _ensureDSVectorRationalMemory(DSVectorRational &vec, const int newmax) const
extends sparse vector to hold newmax entries if and only if it holds no more free entries ...
Definition: soplex.cpp:7171
DataArray< SPxRowId > _decompCompPrimalRowIDs
Definition: soplex.h:1756
void _updateComplementaryPrimalFixedPrimalVars(int *currFixedVars)
updating the dual columns related to the fixed primal variables.
Definition: solvedbds.cpp:3074
int dlcmSizePrimalRational(const int base=2)
get size of least common multiple of denominators in primal solution
Definition: soplex.cpp:3792
Rational objValueRational()
returns the objective value if a primal solution is available
Definition: soplex.cpp:3252
void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[]) const
gets current basis via arrays of statuses
Definition: soplex.cpp:3938
DataArray< SPxSolver::VarStatus > _basisStatusCols
Definition: soplex.h:1816
DVectorRational _unboundedLower
Definition: soplex.h:1621
decide depending on tolerances whether to apply iterative refinement
Definition: soplex.h:1212
void getLhsReal(DVectorReal &lhs) const
gets left-hand side vector
Definition: soplex.cpp:918
decompStatus _currentProb
Definition: soplex.h:1804
DVectorReal _manualRhs
Definition: soplex.h:1606
bool isPrimalFeasible() const
is stored primal solution feasible?
Definition: soplex.cpp:2904
DataArray< RangeType > _colTypes
Definition: soplex.h:1663
type of scaler
Definition: soplex.h:971
automatic choice according to number of rows and columns
Definition: soplex.h:1042
double Real
Definition: spxdefines.h:218
Rational _rationalPosone
Definition: soplex.h:1834
void removeRowRangeReal(int start, int end, int perm[]=0)
removes rows start to end including both; an array perm of size numRowsReal() may be passed as buffer...
Definition: soplex.cpp:1770
SPxBoundFlippingRT _ratiotesterBoundFlipping
Definition: soplex.h:1590
bool _isRealLPLoaded
Definition: soplex.h:1598
SLUFactorRational _rationalLUSolver
Definition: soplex.h:1617
geometric mean scaling on rows and columns, max 8 rounds
Definition: soplex.h:1119
void _getZeroDualMultiplierIndices(Vector feasVector, int *nonposind, int *colsforremoval, int *nnonposind, bool &stop)
identifies the columns of the row-form basis that correspond to rows with zero dual multipliers...
Definition: solvedbds.cpp:1556
void getRowRational(int i, LPRowRational &lprow) const
gets row i
Definition: soplex.cpp:1134
void _solveRealLPAndRecordStatistics()
call floating-point solver and update statistics on iterations etc.
Definition: soplex.cpp:8043
void _evaluateSolutionDecomp(SPxSolver &solver, SLUFactor &sluFactor, SPxSimplifier::Result result)
evaluates the solution of the reduced problem for the DBDS
Definition: solvedbds.cpp:3229
number of boolean parameters
Definition: soplex.h:931
void _setComplementaryDualOriginalObjective()
updating the complementary dual problem with the original objective function
Definition: solvedbds.cpp:3112
SPxEquiliSC _scalerUniequi
Definition: soplex.h:1572
void printSolvingStatistics(std::ostream &os)
prints statistics on solving process
Definition: soplex.cpp:6745
bool _readFileRational(const char *filename, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
reads rational LP in LP or MPS format from file and returns true on success; gets row names...
Definition: soplex.cpp:8189
lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformula...
Definition: soplex.h:1313
bool getPrimalRayReal(VectorReal &vector)
gets the primal ray if available; returns true on success
Definition: soplex.cpp:3003
bool hasPrimal() const
is a primal feasible solution available?
Definition: soplex.cpp:2912
void _decompSimplifyAndSolve(SPxSolver &solver, SLUFactor &sluFactor, bool fromScratch, bool applyPreprocessing)
simplifies the problem and solves
Definition: solvedbds.cpp:859
void changeLhsReal(const VectorReal &lhs)
changes left-hand side vector for constraints to lhs
Definition: soplex.cpp:1408
bool getDecompRowViolation(Real &maxviol, Real &sumviol)
gets violation of constraints; returns true on success
Definition: solvedbds.cpp:3683
int _beforeLiftCols
Definition: soplex.h:1642
greedy crash basis weighted by objective, bounds, and sides
Definition: soplex.h:1135
bool hasDualFarkas() const
is Farkas proof of infeasibility available?
Definition: soplex.cpp:2944
bool _isConsistent() const
checks consistency
Definition: soplex.cpp:7214
void _changeLowerReal(const VectorReal &lower)
changes vector of lower bounds to lower and adjusts basis
Definition: soplex.cpp:7641
void _getCompatibleColumns(Vector feasVector, int *nonposind, int *compatind, int *rowsforremoval, int *colsforremoval, int nnonposind, int *ncompatind, bool formRedProb, bool &stop)
retrieves the compatible columns from the constraint matrix
Definition: solvedbds.cpp:1632
void _performOptIRStable(SolRational &sol, bool acceptUnbounded, bool acceptInfeasible, int minRounds, bool &primalFeasible, bool &dualFeasible, bool &infeasible, bool &unbounded, bool &stopped, bool &stoppedIter, bool &error)
solves current problem with iterative refinement and recovery mechanism
the iteration frequency at which the decomposition solve output is displayed.
Definition: soplex.h:1016
dual simplex algorithm, i.e., leaving for column and entering for row representation ...
Definition: soplex.h:1058
LP simplification abstract base class.Instances of classes derived from SPxSimplifier may be loaded t...
Definition: spxsimplifier.h:41
steepest edge pricer with initialization to unit norms
Definition: soplex.h:1160
Rational maxAbsNonzeroRational() const
returns biggest non-zero element in absolute value
Definition: soplex.cpp:1125
use persistent scaling?
Definition: soplex.h:925
bool computeBasisInverseRational()
compute rational basis inverse; returns true on success
Definition: soplex.cpp:4878
bool _upperFinite(const RangeType &rangeType) const
checks whether RangeType corresponds to finite upper bound
Definition: soplex.cpp:7326
bool _hasBasis
Definition: soplex.h:1822
use bound flipping also for row representation?
Definition: soplex.h:922
bool hasBasis() const
is an advanced starting basis available?
Definition: soplex.cpp:3848
void _invalidateSolution()
invalidates solution
Definition: soplex.cpp:7925
preconfigured SoPlexLegacy LP-solver.
bool getBasisInverseColReal(int c, Real *coef, int *inds=NULL, int *ninds=NULL, bool unscale=true)
computes column c of basis inverse; returns true on success
Definition: soplex.cpp:4290
bool getDualViolationReal(Real &maxviol, Real &sumviol)
gets violation of dual multipliers; returns true on success
Definition: soplex.cpp:3198
bool getBasisInverseColRational(const int c, SSVectorRational &vec)
computes column c of basis inverse; performs rational factorization if not available; returns true on...
Definition: soplex.cpp:4946
Wrapper for several output streams. A verbosity level is used to decide which stream to use and wheth...
Definition: spxout.h:63
const char * getSimplifierName()
name of simplifier
Definition: soplex.cpp:5079
void changeLowerReal(const VectorReal &lower)
changes vector of lower bounds to lower
Definition: soplex.cpp:1538
void _restoreLPReal()
restores objective, bounds, and sides of real LP
void _project(SolRational &sol)
undoes lifting
const char * getPricerName()
name of currently loaded pricer
Definition: soplex.cpp:5101
print condition number during the solve
Definition: soplex.h:1022
void _performUnboundedIRStable(SolRational &sol, bool &hasUnboundedRay, bool &stopped, bool &stoppedIter, bool &error)
performs iterative refinement on the auxiliary problem for testing unboundedness
Rational _rationalNegone
Definition: soplex.h:1835
main LP solver class
SPxRowId _compSlackDualRowId
Definition: soplex.h:1736
DVectorRational _feasObj
Definition: soplex.h:1626
round scaling factors for iterative refinement to powers of two?
Definition: soplex.h:916
maximize number of basic slack variables, i.e. more variables on bounds
Definition: soplex.h:1264
SPxBasis::SPxStatus basisStatus() const
returns the current basis status
Definition: soplex.cpp:3856
void _computeInfeasBox(SolRational &sol, bool transformed)
void removeRowReal(int i)
removes row i
Definition: soplex.cpp:1696
Forrest-Tomlin type update.
Definition: soplex.h:1068
bool getBasisInverseTimesVecReal(Real *rhs, Real *sol, bool unscale=true)
computes dense solution of basis matrix B * sol = rhs; returns true on success
Definition: soplex.cpp:4495
int dlcmSizeDualRational(const int base=2)
get size of least common multiple of denominators in dual solution
Definition: soplex.cpp:3806
Auto pricer.
SPxWeightST _starterWeight
Definition: soplex.h:1578
Statistics * _statistics
statistics since last call to solveReal() or solveRational()
Definition: soplex.h:1544
void _evaluateSolutionReal(SPxSimplifier::Result simplificationStatus)
checks result of the solving process and solves again without preprocessing if necessary ...
Definition: solvereal.cpp:95
LPColSetRational _slackCols
Definition: soplex.h:1620
type of simplifier
Definition: soplex.h:968
int origCountFreeCol
Definition: soplex.h:1796
int numNonzeros
Definition: soplex.h:1789
Real getCompSlackVarCoeff(int primalRowNum)
gets the coefficient of the slack variable in the primal complementary problem
Definition: solvedbds.cpp:3559
void getColVectorReal(int i, DSVectorReal &col) const
gets vector of col i
Definition: soplex.cpp:954
DVectorRational _feasUpper
Definition: soplex.h:1630
void _removeRowsReal(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
Definition: soplex.cpp:7826
void _syncLPRational(bool time=true)
synchronizes rational LP with real LP, i.e., copies real LP to rational LP, without looking at the sy...
Definition: soplex.cpp:8299
void printUserSettings()
print non-default parameter values
Definition: soplex.cpp:6217
void changeBoundsReal(const VectorReal &lower, const VectorReal &upper)
changes vectors of column bounds to lower and upper
Definition: soplex.cpp:1613
RangeType _rangeTypeRational(const Rational &lower, const Rational &upper) const
determines RangeType from rational bounds
Definition: soplex.cpp:7280
SPxSteepPR _pricerQuickSteep
Definition: soplex.h:1585
int numColsRational() const
returns number of columns
Definition: soplex.cpp:1098
void syncLPReal()
synchronizes real LP with rational LP, i.e., copies (rounded) rational LP into real LP...
Definition: soplex.cpp:1901
bool _reconstructSolutionRational(SolRational &sol, DataArray< SPxSolver::VarStatus > &basisStatusRows, DataArray< SPxSolver::VarStatus > &basisStatusCols, const Rational &denomBoundSquared)
attempts rational reconstruction of primal-dual solution
SPxDantzigPR _pricerDantzig
Definition: soplex.h:1582
SPxParMultPR _pricerParMult
Definition: soplex.h:1583
bool getPrimalRational(VectorRational &vector)
gets the primal solution vector if available; returns true on success
Definition: soplex.cpp:3283
Solution vector based start basis.This version of SPxWeightST can be used to construct a starting bas...
Definition: spxvectorst.h:44
void changeObjRational(const VectorRational &obj)
changes objective function vector to obj
Definition: soplex.cpp:2485
std::string statisticString() const
statistical information in form of a string
Definition: soplex.cpp:5052
RangeType _switchRangeType(const RangeType &rangeType) const
switches RANGETYPE_LOWER to RANGETYPE_UPPER and vice versa
Definition: soplex.cpp:7305
SLUFactor _slufactor
Definition: soplex.h:1570
void _removeRowRangeReal(int start, int end, int perm[])
removes rows start to end including both; an array perm of size numRowsReal() may be passed as buffer...
Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed ...
Definition: didxset.h:42
void clearBasis()
clears starting basis
Definition: soplex.cpp:5025
const SVectorReal & rowVectorRealInternal(int i) const
returns vector of row i, ignoring scaling
Definition: soplex.cpp:856
void syncLPRational()
synchronizes rational LP with real LP, i.e., copies real LP to rational LP, if sync mode is manual ...
Definition: soplex.cpp:2790
bool getRedCostReal(VectorReal &vector)
gets the vector of reduced cost values if available; returns true on success
Definition: soplex.cpp:3033
DataArray< SPxColId > _decompPrimalColIDs
Definition: soplex.h:1746
Simple heuristic SPxStarter.
DVectorRational _modUpper
Definition: soplex.h:1632
void _decompResolveWithoutPreprocessing(SPxSolver &solver, SLUFactor &sluFactor, SPxSimplifier::Result result)
loads original problem into solver and solves again after it has been solved to optimality with prepr...
Definition: solvedbds.cpp:1031
int _nPrimalCols
Definition: soplex.h:1768
user sync of real and rational LP
Definition: soplex.h:1192
SPxSteepExPR _pricerSteep
Definition: soplex.h:1586
void _verifySolutionReal()
verify computed solution and resolve if necessary
Definition: solvereal.cpp:361
bool hasDual() const
is a dual feasible solution available?
Definition: soplex.cpp:2936
bool parseSettingsString(char *line)
parses one setting string and returns true on success; note that string is modified ...
Definition: soplex.cpp:6410
const VectorReal & upperRealInternal() const
returns upper bound vector
Definition: soplex.cpp:963
SPxOut spxout
Definition: soplex.h:1444
infinity threshold
Definition: soplex.h:1292
void changeBoundsRational(const VectorRational &lower, const VectorRational &upper)
changes vectors of column bounds to lower and upper
Definition: soplex.cpp:2425
const SVectorRational & colVectorRational(int i) const
returns vector of column i
Definition: soplex.cpp:1224
int numIterations() const
number of iterations since last call to solve
Definition: soplex.cpp:5036
SPxDefaultRT _ratiotesterTextbook
Definition: soplex.h:1587
void _loadRealLP(bool initBasis)
load original LP and possibly setup a slack basis
Definition: solvereal.cpp:627
(In)equality for LPs.Class LPRowBase provides constraints for linear programs in the form where a is...
Definition: lprowbase.h:45
Settings * _currentSettings
Definition: soplex.h:1555
bool getBasisInverseTimesVecRational(const SVectorRational &rhs, SSVectorRational &sol)
computes solution of basis matrix B * sol = rhs; performs rational factorization if not available; re...
Definition: soplex.cpp:4971
Real lhsReal(int i) const
returns left-hand side of row i
Definition: soplex.cpp:927
LPRowReal::Type rowTypeReal(int i) const
returns inequality type of row i
Definition: soplex.cpp:936
only error and warning output
Definition: soplex.h:1078
Sparse vector .A UnitVectorBase is an SVectorBase that can take only one nonzero value with value 1 b...
Bound flipping ratio test (long step dual) for SoPlex.
Preconfigured SoPlexLegacy LP-solver.
Definition: soplexlegacy.h:41
void getOriginalProblemBasisColStatus(int &nNonBasicCols)
function to retrieve the column status for the original problem basis from the reduced and complement...
Definition: solvedbds.cpp:3976
void _syncRationalSolution()
synchronizes real solution with rational solution, i.e., copies real solution to rational solution ...
Definition: soplex.cpp:8330
int _intParamValues[SoPlex::INTPARAM_COUNT]
array of current integer parameter values
Definition: soplex.h:1424
Debugging, floating point type and parameter definitions.
void _createDecompReducedAndComplementaryProblems()
creating copies of the original problem that will be manipulated to form the reduced and complementar...
Definition: solvedbds.cpp:591
Simplex basis.Consider the linear program as provided from class SPxLP: where , and ...
Definition: spxbasis.h:82
bool areLPsInSync(const bool checkVecVals=true, const bool checkMatVals=false, const bool quiet=false) const
checks if real LP and rational LP are in sync; dimensions will always be compared, vector and matrix values only if the respective parameter is set to true. If quiet is set to true the function will only display which vectors are different.
Definition: soplex.cpp:6896
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
Definition: nameset.h:61
int _beforeLiftRows
Definition: soplex.h:1641
DataArray< SPxColId > _decompFixedVarDualIDs
Definition: soplex.h:1750
partial multiple pricer based on Dantzig pricing
Definition: soplex.h:1154
lower and upper bound finite, but different
Definition: soplex.h:1657
DualSign getOrigProbDualVariableSign(int rowNumber)
returns the expected sign of the dual variables for the original problem
Definition: solvedbds.cpp:3406
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
DVectorReal _manualLhs
Definition: soplex.h:1605
equilibrium scaling on rows and columns
Definition: soplex.h:1113
bool _storedBasis
Definition: soplex.h:1640
minimize number of basic slack variables, i.e. more variables between bounds
Definition: soplex.h:1267
void _storeLPReal()
stores objective, bounds, and sides of real LP
LP least squares scaling.
Rational _rationalNegInfty
Definition: soplex.h:1558
const SVectorRational & rowVectorRational(int i) const
returns vector of row i
Definition: soplex.cpp:1152
DataArray< SPxColId > _decompCompPrimalFixedVarIDs
Definition: soplex.h:1753
void printStatus(std::ostream &os, SPxSolver::Status status)
prints status
Definition: soplex.cpp:6790
threshold on number of rows vs. number of columns for switching from column to row representations in...
Definition: soplex.h:1322
lower bound equals upper bound
Definition: soplex.h:1660
Collection of dense, sparse, and semi-sparse vectors.
column representation Ax - s = 0, lower <= x <= upper, lhs <= s <= rhs
Definition: soplex.h:1045
bool getSlacksReal(VectorReal &vector)
gets the vector of slack values if available; returns true on success
Definition: soplex.cpp:2988
Implementation of Sparse Linear Solver.This class implements a SLinSolver interface by using the spar...
Definition: slufactor.h:41
automatic pricer
Definition: soplex.h:1148
int * _decompViolatedRows
Definition: soplex.h:1762
DataArray< SPxColId > _decompVarBoundDualIDs
Definition: soplex.h:1751
DataArray< SPxRowId > _decompDualRowIDs
Definition: soplex.h:1748
Everything should be within this namespace.
bool setRealParam(const RealParam param, const Real value, const bool init=true)
sets real parameter value; returns true on success
Definition: soplex.cpp:5986
void _changeLhsReal(const VectorReal &lhs)
changes left-hand side vector for constraints to lhs and adjusts basis
Definition: soplex.cpp:7482
int numCompProbIter
Definition: soplex.h:1784
DVectorReal _manualUpper
Definition: soplex.h:1604
void _writeOriginalProblemBasis(const char *filename, NameSet *rowNames, NameSet *colNames, bool cpxFormat)
function to build a basis for the original problem as given by the solution to the reduced problem ...
Definition: solvedbds.cpp:4031
working tolerance for feasibility in floating-point solver during iterative refinement ...
Definition: soplex.h:1304
SPxLPReal * _realLP
Definition: soplex.h:1592
bool _lowerFinite(const RangeType &rangeType) const
checks whether RangeType corresponds to finite lower bound
Definition: soplex.cpp:7318
the maximum number of rows that are added in each iteration of the decomposition based simplex ...
Definition: soplex.h:1013
bool loadSettingsFile(const char *filename)
reads settings file; returns true on success
Definition: soplex.cpp:6361
SPxGeometSC _scalerGeo1
Definition: soplex.h:1574
void _preprocessAndSolveReal(bool applyPreprocessing)
solves real LP with/without preprocessing
Definition: solvereal.cpp:187
void _deleteAndUpdateRowsComplementaryProblem(SPxRowId rangedRowIds[], int &naddedrows)
removing rows from the complementary problem.
Definition: solvedbds.cpp:1998
int numNonzerosReal() const
returns number of nonzeros
Definition: soplex.cpp:815
SoPlex & operator=(const SoPlex &rhs)
assignment operator
Definition: soplex.cpp:621
Dantzig pricer.Class SPxDantzigPR is an implementation class of an SPxPricer implementing Dantzig&#39;s d...
Definition: spxdantzigpr.h:38
bool getRedCostViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of reduced costs; returns true on success
Definition: soplex.cpp:3477
Harris pricing with shifting.
SPxDevexPR _pricerDevex
Definition: soplex.h:1584
Real minAbsNonzero
Definition: soplex.h:1790
DVector _decompFeasVector
Definition: soplex.h:1733
Real objReal(int i) const
returns objective value of column i
Definition: soplex.cpp:1027
DataArray< RangeType > _rowTypes
Definition: soplex.h:1664
void _removeColReal(int i)
removes column i
Definition: soplex.cpp:7861
void _changeRowReal(int i, const LPRowReal &lprow)
replaces row i with lprow and adjusts basis
Definition: soplex.cpp:7457
void setIntegralityInformation(int ncols, int *intInfo)
pass integrality information about the variables to the solver
Definition: soplex.cpp:1080
DVectorRational _modObj
Definition: soplex.h:1635
SPxSumST _starterSum
Definition: soplex.h:1579
void getBasisInd(int *bind) const
gets the indices of the basic columns and rows; basic column n gives value n, basic row m gives value...
Definition: soplex.cpp:3978
row representation (lower,lhs) <= (x,Ax) <= (upper,rhs)
Definition: soplex.h:1048
apply rational reconstruction after each iterative refinement?
Definition: soplex.h:913
void _changeColReal(int i, const LPColReal &lpcol)
replaces column i with lpcol and adjusts basis
Definition: soplex.cpp:7614
void _formDecompComplementaryProblem()
forms the complementary problem
Definition: solvedbds.cpp:720
Real minAbsNonzeroReal() const
returns smallest non-zero element in absolute value
Definition: soplex.cpp:824
Weighted start basis.
type of pricer
Definition: soplex.h:977
Saving LPs in a form suitable for SoPlex.Class SPxLPBase provides the data structures required for sa...
Definition: spxlpbase.h:80
const VectorReal & lowerRealInternal() const
returns lower bound vector
Definition: soplex.cpp:990
bool getDualReal(VectorReal &vector)
gets the dual solution vector if available; returns true on success
Definition: soplex.cpp:3018
SPxHarrisRT _ratiotesterHarris
Definition: soplex.h:1588
int * _fixedOrigVars
Definition: soplex.h:1765
int * _decompRowStatus
Definition: soplex.h:1739
void changeColReal(int i, const LPColReal &lpcol)
replaces column i with lpcol
Definition: soplex.cpp:1519
Steepest edge pricer with exact initialization of weights.
working tolerance for optimality in floating-point solver during iterative refinement ...
Definition: soplex.h:1307
void clearLPReal()
clears the LP
Definition: soplex.cpp:1880
Preconfigured SoPlex LP-solver.
Definition: soplex.h:90
int _nCompPrimalRows
Definition: soplex.h:1772
should the dual of the complementary problem be used in the decomposition simplex?
Definition: soplex.h:904
void removeRowRational(int i)
removes row i
Definition: soplex.cpp:2577
Type
(In)Equality type of an LP row.
Definition: lprowbase.h:72
Real maxAbsNonzero
Definition: soplex.h:1791
DVectorRational _unboundedLhs
Definition: soplex.h:1623
void getOriginalProblemBasisRowStatus(DataArray< int > &degenerateRowNums, DataArray< SPxSolver::VarStatus > &degenerateRowStatus, int &nDegenerateRows, int &nNonBasicRows)
function to retrieve the original problem row basis status from the reduced and complementary problem...
Definition: solvedbds.cpp:3786
DSVectorRational _primalDualDiff
Definition: soplex.h:1636
int _decompDisplayLine
Definition: soplex.h:1775
SPxVectorST _starterVector
Definition: soplex.h:1580
LP scaling base class.
DVectorRational _unboundedUpper
Definition: soplex.h:1622
bool getBoundViolationReal(Real &maxviol, Real &sumviol)
gets violation of bounds; returns true on success
Definition: soplex.cpp:3063
bool writeFileReal(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const DIdxSet *intvars=0, const bool unscale=true) const
writes real LP to file; LP or MPS format is chosen from the extension in filename; if rowNames and co...
Definition: soplex.cpp:5136
Simple heuristic SPxStarter.Testing version of an SPxVectorST using a very simplistic heuristic to bu...
Definition: spxsumst.h:37
const VectorRational & upperRational() const
returns upper bound vector
Definition: soplex.cpp:1233
NameSet * _colNames
Definition: soplex.h:1778
Weighted start basis.Class SPxWeightST is an implementation of a SPxStarter for generating a Simplex ...
Definition: spxweightst.h:56
decide according to READMODE
Definition: soplex.h:1225
SPxSolver _solver
Definition: soplex.h:1569
mode for a posteriori feasibility checks
Definition: soplex.h:992
refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix ...
Definition: soplex.h:1331
void printDecompDisplayLine(SPxSolver &solver, const SPxOut::Verbosity origVerb, bool force, bool forceHead)
prints a display line of the flying table for the DBDS
Definition: solvedbds.cpp:3426
Partial multiple pricing.
Verbosity
Verbosity level.
Definition: spxout.h:72
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:288
void _identifyComplementaryPrimalFixedPrimalVars(int *currFixedVars)
removing the dual columns related to the fixed variables
Definition: solvedbds.cpp:3045
int _optimizeCalls
Definition: soplex.h:1831
LPRowRational::Type rowTypeRational(int i) const
returns inequality type of row i
Definition: soplex.cpp:1197
Textbook ratio test for SoPlex.Class SPxDefaultRT provides an implementation of the textbook ratio te...
Definition: spxdefaultrt.h:42
type of algorithm, i.e., primal or dual
Definition: soplex.h:944
bool * _decompReducedProbRows
Definition: soplex.h:1737
void _recomputeRangeTypesReal()
recomputes range types from scratch using real LP
Definition: soplex.cpp:8249
void _getRowsForRemovalComplementaryProblem(int *nonposind, int *bind, int *rowsforremoval, int *nrowsforremoval, int nnonposind)
computes the rows to remove from the complementary problem
Definition: solvedbds.cpp:1978
DataArray< UnitVectorRational *> _unitMatrixRational
Definition: soplex.h:1639
bool getDualFarkasRational(VectorRational &vector)
gets the Farkas proof if LP is infeasible; returns true on success
Definition: soplex.cpp:3358
LP scaler abstract base class.Instances of classes derived from SPxScaler may be loaded to SoPlex in ...
Definition: spxscaler.h:76
stalling refinement limit (-1 if unlimited)
Definition: soplex.h:959
DataArray< SPxSolver::VarStatus > _basisStatusRows
Definition: soplex.h:1815
Set of LP rows.Class LPRowSetBase implements a set of LPRowBase%s. Unless for memory limitations...
Definition: lprowsetbase.h:44
int origCountLhs
Definition: soplex.h:1798
SPxSolver::VarStatus basisColStatus(int col) const
returns basis status for a single column
Definition: soplex.cpp:3902
void _solveDecompositionDualSimplex()
solves LP using the decomposition based dual simplex
Definition: solvedbds.cpp:48
should dual infeasibility be tested in order to try to return a dual solution even if primal infeasib...
Definition: soplex.h:891
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
gets number of available dual norms
Definition: soplex.cpp:1056
void _factorizeColumnRational(SolRational &sol, DataArray< SPxSolver::VarStatus > &basisStatusRows, DataArray< SPxSolver::VarStatus > &basisStatusCols, bool &stoppedTime, bool &stoppedIter, bool &error, bool &optimal)
factorizes rational basis matrix in column representation
bool getFastCondition(Real &condition, int type=0)
compute condition number estimate based on the diagonal of the LU factorization; returns true on succ...
Definition: soplex.cpp:4059
generic solution-based crash basis
Definition: soplex.h:1141
std::string description[SoPlex::BOOLPARAM_COUNT]
array of descriptions for boolean parameters
Definition: soplex.h:1368
SPxBasis _decompTransBasis
Definition: soplex.h:1730
const VectorReal & rhsRealInternal() const
returns right-hand side vector, ignoring scaling
Definition: soplex.cpp:882
the verbosity of the decomposition based simplex
Definition: soplex.h:1019
should lifting be used to reduce range of nonzero matrix coefficients?
Definition: soplex.h:885
int dmaxSizePrimalRational(const int base=2)
get size of largest denominator in primal solution
Definition: soplex.cpp:3820
bool getEstimatedCondition(Real &condition)
computes an estimated condition number for the current basis matrix using the power method; returns t...
Definition: soplex.cpp:4074
Real maxObjReal(int i) const
returns objective value of column i after transformation to a maximization problem; since this is how...
Definition: soplex.cpp:1047
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:412
void setRandomSeed(unsigned int seed)
set the random seeds of the solver instance
Definition: soplex.cpp:7155
DataArray< int > _rationalLUSolverBind
Definition: soplex.h:1618
should the degeneracy be computed for each basis?
Definition: soplex.h:901
bool _applyPolishing
Definition: soplex.h:1601
bool getExactCondition(Real &condition)
computes the exact condition number for the current basis matrix using the power method; returns true...
Definition: soplex.cpp:4089
SPxStatus
basis status.
Definition: spxbasis.h:90
const char * getScalerName()
name of scaling method
Definition: soplex.cpp:5090
Real solveTime() const
time spent in last call to solve
Definition: soplex.cpp:5044
void addColsReal(const LPColSetReal &lpcolset)
adds multiple columns
Definition: soplex.cpp:1371
int _nDualRows
Definition: soplex.h:1770
SPxSolver::Status status() const
returns the current solver status
Definition: soplex.cpp:2896
SolReal _solReal
Definition: soplex.h:1818
zero tolerance used in update of the factorization
Definition: soplex.h:1286
lower limit on objective value
Definition: soplex.h:1298
void changeLowerRational(const VectorRational &lower)
changes vector of lower bounds to lower
Definition: soplex.cpp:2305
DSVectorRational _tauColVector
Definition: soplex.h:1625
DVectorRational _modLower
Definition: soplex.h:1631
both bounds are infinite
Definition: soplex.h:1648
bool getRedCostViolationReal(Real &maxviol, Real &sumviol)
gets violation of reduced costs; returns true on success
Definition: soplex.cpp:3144
BoolParam
boolean parameters
Definition: soplex.h:882
bool _hasSolReal
Definition: soplex.h:1823
int numProbRows
Definition: soplex.h:1787
int * _decompViolatedBounds
Definition: soplex.h:1761
bool _isSolveStopped(bool &stoppedTime, bool &stoppedIter) const
should solving process be stopped?
Definition: soplex.cpp:7240
void _changeBoundsReal(const VectorReal &lower, const VectorReal &upper)
changes vectors of column bounds to lower and upper and adjusts basis
Definition: soplex.cpp:7725
Settings()
default constructor initializing default settings
Definition: soplex.cpp:510
void _updateComplementaryDualSlackColCoeff()
updating the slack column coefficients to adjust for equality constraints
Definition: solvedbds.cpp:2763
maximum number of conjugate gradient iterations in least square scaling
Definition: soplex.h:1004
sparse pricing threshold (#violations < dimension * SPARSITY_THRESHOLD activates sparse pricing) ...
Definition: soplex.h:1319
Settings & operator=(const Settings &settings)
assignment operator
Definition: soplex.cpp:532
void addRowReal(const LPRowReal &lprow)
adds a single row
Definition: soplex.cpp:1317
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
Definition: spxid.h:55
bool getPrimalRayRational(VectorRational &vector)
gets the primal ray if LP is unbounded; returns true on success
Definition: soplex.cpp:3313
dual feasibility tolerance
Definition: soplex.h:1277
void _ensureRealLPLoaded()
ensures that the real LP and the basis are loaded in the solver; performs no sync ...
Definition: soplex.cpp:8016
high verbosity level
Definition: soplex.h:1087
void _restoreBasis()
restore basis
no solution polishing
Definition: soplex.h:1261
void changeRowReal(int i, const LPRowReal &lprow)
replaces row i with lprow
Definition: soplex.cpp:1389
void setBasis(const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[])
sets starting basis via arrays of statuses
Definition: soplex.cpp:4995
Hybrid pricer.
bool setIntParam(const IntParam param, const int value, const bool init=true)
sets integer parameter value; returns true on success
Definition: soplex.cpp:5632
void _identifyComplementaryDualFixedPrimalVars(int *currFixedVars)
removing the dual columns related to the fixed variables
Definition: solvedbds.cpp:2800
SolRational _solRational
Definition: soplex.h:1819
bool saveSettingsFile(const char *filename, const bool onlyChanged=false) const
writes settings file; returns true on success
Definition: soplex.cpp:6276
Textbook ratio test for SoPlex.
DataArray< SPxColId > _decompCompPrimalVarBoundIDs
Definition: soplex.h:1754
Real objValueReal()
returns the objective value if a primal solution is available
Definition: soplex.cpp:2952
void _updateComplementaryDualFixedPrimalVars(int *currFixedVars)
updating the dual columns related to the fixed primal variables.
Definition: solvedbds.cpp:2907
DualSign getExpectedDualVariableSign(int rowNumber)
returns the expected sign of the dual variables for the reduced problem
Definition: solvedbds.cpp:3387
bool _parseSettingsLine(char *line, const int lineNumber)
parses one line in a settings file and returns true on success; note that the string is modified ...
Definition: soplex.cpp:8365
void changeRhsReal(const VectorReal &rhs)
changes right-hand side vector to rhs
Definition: soplex.cpp:1445
bool decompTerminate(Real timeLimit)
function call to terminate the decomposition simplex
Definition: solvedbds.cpp:3763
SPxLeastSqSC _scalerLeastsq
Definition: soplex.h:1577
geometric frequency at which to apply rational reconstruction
Definition: soplex.h:1325
void changeElementRational(int i, int j, const Rational &val)
changes matrix entry in row i and column j to val
Definition: soplex.cpp:2541
SPxStarter * _starter
Definition: soplex.h:1596
bool _hasSolRational
Definition: soplex.h:1824
void writeStateRational(const char *filename, const NameSet *rowNames=0, const NameSet *colNames=0, const bool cpxFormat=false) const
writes internal LP, basis information, and parameter settings; if rowNames and colNames are NULL...
Definition: soplex.cpp:5508
void getOriginalProblemStatistics()
stores the problem statistics of the original problem
Definition: solvedbds.cpp:3468
void _enableSimplifierAndScaler()
enables simplifier and scaler according to current parameters
Definition: soplex.cpp:7940
int _nPrimalRows
Definition: soplex.h:1767
primal simplex algorithm, i.e., entering for column and leaving for row representation ...
Definition: soplex.h:1055
DVectorRational _modRhs
Definition: soplex.h:1634
bool checkBasisDualFeasibility(Vector feasVec)
checks the dual feasibility of the current basis
Definition: solvedbds.cpp:3335
LP equilibrium scaling.
bool setBoolParam(const BoolParam param, const bool value, const bool init=true)
sets boolean parameter value; returns true on success
Definition: soplex.cpp:5578
should LP be transformed to equality form before a rational solve?
Definition: soplex.h:888
int * _decompColStatus
Definition: soplex.h:1740
void _idxToPerm(int *idx, int idxSize, int *perm, int permSize) const
creates a permutation for removing rows/columns from an array of indices
Definition: soplex.cpp:7181
Equilibrium row/column scaling.This SPxScaler implementation performs equilibrium scaling of the LPs ...
Definition: spxequilisc.h:35
SPxSolver::VarStatus basisRowStatus(int row) const
returns basis status for a single row
Definition: soplex.cpp:3877
the number of iterations before the decomposition simplex initialisation is terminated.
Definition: soplex.h:1010
int numIncludedRows
Definition: soplex.h:1781
store only real LP
Definition: soplex.h:1186
const VectorRational & maxObjRational() const
returns objective function vector after transformation to a maximization problem; since this is how i...
Definition: soplex.cpp:1298
upper threshold in lifting (nonzero matrix coefficients with larger absolute value will be reformulat...
Definition: soplex.h:1316
DataArray< SPxSolver::VarStatus > _storedBasisStatusRows
Definition: soplex.h:1637
SPxLPReal _manualRealLP
Definition: soplex.h:1608
void _addRowsReal(const LPRowSetReal &lprowset)
adds multiple rows to the real LP and adjusts basis
Definition: soplex.cpp:7370
void _updateDecompReducedProblemViol(bool allrows)
update the reduced problem with additional columns and rows based upon the violated original bounds a...
Definition: solvedbds.cpp:1311
int numColsReal() const
returns number of columns
Definition: soplex.cpp:806
void changeUpperReal(const VectorReal &upper)
changes vector of upper bounds to upper
Definition: soplex.cpp:1576
bool hasPrimalRay() const
is a primal unbounded ray available?
Definition: soplex.cpp:2920
void removeColRational(int i)
removes column i
Definition: soplex.cpp:2672
SPxLPReal * _decompLP
Definition: soplex.h:1593
bool _isRealLPScaled
Definition: soplex.h:1600
IntParam
integer parameters
Definition: soplex.h:935
void _lift()
reduces matrix coefficient in absolute value by the lifting procedure of Thiele et al...
force iterative refinement
Definition: soplex.h:1215
SPxSolver::Status _status
Definition: soplex.h:1812
void getObjRational(VectorRational &obj) const
gets objective function vector
Definition: soplex.cpp:1269
Rational _rationalZero
Definition: soplex.h:1836
LP column.Class LPColBase provides a datatype for storing the column of an LP a the form similar to ...
Definition: lpcolbase.h:45
void _completeRangeTypesRational()
completes range type arrays after adding columns and/or rows
Definition: soplex.cpp:8236
RangeType _rangeTypeReal(const Real &lower, const Real &upper) const
determines RangeType from real bounds
Definition: soplex.cpp:7255
const VectorReal & lhsRealInternal() const
returns left-hand side vector, ignoring scaling
Definition: soplex.cpp:909
SPxSimplifier * _simplifier
Definition: soplex.h:1594
void removeRowRangeRational(int start, int end, int perm[]=0)
removes rows start to end including both; an array perm of size numRowsRational() may be passed as bu...
Definition: soplex.cpp:2654
void _updateDecompComplementaryPrimalProblem(bool origObj)
update the primal complementary problem with additional columns and rows
Definition: solvedbds.cpp:2452
void addRowsReal(const LPRowSetReal &lprowset)
adds multiple rows
Definition: soplex.cpp:1335
int numProbCols
Definition: soplex.h:1788
geometric mean scaling on rows and columns, max 1 round
Definition: soplex.h:1116
DataArray< SPxColId > _decompDualColIDs
Definition: soplex.h:1749
void _untransformEquality(SolRational &sol)
undoes transformation to equality form
perturb the entire problem or only the relevant bounds of s single pivot?
Definition: soplex.h:928
Steepest edge pricer.Class SPxSteepPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteeppr.h:41
should row and bound violations be computed explicitly in the update of reduced problem in the decomp...
Definition: soplex.h:907
Harris pricing with shifting.Class SPxHarrisRT is a stable implementation of a SPxRatioTester class a...
Definition: spxharrisrt.h:40
upper bound is finite, lower bound is infinite
Definition: soplex.h:1654
int * _decompCompProbColIDsIdx
Definition: soplex.h:1741
bool getBoundViolationRational(Rational &maxviol, Rational &sumviol)
gets violation of bounds; returns true on success
Definition: soplex.cpp:3373
SPxAutoPR _pricerAuto
Definition: soplex.h:1581
least square scaling
Definition: soplex.h:1122
only error output
Definition: soplex.h:1075
LP simplifier for removing uneccessary row/columns.This SPxSimplifier is mainly based on the paper "P...
Definition: spxmainsm.h:60
void _untransformFeasibility(SolRational &sol, bool infeasible)
undoes transformation to feasibility problem
int totalSizeDualRational(const int base=2)
get size of dual solution
Definition: soplex.cpp:3778
void _updateDecompComplementaryDualProblem(bool origObj)
update the dual complementary problem with additional columns and rows
Definition: solvedbds.cpp:2070
void removeRowsReal(int perm[])
removes all rows with an index i such that perm[i] < 0; upon completion, perm[i] >= 0 indicates the n...
Definition: soplex.cpp:1722
const VectorRational & lowerRational() const
returns lower bound vector
Definition: soplex.cpp:1251