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