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