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