Scippy

SoPlex

Sequential object-oriented simPlex

spxsolver.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file spxsolver.h
17  * @brief main LP solver class
18  */
19 #ifndef _SPXSOLVER_H_
20 #define _SPXSOLVER_H_
21 
22 #include <assert.h>
23 #include <iostream>
24 #include <iomanip>
25 #include <sstream>
26 
27 #include "spxdefines.h"
28 #include "timer.h"
29 #include "timerfactory.h"
30 #include "spxlp.h"
31 #include "spxbasis.h"
32 #include "array.h"
33 #include "random.h"
34 #include "unitvector.h"
35 #include "updatevector.h"
36 
37 #define HYPERPRICINGTHRESHOLD 5000 /**< do (auto) hyper pricing only if problem size (cols+rows) is larger than HYPERPRICINGTHRESHOLD */
38 #define HYPERPRICINGSIZE 100 /**< size of initial candidate list for hyper pricing */
39 #define SPARSITYFACTOR 0.6 /**< percentage of infeasibilities that is considered sparse */
40 #define DENSEROUNDS 5 /**< number of refactorizations until sparsity is tested again */
41 #define SPARSITY_TRADEOFF 0.8 /**< threshold to decide whether Ids or coIds are preferred to enter the basis;
42  * coIds are more likely to enter if SPARSITY_TRADEOFF is close to 0
43  */
44 #define MAXNCLCKSKIPS 32 /**< maximum number of clock skips (iterations without time measuring) */
45 #define SAFETYFACTOR 1e-2 /**< the probability to skip the clock when the time limit has been reached */
46 #define NINITCALLS 200 /**< the number of clock updates in isTimelimitReached() before clock skipping starts */
47 namespace soplex
48 {
49 class SPxPricer;
50 class SPxRatioTester;
51 class SPxStarter;
52 
53 /**@brief Sequential object-oriented SimPlex.
54  @ingroup Algo
55 
56  SPxSolver is an LP solver class using the revised Simplex algorithm. It
57  provides two basis representations, namely a column basis and a row basis
58  (see #Representation). For both representations, a primal and
59  dual algorithm is available (see \ref Type).
60 
61  In addition, SPxSolver can be customized with various respects:
62  - pricing algorithms using SPxPricer
63  - ratio test using class SPxRatioTester
64  - computation of a start basis using class SPxStarter
65  - preprocessing of the LP using class SPxSimplifier
66  - termination criteria by overriding
67 
68  SPxSolver is derived from SPxLP that is used to store the LP to be solved.
69  Hence, the LPs solved with SPxSolver have the general format
70 
71  \f[
72  \begin{array}{rl}
73  \hbox{max} & \mbox{maxObj}^T x \\
74  \hbox{s.t.} & \mbox{lhs} \le Ax \le \mbox{rhs} \\
75  & \mbox{low} \le x \le \mbox{up}
76  \end{array}
77  \f]
78 
79  Also, SPxLP provide all manipulation methods for the LP. They allow
80  SPxSolver to be used within cutting plane algorithms.
81 */
82 class SPxSolver : public SPxLP, protected SPxBasis
83 {
84  friend class SoPlexLegacy;
85  friend class SPxFastRT;
86  friend class SPxBoundFlippingRT;
87 
88 public:
89 
90  //-----------------------------
91  /**@name Data Types */
92  //@{
93  /// LP basis representation.
94  /** Solving LPs with the Simplex algorithm requires the definition of a
95  * \em basis. A basis can be defined as a set of column vectors or a
96  * set of row vectors building a nonsingular matrix. We will refer to
97  * the first case as the \em columnwise representation and the latter
98  * case will be called the \em rowwise representation.
99  *
100  * Type Representation determines the representation of SPxSolver, i.e.
101  * a columnwise (#COLUMN == 1) or rowwise (#ROW == -1) one.
102  */
103  enum Representation
104  {
105  ROW = -1, ///< rowwise representation.
106  COLUMN = 1 ///< columnwise representation.
107  };
109  /// Algorithmic type.
110  /** SPxSolver uses the reviesed Simplex algorithm to solve LPs.
111  * Mathematically, one distinguishes the \em primal from the
112  * \em dual algorihm. Algorithmically, these relate to the two
113  * types #ENTER or #LEAVE. How they relate, depends on the chosen
114  * basis representation. This is desribed by the following table:
115  *
116  * <TABLE>
117  * <TR><TD>&nbsp;</TD><TD>ENTER </TD><TD>LEAVE </TD></TR>
118  * <TR><TD>ROW </TD><TD>DUAL </TD><TD>PRIMAL</TD></TR>
119  * <TR><TD>COLUMN</TD><TD>PRIMAL</TD><TD>DUAL </TD></TR>
120  * </TABLE>
121  */
122  enum Type
123  {
124  /// Entering Simplex.
125  /** The Simplex loop for the entering Simplex can be sketched
126  * as follows:
127  * - \em Pricing : Select a variable to #ENTER the basis.
128  * - \em Ratio-Test : Select variable to #LEAVE the
129  * basis such that the basis remains feasible.
130  * - Perform the basis update.
131  */
132  ENTER = -1,
133  /// Leaving Simplex.
134  /** The Simplex loop for the leaving Simplex can be sketched
135  * as follows:
136  * - \em Pricing: Select a variable to #LEAVE the basis.
137  * - \em Ratio-Test: Select variable to #ENTER the
138  * basis such that the basis remains priced.
139  * - Perform the basis update.
140  */
141  LEAVE = 1
142  };
144  /// Pricing type.
145  /** In case of the #ENTER%ing Simplex algorithm, for performance
146  * reasons it may be advisable not to compute and maintain up to
147  * date vectors #pVec() and #test() and instead compute only some
148  * of its elements explicitely. This is controled by the #Pricing type.
149  */
150  enum Pricing
151  {
152  /// Full pricing.
153  /** If #FULL pricing in selected for the #ENTER%ing Simplex,
154  * vectors #pVec() and #test() are kept up to date by
155  * SPxSolver. An SPxPricer only needs to select an Id such
156  * that the #test() or #coTest() value is < 0.
157  */
158  FULL,
159  /// Partial pricing.
160  /** When #PARTIAL pricing in selected for the #ENTER%ing
161  * Simplex, vectors #pVec() and #test() are not set up and
162  * updated by SPxSolver. However, vectors #coPvec() and
163  * #coTest() are still kept up to date by SPxSolver.
164  * An SPxPricer object needs to compute the values for
165  * #pVec() and #test() itself in order to select an
166  * appropriate pivot with #test() < 0. Methods \ref computePvec(int)
167  * "computePvec(i)" and \ref computeTest(int) "computeTest(i)"
168  * will assist the used to do so. Note
169  * that it may be feasible for a pricer to return an Id with
170  * #test() > 0; such will be rejected by SPxSolver.
171  */
172  PARTIAL
173  };
175  /// Improved dual simplex status
176  /** The improved dual simplex requires a starting basis to perform the problem partitioning. This flag sets the
177  * status of the improved dual simplex to indicate whether the starting basis must be found or not.
178  */
179  enum DecompStatus
180  {
181  /// Starting basis has not been found yet
182  FINDSTARTBASIS = 0,
183  /// Starting basis has been found and the simplex can be executed as normal
185  };
187  enum VarStatus
188  {
189  ON_UPPER, ///< variable set to its upper bound.
190  ON_LOWER, ///< variable set to its lower bound.
191  FIXED, ///< variable fixed to identical bounds.
192  ZERO, ///< free variable fixed to zero.
193  BASIC, ///< variable is basic.
194  UNDEFINED ///< nothing known about basis status (possibly due to a singular basis in transformed problem)
195  };
197  /**@todo In spxchange, change the status to
198  if (m_status > 0) m_status = REGULAR;
199  */
200  enum Status
201  {
202  ERROR = -15, ///< an error occured.
203  NO_RATIOTESTER = -14, ///< No ratiotester loaded
204  NO_PRICER = -13, ///< No pricer loaded
205  NO_SOLVER = -12, ///< No linear solver loaded
206  NOT_INIT = -11, ///< not initialised error
207  ABORT_EXDECOMP = -10, ///< solve() aborted to exit decomposition simplex
208  ABORT_DECOMP = -9, ///< solve() aborted due to commence decomposition simplex
209  ABORT_CYCLING = -8, ///< solve() aborted due to detection of cycling.
210  ABORT_TIME = -7, ///< solve() aborted due to time limit.
211  ABORT_ITER = -6, ///< solve() aborted due to iteration limit.
212  ABORT_VALUE = -5, ///< solve() aborted due to objective limit.
213  SINGULAR = -4, ///< Basis is singular, numerical troubles?
214  NO_PROBLEM = -3, ///< No Problem has been loaded.
215  REGULAR = -2, ///< LP has a usable Basis (maybe LP is changed).
216  RUNNING = -1, ///< algorithm is running
217  UNKNOWN = 0, ///< nothing known on loaded problem.
218  OPTIMAL = 1, ///< LP has been solved to optimality.
219  UNBOUNDED = 2, ///< LP has been proven to be primal unbounded.
220  INFEASIBLE = 3, ///< LP has been proven to be primal infeasible.
221  INForUNBD = 4 ///< LP is primal infeasible or unbounded.
222  };
224  /// objective for solution polishing
225  enum SolutionPolish
226  {
227  POLISH_OFF, ///< don't perform modifications on optimal basis
228  POLISH_INTEGRALITY, ///< maximize number of basic slack variables, i.e. more variables on bounds
229  POLISH_FRACTIONALITY ///< minimize number of basic slack variables, i.e. more variables in between bounds
230  };
232 
233  //@}
234 
235 private:
236 
237  //-----------------------------
238  /**@name Private data */
239  //@{
240  Type theType; ///< entering or leaving algortihm.
241  Pricing thePricing; ///< full or partial pricing.
242  Representation theRep; ///< row or column representation.
243  SolutionPolish polishObj; ///< objective of solution polishing
244  Timer* theTime; ///< time spent in last call to method solve()
245  Timer::TYPE timerType; ///< type of timer (user or wallclock)
246  Real theCumulativeTime; ///< cumulative time spent in all calls to method solve()
247  int maxIters; ///< maximum allowed iterations.
248  Real maxTime; ///< maximum allowed time.
249  int nClckSkipsLeft; ///< remaining number of times the clock can be safely skipped
250  long nCallsToTimelim; /// < the number of calls to the method isTimeLimitReached()
251  Real objLimit; ///< objective value limit.
252  Status m_status; ///< status of algorithm.
254  Real m_nonbasicValue; ///< nonbasic part of current objective value
255  bool m_nonbasicValueUpToDate; ///< true, if the stored objValue is up to date
257  Real m_pricingViol; ///< maximal feasibility violation of current solution
258  bool m_pricingViolUpToDate; ///< true, if the stored violation is up to date
259  Real m_pricingViolCo; ///< maximal feasibility violation of current solution in coDim
260  bool m_pricingViolCoUpToDate; ///< true, if the stored violation in coDim is up to date
262  Real m_entertol; ///< feasibility tolerance maintained during entering algorithm
263  Real m_leavetol; ///< feasibility tolerance maintained during leaving algorithm
264  Real theShift; ///< sum of all shifts applied to any bound.
265  Real lastShift; ///< for forcing feasibility.
266  int m_maxCycle; ///< maximum steps before cycling is detected.
267  int m_numCycle; ///< actual number of degenerate steps so far.
268  bool initialized; ///< true, if all vectors are setup.
270  SSVector* solveVector2; ///< when 2 systems are to be solved at a time; typically for speepest edge weights
271  SSVector* solveVector2rhs; ///< when 2 systems are to be solved at a time; typically for speepest edge weights
272  SSVector* solveVector3; ///< when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic solution will be modified!)
273  SSVector* solveVector3rhs; ///< when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic solution will be modified!)
274  SSVector* coSolveVector2; ///< when 2 systems are to be solved at a time; typically for speepest edge weights
275  SSVector* coSolveVector2rhs; ///< when 2 systems are to be solved at a time; typically for speepest edge weights
276  SSVector* coSolveVector3; ///< when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic solution will be modified!)
277  SSVector* coSolveVector3rhs; ///< when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic solution will be modified!)
279  bool freePricer; ///< true iff thepricer should be freed inside of object
280  bool freeRatioTester; ///< true iff theratiotester should be freed inside of object
281  bool freeStarter; ///< true iff thestarter should be freed inside of object
283  /* Store the index of a leaving variable if only an instable entering variable has been found.
284  instableLeave == true iff this instable basis change should be performed.
285  (see spxsolve.cpp and leave.cpp) */
286  int instableLeaveNum;
287  bool instableLeave;
290  /* Store the id of an entering row or column if only an instable pivot has been found.
291  instableEnter == true iff this instable basis change should be performed.
292  (see spxsolve.cpp and enter.cpp) */
294  bool instableEnter;
298  int displayFreq;
299  Real sparsePricingFactor; ///< enable sparse pricing when viols < factor * dim()
301  bool getStartingDecompBasis; ///< flag to indicate whether the simplex is solved to get the starting improved dual simplex basis
302  bool computeDegeneracy;
303  int degenCompIterOffset; ///< the number of iterations performed before the degeneracy level is computed
304  int decompIterationLimit; ///< the maximum number of iterations before the decomposition simplex is aborted.
306  bool fullPerturbation; ///< whether to perturb the entire problem or just the bounds relevant for the current pivot
307  int printCondition; ///< printing the current condition number in the log (0 - off, 1 - estimate,exact, 2 - exact)";ratio estimate , 3 - sum estimate, 4 - product estimate)
309  //@}
310 
311 protected:
312 
313  //-----------------------------
314  /**@name Protected data */
315  //@{
316  Array < UnitVector > unitVecs; ///< array of unit vectors
317  const SVSet* thevectors; ///< the LP vectors according to representation
318  const SVSet* thecovectors; ///< the LP coVectors according to representation
320  DVector primRhs; ///< rhs vector for computing the primal vector
321  UpdateVector primVec; ///< primal vector
322  DVector dualRhs; ///< rhs vector for computing the dual vector
323  UpdateVector dualVec; ///< dual vector
324  UpdateVector addVec; ///< storage for thePvec = &addVec
326  DVector theURbound; ///< Upper Row Feasibility bound
327  DVector theLRbound; ///< Lower Row Feasibility bound
328  DVector theUCbound; ///< Upper Column Feasibility bound
329  DVector theLCbound; ///< Lower Column Feasibility bound
331  /** In entering Simplex algorithm, the ratio test must ensure that all
332  * \em basic variables remain within their feasibility bounds. To give fast
333  * acces to them, the bounds of basic variables are copied into the
334  * following two vectors.
335  */
336  DVector theUBbound; ///< Upper Basic Feasibility bound
337  DVector theLBbound; ///< Lower Basic Feasibility bound
346  UpdateVector* theRPvec; ///< row pricing vector
347  UpdateVector* theCPvec; ///< column pricing vector
349  // The following vectors serve for the virtualization of shift bounds
350  //@todo In prinziple this schould be references.
351  DVector* theUbound; ///< Upper bound for vars
352  DVector* theLbound; ///< Lower bound for vars
353  DVector* theCoUbound; ///< Upper bound for covars
354  DVector* theCoLbound; ///< Lower bound for covars
356  // The following vectors serve for the virtualization of testing vectors
360  DSVector primalRay; ///< stores primal ray in case of unboundedness
361  DSVector dualFarkas; ///< stores dual farkas proof in case of infeasibility
363  int leaveCount; ///< number of LEAVE iterations
364  int enterCount; ///< number of ENTER iterations
365  int primalCount; ///< number of primal iterations
366  int polishCount; ///< number of solution polishing iterations
368  int boundflips; ///< number of performed bound flips
369  int totalboundflips; ///< total number of bound flips
371  int enterCycles; ///< the number of degenerate steps during the entering algorithm
372  int leaveCycles; ///< the number of degenerate steps during the leaving algorithm
373  int enterDegenCand; ///< the number of degenerate candidates in the entering algorithm
374  int leaveDegenCand; ///< the number of degenerate candidates in the leaving algorithm
375  Real primalDegenSum; ///< the sum of the primal degeneracy percentage
376  Real dualDegenSum; ///< the sum of the dual degeneracy percentage
381  //@}
383  //-----------------------------
384  /**@name Precision */
385  //@{
386  /// is the solution precise enough, or should we increase delta() ?
387  virtual bool precisionReached(Real& newpricertol) const;
388  //@}
389 
390 public:
391 
392  /// The random number generator used throughout the whole computation. Its seed can be modified.
393  Random random;
394 
395  /** For the leaving Simplex algorithm this vector contains the indices of infeasible basic variables;
396  * for the entering Simplex algorithm this vector contains the indices of infeasible slack variables.
397  */
399  /**For the entering Simplex algorithm these vectors contains the indices of infeasible basic variables.
400  */
402 
403  /// store indices that were changed in the previous iteration and must be checked in hyper pricing
407  /** Binary vectors to store whether basic indices are infeasible
408  * the i-th entry equals false, if the i-th basic variable is not infeasible
409  * the i-th entry equals true, if the i-th basic variable is infeasible
410  */
411  DataArray<int> isInfeasible; ///< 0: index not violated, 1: index violated, 2: index violated and among candidate list
412  DataArray<int> isInfeasibleCo; ///< 0: index not violated, 1: index violated, 2: index violated and among candidate list
414  /// These values enable or disable sparse pricing
415  bool sparsePricingLeave; ///< true if sparsePricing is turned on in the leaving Simplex
416  bool sparsePricingEnter; ///< true if sparsePricing is turned on in the entering Simplex for slack variables
417  bool sparsePricingEnterCo; ///< true if sparsePricing is turned on in the entering Simplex
418  bool hyperPricingLeave; ///< true if hyper sparse pricing is turned on in the leaving Simplex
419  bool hyperPricingEnter; ///< true if hyper sparse pricing is turned on in the entering Simplex
421  int remainingRoundsLeave; ///< number of dense rounds/refactorizations until sparsePricing is enabled again
425  SPxOut* spxout; ///< message handler
426 
427  DataArray<int> integerVariables; ///< supplementary variable information, 0: continous variable, 1: integer variable
428 
429  //-----------------------------
430  void setOutstream(SPxOut& newOutstream)
431  {
432  spxout = &newOutstream;
433  SPxLP::spxout = &newOutstream;
434  }
435 
436  /// set refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix
437  void setNonzeroFactor( Real f )
438  {
440  }
441 
442  /// set refactor threshold for fill-in in current factor update compared to fill-in in last factorization
443  void setFillFactor( Real f )
444  {
446  }
447 
448  /// set refactor threshold for memory growth in current factor update compared to the last factorization
449  void setMemFactor( Real f )
450  {
452  }
453 
454  /**@name Access */
455  //@{
456  /// return the version of SPxSolver as number like 123 for 1.2.3
457  int version() const
458  {
460  }
461  /// return the internal subversion of SPxSolver as number
462  int subversion() const
463  {
465  }
466  /// return the current basis representation.
467  Representation rep() const
468  {
469  return theRep;
470  }
471 
472  /// return current Type.
473  Type type() const
474  {
475  return theType;
476  }
477 
478  /// return current Pricing.
479  Pricing pricing() const
480  {
481  return thePricing;
482  }
483 
484  /// return current starter.
485  SPxStarter* starter() const
486  {
487  return thestarter;
488  }
489  //@}
490 
491  //-----------------------------
492  /**@name Setup
493  * Before solving an LP with an instance of SPxSolver,
494  * the following steps must be performed:
495  *
496  * -# Load the LP by copying an external LP or reading it from an
497  * input stream.
498  * -# Setup the pricer to use by loading an \ref soplex::SPxPricer
499  * "SPxPricer" object (if not already done in a previous call).
500  * -# Setup the ratio test method to use by loading an
501  * \ref soplex::SPxRatioTester "SPxRatioTester" object
502  * (if not already done in a previous call).
503  * -# Setup the linear system solver to use by loading an
504  * \ref soplex::SLinSolver "SLinSolver" object
505  * (if not already done in a previous call).
506  * -# Optionally setup an start basis generation method by loading an
507  * \ref soplex::SPxStarter "SPxStarter" object.
508  * -# Optionally setup a start basis by loading a
509  * \ref soplex::SPxBasis::Desc "SPxBasis::Desc" object.
510  * -# Optionally switch to another basis
511  * \ref soplex::SPxSolver::Representation "Representation"
512  * by calling method \ref soplex::SPxSolver::setRep() "setRep()".
513  * -# Optionally switch to another algorithm
514  * \ref soplex::SPxSolver::Type "Type"
515  * by calling method \ref soplex::SPxSolver::setType() "setType()".
516  *
517  * Now the solver is ready for execution. If the loaded LP is to be solved
518  * again from scratch, this can be done with method
519  * \ref soplex::SPxSolver::reLoad() "reLoad()". Finally,
520  * \ref soplex::SPxSolver::clear() "clear()" removes the LP from the solver.
521  */
522  //@{
523  /// read LP from input stream.
524  virtual bool read(std::istream& in, NameSet* rowNames = 0,
525  NameSet* colNames = 0, DIdxSet* intVars = 0);
526 
527  /// copy LP.
528  virtual void loadLP(const SPxLP& LP, bool initSlackBasis = true);
529  /// setup linear solver to use. If \p destroy is true, \p slusolver will be freed in destructor.
530  virtual void setBasisSolver(SLinSolver* slu, const bool destroy = false);
531  /// setup pricer to use. If \p destroy is true, \p pricer will be freed in destructor.
532  virtual void setPricer(SPxPricer* pricer, const bool destroy = false);
533  /// setup ratio-tester to use. If \p destroy is true, \p tester will be freed in destructor.
534  virtual void setTester(SPxRatioTester* tester, const bool destroy = false);
535  /// setup starting basis generator to use. If \p destroy is true, \p starter will be freed in destructor.
536  virtual void setStarter(SPxStarter* starter, const bool destroy = false);
537  /// set a start basis.
538  virtual void loadBasis(const SPxBasis::Desc&);
539 
540  /// initialize #ROW or #COLUMN representation.
541  void initRep (Representation p_rep);
542  /// switch to #ROW or #COLUMN representation if not already used.
543  void setRep (Representation p_rep);
544  /// set \ref soplex::SPxSolver::LEAVE "LEAVE" or \ref soplex::SPxSolver::ENTER "ENTER" algorithm.
545  void setType(Type tp);
546  /// set \ref soplex::SPxSolver::FULL "FULL" or \ref soplex::SPxSolver::PARTIAL "PARTIAL" pricing.
547  void setPricing(Pricing pr);
548  /// turn on or off the improved dual simplex.
549  void setDecompStatus(DecompStatus decomp_stat);
550 
551  /// reload LP.
552  virtual void reLoad();
553 
554  /// clear all data in solver.
555  virtual void clear();
556 
557  /// unscales the LP and reloads the basis
559 
560  /** Load basis from \p filename in MPS format. If \p rowNames and \p
561  * colNames are \c NULL, default names are used for the constraints and
562  * variables.
563  */
564  virtual bool readBasisFile(const char* filename,
565  const NameSet* rowNames, const NameSet* colNames);
566 
567  /** Write basis to \p filename in MPS format. If \p rowNames and \p
568  * colNames are \c NULL, default names are used for the constraints and
569  * variables.
570  */
571  virtual bool writeBasisFile(const char* filename,
572  const NameSet* rowNames, const NameSet* colNames, const bool cpxFormat = false) const;
573 
574  /** Write current LP, basis, and parameter settings.
575  * LP is written in MPS format to "\p filename".mps, basis is written in "\p filename".bas, and parameters
576  * are written to "\p filename".set. If \p rowNames and \p colNames are \c NULL, default names are used for
577  * the constraints and variables.
578  */
579  virtual bool writeState(const char* filename,
580  const NameSet* rowNames = NULL, const NameSet* colNames = NULL, const bool cpxFormat = false) const;
581 
582  //@}
583 
584  /**@name Solving LPs */
585  //@{
586  /// solve loaded LP.
587  /** Solves the loaded LP by processing the Simplex iteration until
588  * the termination criteria is fullfilled (see #terminate()).
589  * The SPxStatus of the solver will indicate the reason for termination.
590  *
591  * @throw SPxStatusException if either no problem, solver, pricer
592  * or ratiotester loaded or if solve is still running when it shouldn't be
593  */
594  virtual Status solve();
595 
596  /** Identify primal basic variables that have zero reduced costs and
597  * try to pivot them out of the basis to make them tight.
598  * This is supposed to decrease the number of fractional variables
599  * when solving LP relaxations of (mixed) integer programs.
600  * The objective must not be modified during this procedure.
601  */
603 
604  /// set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack)
605  void setSolutionPolishing(SolutionPolish _polishObj)
606  {
607  polishObj = _polishObj;
608  }
609 
610  /// return objective of solution polishing
612  {
613  return polishObj;
614  }
615 
616  /// Status of solution process.
617  Status status() const;
618 
619  /// current objective value.
620  /**@return Objective value of the current solution vector
621  * (see #getPrimal()).
622  */
623  virtual Real value();
624 
625  // update nonbasic part of the objective value by the given amount
626  /**@return whether nonbasic part of objective is reliable
627  */
628  bool updateNonbasicValue(Real objChange);
629 
630  // trigger a recomputation of the nonbasic part of the objective value
632  {
633  m_nonbasicValue = 0.0;
634  m_nonbasicValueUpToDate = false;
635  }
636 
637 #if 0
638  /// returns dualsol^T b + min{(objvec^T - dualsol^T A) x} calculated in interval arithmetics
639  Real provedBound(Vector& dualsol, const Vector& objvec) const;
640 
641  /// proved dual bound for objective value.
642  virtual Real provedDualbound() const;
643 
644  /// returns whether an infeasible LP is proven to be infeasible.
645  virtual bool isProvenInfeasible() const;
646 #endif
647 
648  /// get solution vector for primal variables.
649  /** This method returns the Status of the basis.
650  * If it is #REGULAR or better,
651  * the primal solution vector of the current basis will be copied
652  * to the argument \p vector. Hence, \p vector must be of dimension
653  * #nCols().
654  *
655  * @throw SPxStatusException if not initialized
656  */
657  virtual Status getPrimal(Vector& vector) const;
658 
659  /// get vector of slack variables.
660  /** This method returns the Status of the basis.
661  * If it is #REGULAR or better,
662  * the slack variables of the current basis will be copied
663  * to the argument \p vector. Hence, \p vector must be of dimension
664  * #nRows().
665  *
666  * @warning Because SPxSolver supports range constraints as its
667  * default, slack variables are defined in a nonstandard way:
668  * Let \em x be the current solution vector and \em A the constraint
669  * matrix. Then the vector of slack variables is defined as
670  * \f$s = Ax\f$.
671  *
672  * @throw SPxStatusException if no problem loaded
673  */
674  virtual Status getSlacks (Vector& vector) const;
675 
676  /// get current solution vector for dual variables.
677  /** This method returns the Status of the basis.
678  * If it is #REGULAR or better,
679  * the vector of dual variables of the current basis will be copied
680  * to the argument \p vector. Hence, \p vector must be of dimension
681  * #nRows().
682  *
683  * @warning Even though mathematically, each range constraint would
684  * account for two dual variables (one for each inequaility), only
685  * #nRows() dual variables are setup via the following
686  * construction: Given a range constraint, there are three possible
687  * situations:
688  * - None of its inequalities is tight: The dual variables
689  * for both are 0. However, when shifting (see below)
690  * occurs, it may be set to a value other than 0, which
691  * models a perturbed objective vector.
692  * - Both of its inequalities are tight: In this case the
693  * range constraint models an equality and we adopt the
694  * standard definition.
695  * - One of its inequalities is tight while the other is not:
696  * In this case only the dual variable for the tight
697  * constraint is given with the standard definition, while
698  * the other constraint is implicitely set to 0.
699  *
700  * @throw SPxStatusException if no problem loaded
701  */
702  virtual Status getDual (Vector& vector) const;
703 
704  /// get vector of reduced costs.
705  /** This method returns the Status of the basis.
706  * If it is #REGULAR or better,
707  * the vector of reduced costs of the current basis will be copied
708  * to the argument \p vector. Hence, \p vector must be of dimension
709  * #nCols().
710  *
711  * Let \em d denote the vector of dual variables, as defined above,
712  * and \em A the LPs constraint matrix. Then the reduced cost vector
713  * \em r is defined as \f$r^T = c^T - d^TA\f$.
714  *
715  * @throw SPxStatusException if no problem loaded
716  */
717  virtual Status getRedCost (Vector& vector) const;
718 
719  /// get primal ray in case of unboundedness.
720  /// @throw SPxStatusException if no problem loaded
721  virtual Status getPrimalray (Vector& vector) const;
722 
723  /// get dual farkas proof of infeasibility.
724  /// @throw SPxStatusException if no problem loaded
725  virtual Status getDualfarkas (Vector& vector) const;
726 
727  /// print display line of flying table
728  virtual void printDisplayLine(const bool force = false, const bool forceHead = false);
729 
730  /// Termination criterion.
731  /** This method is called in each Simplex iteration to determine, if
732  * the algorithm is to terminate. In this case a nonzero value is
733  * returned.
734  *
735  * This method is declared virtual to allow for implementation of
736  * other stopping criteria or using it as callback method within the
737  * Simplex loop, by overriding the method in a derived class.
738  * However, all implementations must terminate with the
739  * statement \c return SPxSolver::#terminate(), if no own termination
740  * criteria is encountered.
741  *
742  * Note, that the Simplex loop stopped even when #terminate()
743  * returns 0, if the LP has been solved to optimality (i.e. no
744  * further pricing succeeds and no shift is present).
745  */
746  virtual bool terminate ();
747  //@}
748 
749  //-----------------------------
750  /**@name Control Parameters */
751  //@{
752  /// values \f$|x| < \epsilon\f$ are considered to be 0.
753  /** if you want another value for epsilon, use
754  * \ref soplex::Param::setEpsilon() "Param::setEpsilon()".
755  */
756  Real epsilon() const
757  {
758  return primVec.delta().getEpsilon();
759  }
760  /// feasibility tolerance maintained by ratio test during ENTER algorithm.
761  Real entertol() const
762  {
763  assert(m_entertol > 0.0);
764 
765  return m_entertol;
766  }
767  /// feasibility tolerance maintained by ratio test during LEAVE algorithm.
768  Real leavetol() const
769  {
770  assert(m_leavetol > 0.0);
771 
772  return m_leavetol;
773  }
774  /// allowed primal feasibility tolerance.
775  Real feastol() const
776  {
777  assert(m_entertol > 0.0);
778  assert(m_leavetol > 0.0);
779 
780  return theRep == COLUMN ? m_entertol : m_leavetol;
781  }
782  /// allowed optimality, i.e., dual feasibility tolerance.
783  Real opttol() const
784  {
785  assert(m_entertol > 0.0);
786  assert(m_leavetol > 0.0);
787 
788  return theRep == COLUMN ? m_leavetol : m_entertol;
789  }
790  /// guaranteed primal and dual bound violation for optimal solution, returning the maximum of feastol() and opttol(), i.e., the less tight tolerance.
791  Real delta() const
792  {
793  assert(m_entertol > 0.0);
794  assert(m_leavetol > 0.0);
795 
796  return m_entertol > m_leavetol ? m_entertol : m_leavetol;
797  }
798  /// set parameter \p feastol.
799  void setFeastol(Real d);
800  /// set parameter \p opttol.
801  void setOpttol(Real d);
802  /// set parameter \p delta, i.e., set \p feastol and \p opttol to same value.
803  void setDelta(Real d);
804  /// set timing type
805  void setTiming(Timer::TYPE ttype)
806  {
807  theTime = TimerFactory::switchTimer(theTime, ttype);
808  timerType = ttype;
809  }
810  /// set timing type
812  {
813  assert(timerType == theTime->type());
814  return timerType;
815  }
816 
817  /// set display frequency
818  void setDisplayFreq(int freq)
819  {
820  displayFreq = freq;
821  }
822 
823  /// get display frequency
824  int getDisplayFreq()
825  {
826  return displayFreq;
827  }
828 
829  /// print condition number within the usual output
830  void setConditionInformation(int condInfo)
831  {
832  printCondition = condInfo;
833  }
834 
835  // enable sparse pricing when viols < fac * dim()
836  void setSparsePricingFactor(Real fac)
837  {
838  sparsePricingFactor = fac;
839  }
840  /// enable or disable hyper sparse pricing
841  void hyperPricing(bool h);
842 
843  /** SPxSolver considers a Simplex step as degenerate if the
844  * steplength does not exceed #epsilon(). Cycling occurs if only
845  * degenerate steps are taken. To prevent this situation, SPxSolver
846  * perturbs the problem such that nondegenerate steps are ensured.
847  *
848  * maxCycle() controls how agressive such perturbation is
849  * performed, since no more than maxCycle() degenerate steps are
850  * accepted before perturbing the LP. The current number of consecutive
851  * degenerate steps is counted by numCycle().
852  */
853  /// maximum number of degenerate simplex steps before we detect cycling.
854  int maxCycle() const
855  {
856  return m_maxCycle;
857  }
858  /// actual number of degenerate simplex steps encountered so far.
859  int numCycle() const
860  {
861  return m_numCycle;
862  }
863 
864  /// perturb entire problem or only the bounds relevant to the current pivot
865  void useFullPerturbation(bool full)
866  {
867  fullPerturbation = full;
868  }
869 
870  virtual Real getFastCondition()
871  {
873  }
874 
875  //@}
876 
877 private:
878 
879  //-----------------------------
880  /**@name Private helpers */
881  //@{
882  ///
883  void localAddRows(int start);
884  ///
885  void localAddCols(int start);
886  ///
887  void setPrimal(Vector& p_vector);
888  ///
889  void setSlacks(Vector& p_vector);
890  ///
891  void setDual(Vector& p_vector);
892  ///
893  void setRedCost(Vector& p_vector);
894  //@}
895 
896 protected:
897 
898  //-----------------------------
899  /**@name Protected helpers */
900  //@{
901  ///
902  virtual void addedRows(int n);
903  ///
904  virtual void addedCols(int n);
905  ///
906  virtual void doRemoveRow(int i);
907  ///
908  virtual void doRemoveRows(int perm[]);
909  ///
910  virtual void doRemoveCol(int i);
911  ///
912  virtual void doRemoveCols(int perm[]);
913  //@}
914 
915 public:
916 
917  //-----------------------------
918  /**@name Modification */
919  /// \p scale determines whether the new data needs to be scaled according to the existing LP (persistent scaling)
920  //@{
921  ///
922  virtual void changeObj(const Vector& newObj, bool scale = false);
923  ///
924  virtual void changeObj(int i, const Real& newVal, bool scale = false);
925  ///
926  virtual void changeObj(SPxColId p_id, const Real& p_newVal, bool scale = false)
927  {
928  changeObj(number(p_id), p_newVal, scale);
929  }
930  ///
931  virtual void changeMaxObj(const Vector& newObj, bool scale = false);
932  ///
933  virtual void changeMaxObj(int i, const Real& newVal, bool scale = false);
934  ///
935  virtual void changeMaxObj(SPxColId p_id, const Real& p_newVal, bool scale = false)
936  {
937  changeMaxObj(number(p_id), p_newVal, scale);
938  }
939  ///
940  virtual void changeRowObj(const Vector& newObj, bool scale = false);
941  ///
942  virtual void changeRowObj(int i, const Real& newVal, bool scale = false);
943  ///
944  virtual void changeRowObj(SPxRowId p_id, const Real& p_newVal, bool scale = false)
945  {
946  changeRowObj(number(p_id), p_newVal);
947  }
948  ///
949  virtual void clearRowObjs()
950  {
952  unInit();
953  }
954  ///
955  virtual void changeLowerStatus(int i, Real newLower, Real oldLower = 0.0);
956  ///
957  virtual void changeLower(const Vector& newLower, bool scale = false);
958  ///
959  virtual void changeLower(int i, const Real& newLower, bool scale = false);
960  ///
961  virtual void changeLower(SPxColId p_id, const Real& p_newLower, bool scale = false)
962  {
963  changeLower(number(p_id), p_newLower, scale);
964  }
965  ///
966  virtual void changeUpperStatus(int i, Real newUpper, Real oldLower = 0.0);
967  ///
968  virtual void changeUpper(const Vector& newUpper, bool scale = false);
969  ///
970  virtual void changeUpper(int i, const Real& newUpper, bool scale = false);
971  ///
972  virtual void changeUpper(SPxColId p_id, const Real& p_newUpper, bool scale = false)
973  {
974  changeUpper(number(p_id), p_newUpper, scale);
975  }
976  ///
977  virtual void changeBounds(const Vector& newLower, const Vector& newUpper, bool scale = false);
978  ///
979  virtual void changeBounds(int i, const Real& newLower, const Real& newUpper, bool scale = false);
980  ///
981  virtual void changeBounds(SPxColId p_id, const Real& p_newLower, const Real& p_newUpper, bool scale = false)
982  {
983  changeBounds(number(p_id), p_newLower, p_newUpper, scale);
984  }
985  ///
986  virtual void changeLhsStatus(int i, Real newLhs, Real oldLhs = 0.0);
987  ///
988  virtual void changeLhs(const Vector& newLhs, bool scale = false);
989  ///
990  virtual void changeLhs(int i, const Real& newLhs, bool scale = false);
991  ///
992  virtual void changeLhs(SPxRowId p_id, const Real& p_newLhs, bool scale = false)
993  {
994  changeLhs(number(p_id), p_newLhs, scale);
995  }
996  ///
997  virtual void changeRhsStatus(int i, Real newRhs, Real oldRhs = 0.0);
998  ///
999  virtual void changeRhs(const Vector& newRhs, bool scale = false);
1000  ///
1001  virtual void changeRhs(int i, const Real& newRhs, bool scale = false);
1002  ///
1003  virtual void changeRhs(SPxRowId p_id, const Real& p_newRhs, bool scale = false)
1004  {
1005  changeRhs(number(p_id), p_newRhs, scale);
1006  }
1007  ///
1008  virtual void changeRange(const Vector& newLhs, const Vector& newRhs, bool scale = false);
1009  ///
1010  virtual void changeRange(int i, const Real& newLhs, const Real& newRhs, bool scale = false);
1011  ///
1012  virtual void changeRange(SPxRowId p_id, const Real& p_newLhs, const Real& p_newRhs, bool scale = false)
1013  {
1014  changeRange(number(p_id), p_newLhs, p_newRhs, scale);
1015  }
1016  ///
1017  virtual void changeRow(int i, const LPRow& newRow, bool scale = false);
1018  ///
1019  virtual void changeRow(SPxRowId p_id, const LPRow& p_newRow, bool scale = false)
1020  {
1021  changeRow(number(p_id), p_newRow, scale);
1022  }
1023  ///
1024  virtual void changeCol(int i, const LPCol& newCol, bool scale = false);
1025  ///
1026  virtual void changeCol(SPxColId p_id, const LPCol& p_newCol, bool scale = false)
1027  {
1028  changeCol(number(p_id), p_newCol, scale);
1029  }
1030  ///
1031  virtual void changeElement(int i, int j, const Real& val, bool scale = false);
1032  ///
1033  virtual void changeElement(SPxRowId rid, SPxColId cid, const Real& val, bool scale = false)
1034  {
1035  changeElement(number(rid), number(cid), val, scale);
1036  }
1037  ///
1038  virtual void changeSense(SPxSense sns);
1039  //@}
1040 
1041  //------------------------------------
1042  /**@name Dimension and codimension */
1043  //@{
1044  /// dimension of basis matrix.
1045  int dim() const
1046  {
1047  return thecovectors->num();
1048  }
1049  /// codimension.
1050  int coDim() const
1051  {
1052  return thevectors->num();
1053  }
1054  //@}
1055 
1056  //------------------------------------
1057  /**@name Variables and Covariables
1058  * Class SPxLP introduces \ref soplex::SPxId "SPxIds" to identify
1059  * row or column data of an LP. SPxSolver uses this concept to
1060  * access data with respect to the chosen representation.
1061  */
1062  //@{
1063  /// id of \p i 'th vector.
1064  /** The \p i 'th Id is the \p i 'th SPxRowId for a rowwise and the
1065  * \p i 'th SPxColId for a columnwise basis represenation. Hence,
1066  * 0 <= i < #coDim().
1067  */
1068  SPxId id(int i) const
1069  {
1070  if (rep() == ROW)
1071  {
1072  SPxRowId rid = SPxLP::rId(i);
1073  return SPxId(rid);
1074  }
1075  else
1076  {
1077  SPxColId cid = SPxLP::cId(i);
1078  return SPxId(cid);
1079  }
1080  }
1081 
1082  /// id of \p i 'th covector.
1083  /** The \p i 'th #coId() is the \p i 'th SPxColId for a rowwise and the
1084  * \p i 'th SPxRowId for a columnwise basis represenation. Hence,
1085  * 0 <= i < #dim().
1086  */
1087  SPxId coId(int i) const
1088  {
1089  if (rep() == ROW)
1090  {
1091  SPxColId cid = SPxLP::cId(i);
1092  return SPxId(cid);
1093  }
1094  else
1095  {
1096  SPxRowId rid = SPxLP::rId(i);
1097  return SPxId(rid);
1098  }
1099  }
1100 
1101  /// Is \p p_id an SPxId ?
1102  /** This method returns wheather or not \p p_id identifies a vector
1103  * with respect to the chosen representation.
1104  */
1105  bool isId(const SPxId& p_id) const
1106  {
1107  return p_id.info * theRep > 0;
1108  }
1109 
1110  /// Is \p p_id a CoId.
1111  /** This method returns wheather or not \p p_id identifies a coVector
1112  * with respect to the chosen representation.
1113  */
1114  bool isCoId(const SPxId& p_id) const
1115  {
1116  return p_id.info * theRep < 0;
1117  }
1118  //@}
1119 
1120  //------------------------------------
1121  /**@name Vectors and Covectors */
1122  //@{
1123  /// \p i 'th vector.
1124  /**@return a reference to the \p i 'th, 0 <= i < #coDim(), vector of
1125  * the loaded LP (with respect to the chosen representation).
1126  */
1127  const SVector& vector(int i) const
1128  {
1129  return (*thevectors)[i];
1130  }
1131 
1132  ///
1133  const SVector& vector(const SPxRowId& rid) const
1134  {
1135  assert(rid.isValid());
1136  return (rep() == ROW)
1137  ? (*thevectors)[number(rid)]
1138  : static_cast<const SVector&>(unitVecs[number(rid)]);
1139  }
1140  ///
1141  const SVector& vector(const SPxColId& cid) const
1142  {
1143  assert(cid.isValid());
1144  return (rep() == COLUMN)
1145  ? (*thevectors)[number(cid)]
1146  : static_cast<const SVector&>(unitVecs[number(cid)]);
1147  }
1148 
1149  /// vector associated to \p p_id.
1150  /**@return Returns a reference to the vector of the loaded LP corresponding
1151  * to \p id (with respect to the chosen representation). If \p p_id is
1152  * an id, a vector of the constraint matrix is returned, otherwise
1153  * the corresponding unit vector (of the slack variable or bound
1154  * inequality) is returned.
1155  * @todo The implementation does not exactly look like it will do
1156  * what is promised in the describtion.
1157  */
1158  const SVector& vector(const SPxId& p_id) const
1159  {
1160  assert(p_id.isValid());
1161 
1162  return p_id.isSPxRowId()
1163  ? vector(SPxRowId(p_id))
1164  : vector(SPxColId(p_id));
1165  }
1166 
1167  /// \p i 'th covector of LP.
1168  /**@return a reference to the \p i 'th, 0 <= i < #dim(), covector of
1169  * the loaded LP (with respect to the chosen representation).
1170  */
1171  const SVector& coVector(int i) const
1172  {
1173  return (*thecovectors)[i];
1174  }
1175  ///
1176  const SVector& coVector(const SPxRowId& rid) const
1177  {
1178  assert(rid.isValid());
1179  return (rep() == COLUMN)
1180  ? (*thecovectors)[number(rid)]
1181  : static_cast<const SVector&>(unitVecs[number(rid)]);
1182  }
1183  ///
1184  const SVector& coVector(const SPxColId& cid) const
1185  {
1186  assert(cid.isValid());
1187  return (rep() == ROW)
1188  ? (*thecovectors)[number(cid)]
1189  : static_cast<const SVector&>(unitVecs[number(cid)]);
1190  }
1191  /// coVector associated to \p p_id.
1192  /**@return a reference to the covector of the loaded LP
1193  * corresponding to \p p_id (with respect to the chosen
1194  * representation). If \p p_id is a coid, a covector of the constraint
1195  * matrix is returned, otherwise the corresponding unit vector is
1196  * returned.
1197  */
1198  const SVector& coVector(const SPxId& p_id) const
1199  {
1200  assert(p_id.isValid());
1201  return p_id.isSPxRowId()
1202  ? coVector(SPxRowId(p_id))
1203  : coVector(SPxColId(p_id));
1204  }
1205  /// return \p i 'th unit vector.
1206  const SVector& unitVector(int i) const
1207  {
1208  return unitVecs[i];
1209  }
1210  //@}
1211 
1212  //------------------------------------
1213  /**@name Variable status
1214  * The Simplex basis assigns a \ref soplex::SPxBasis::Desc::Status
1215  * "Status" to each variable and covariable. Depending on the
1216  * representation, the status indicates that the corresponding
1217  * vector is in the basis matrix or not.
1218  */
1219  //@{
1220  /// Status of \p i 'th variable.
1221  SPxBasis::Desc::Status varStatus(int i) const
1222  {
1223  return desc().status(i);
1224  }
1225 
1226  /// Status of \p i 'th covariable.
1227  SPxBasis::Desc::Status covarStatus(int i) const
1228  {
1229  return desc().coStatus(i);
1230  }
1231 
1232  /// does \p stat describe a basic index ?
1233  bool isBasic(SPxBasis::Desc::Status stat) const
1234  {
1235  return (stat * rep() > 0);
1236  }
1237 
1238  /// is the \p p_id 'th vector basic ?
1239  bool isBasic(const SPxId& p_id) const
1240  {
1241  assert(p_id.isValid());
1242  return p_id.isSPxRowId()
1243  ? isBasic(SPxRowId(p_id))
1244  : isBasic(SPxColId(p_id));
1245  }
1246 
1247  /// is the \p rid 'th vector basic ?
1248  bool isBasic(const SPxRowId& rid) const
1249  {
1250  return isBasic(desc().rowStatus(number(rid)));
1251  }
1252 
1253  /// is the \p cid 'th vector basic ?
1254  bool isBasic(const SPxColId& cid) const
1255  {
1256  return isBasic(desc().colStatus(number(cid)));
1257  }
1258 
1259  /// is the \p i 'th row vector basic ?
1260  bool isRowBasic(int i) const
1261  {
1262  return isBasic(desc().rowStatus(i));
1263  }
1264 
1265  /// is the \p i 'th column vector basic ?
1266  bool isColBasic(int i) const
1267  {
1268  return isBasic(desc().colStatus(i));
1269  }
1270 
1271  /// is the \p i 'th vector basic ?
1272  bool isBasic(int i) const
1273  {
1274  return isBasic(desc().status(i));
1275  }
1276 
1277  /// is the \p i 'th covector basic ?
1278  bool isCoBasic(int i) const
1279  {
1280  return isBasic(desc().coStatus(i));
1281  }
1282  //@}
1283 
1284  /// feasibility vector.
1285  /** This method return the \em feasibility vector. If it satisfies its
1286  * bound, the basis is called feasible (independently of the chosen
1287  * representation). The feasibility vector has dimension #dim().
1288  *
1289  * For the entering Simplex, #fVec is kept within its bounds. In
1290  * contrast to this, the pricing of the leaving Simplex selects an
1291  * element of #fVec, that violates its bounds.
1292  */
1293  UpdateVector& fVec() const
1294  {
1295  return *theFvec;
1296  }
1297  /// right-hand side vector for \ref soplex::SPxSolver::fVec "fVec"
1298  /** The feasibility vector is computed by solving a linear system with the
1299  * basis matrix. The right-hand side vector of this system is referred
1300  * to as \em feasibility, \em right-hand \em side \em vector #fRhs().
1301  *
1302  * For a row basis, #fRhs() is the objective vector (ignoring shifts).
1303  * For a column basis, it is the sum of all nonbasic vectors scaled by
1304  * the factor of their bound.
1305  */
1306  const Vector& fRhs() const
1307  {
1308  return *theFrhs;
1309  }
1310  /// upper bound for \ref soplex::SPxSolver::fVec "fVec".
1311  const Vector& ubBound() const
1312  {
1313  return theUBbound;
1314  }
1315  /// upper bound for #fVec, writable.
1316  /** This method returns the upper bound for the feasibility vector.
1317  * It may only be called for the #ENTER%ing Simplex.
1318  *
1319  * For the #ENTER%ing Simplex algorithms, the feasibility vector is
1320  * maintained to fullfill its bounds. As #fVec itself, also its
1321  * bounds depend on the chosen representation. Further, they may
1322  * need to be shifted (see below).
1323  */
1324  Vector& ubBound()
1325  {
1326  return theUBbound;
1327  }
1328  /// lower bound for \ref soplex::SPxSolver::fVec "fVec".
1329  const Vector& lbBound() const
1330  {
1331  return theLBbound;
1332  }
1333  /// lower bound for #fVec, writable.
1334  /** This method returns the lower bound for the feasibility vector.
1335  * It may only be called for the #ENTER%ing Simplex.
1336  *
1337  * For the #ENTER%ing Simplex algorithms, the feasibility vector is
1338  * maintained to fullfill its bounds. As #fVec itself, also its
1339  * bound depend on the chosen representation. Further, they may
1340  * need to be shifted (see below).
1341  */
1342  Vector& lbBound()
1343  {
1344  return theLBbound;
1345  }
1346 
1347  /// Violations of \ref soplex::SPxSolver::fVec "fVec"
1348  /** For the leaving Simplex algorithm, pricing involves selecting a
1349  * variable from #fVec that violates its bounds that is to leave
1350  * the basis. When a SPxPricer is called to select such a
1351  * leaving variable, #fTest() contains the vector of violations:
1352  * For #fTest()[i] < 0, the \c i 'th basic variable violates one of
1353  * its bounds by the given value. Otherwise no bound is violated.
1354  */
1355  const Vector& fTest() const
1356  {
1357  assert(type() == LEAVE);
1358  return theCoTest;
1359  }
1360 
1361  /// copricing vector.
1362  /** The copricing vector #coPvec along with the pricing vector
1363  * #pVec are used for pricing in the #ENTER%ing Simplex algorithm,
1364  * i.e. one variable is selected, that violates its bounds. In
1365  * contrast to this, the #LEAVE%ing Simplex algorithm keeps both
1366  * vectors within their bounds.
1367  */
1368  UpdateVector& coPvec() const
1369  {
1370  return *theCoPvec;
1371  }
1372 
1373  /// Right-hand side vector for \ref soplex::SPxSolver::coPvec "coPvec".
1374  /** The vector #coPvec is computed by solving a linear system with the
1375  * basis matrix and #coPrhs as the right-hand side vector. For
1376  * column basis representation, #coPrhs is build up of the
1377  * objective vector elements of all basic variables. For a row
1378  * basis, it consists of the tight bounds of all basic
1379  * constraints.
1380  */
1381  const Vector& coPrhs() const
1382  {
1383  return *theCoPrhs;
1384  }
1385 
1386  ///
1387  const Vector& ucBound() const
1388  {
1389  assert(theType == LEAVE);
1390  return *theCoUbound;
1391  }
1392  /// upper bound for #coPvec.
1393  /** This method returns the upper bound for #coPvec. It may only be
1394  * called for the leaving Simplex algorithm.
1395  *
1396  * For the leaving Simplex algorithms #coPvec is maintained to
1397  * fullfill its bounds. As #coPvec itself, also its bound depend
1398  * on the chosen representation. Further, they may need to be
1399  * shifted (see below).
1400  */
1401  Vector& ucBound()
1402  {
1403  assert(theType == LEAVE);
1404  return *theCoUbound;
1405  }
1406 
1407  ///
1408  const Vector& lcBound() const
1409  {
1410  assert(theType == LEAVE);
1411  return *theCoLbound;
1412  }
1413  /// lower bound for #coPvec.
1414  /** This method returns the lower bound for #coPvec. It may only be
1415  * called for the leaving Simplex algorithm.
1416  *
1417  * For the leaving Simplex algorithms #coPvec is maintained to
1418  * fullfill its bounds. As #coPvec itself, also its bound depend
1419  * on the chosen representation. Further, they may need to be
1420  * shifted (see below).
1421  */
1422  Vector& lcBound()
1423  {
1424  assert(theType == LEAVE);
1425  return *theCoLbound;
1426  }
1427 
1428  /// violations of \ref soplex::SPxSolver::coPvec "coPvec".
1429  /** In entering Simplex pricing selects checks vectors #coPvec()
1430  * and #pVec() for violation of its bounds. #coTest() contains
1431  * the violations for #coPvec() which are indicated by a negative
1432  * value. That is, if #coTest()[i] < 0, the \p i 'th element of #coPvec()
1433  * is violated by -#coTest()[i].
1434  */
1435  const Vector& coTest() const
1436  {
1437  assert(type() == ENTER);
1438  return theCoTest;
1439  }
1440  /// pricing vector.
1441  /** The pricing vector #pVec is the product of #coPvec with the
1442  * constraint matrix. As #coPvec, also #pVec is maintained within
1443  * its bound for the leaving Simplex algorithm, while the bounds
1444  * are tested for the entering Simplex. #pVec is of dimension
1445  * #coDim(). Vector #pVec() is only up to date for #LEAVE%ing
1446  * Simplex or #FULL pricing in #ENTER%ing Simplex.
1447  */
1448  UpdateVector& pVec() const
1449  {
1450  return *thePvec;
1451  }
1452  ///
1453  const Vector& upBound() const
1454  {
1455  assert(theType == LEAVE);
1456  return *theUbound;
1457  }
1458  /// upper bound for #pVec.
1459  /** This method returns the upper bound for #pVec. It may only be
1460  * called for the leaving Simplex algorithm.
1461  *
1462  * For the leaving Simplex algorithms #pVec is maintained to
1463  * fullfill its bounds. As #pVec itself, also its bound depend
1464  * on the chosen representation. Further, they may need to be
1465  * shifted (see below).
1466  */
1467  Vector& upBound()
1468  {
1469  assert(theType == LEAVE);
1470  return *theUbound;
1471  }
1472 
1473  ///
1474  const Vector& lpBound() const
1475  {
1476  assert(theType == LEAVE);
1477  return *theLbound;
1478  }
1479  /// lower bound for #pVec.
1480  /** This method returns the lower bound for #pVec. It may only be
1481  * called for the leaving Simplex algorithm.
1482  *
1483  * For the leaving Simplex algorithms #pVec is maintained to
1484  * fullfill its bounds. As #pVec itself, also its bound depend
1485  * on the chosen representation. Further, they may need to be
1486  * shifted (see below).
1487  */
1488  Vector& lpBound()
1489  {
1490  assert(theType == LEAVE);
1491  return *theLbound;
1492  }
1493 
1494  /// Violations of \ref soplex::SPxSolver::pVec "pVec".
1495  /** In entering Simplex pricing selects checks vectors #coPvec()
1496  * and #pVec() for violation of its bounds. Vector #test()
1497  * contains the violations for #pVec(), i.e., if #test()[i] < 0,
1498  * the i'th element of #pVec() is violated by #test()[i].
1499  * Vector #test() is only up to date for #FULL pricing.
1500  */
1501  const Vector& test() const
1502  {
1503  assert(type() == ENTER);
1504  return theTest;
1505  }
1506 
1507  /// compute and return \ref soplex::SPxSolver::pVec() "pVec()"[i].
1508  Real computePvec(int i);
1509  /// compute entire \ref soplex::SPxSolver::pVec() "pVec()".
1510  void computePvec();
1511  /// compute and return \ref soplex::SPxSolver::test() "test()"[i] in \ref soplex::SPxSolver::ENTER "ENTER"ing Simplex.
1512  Real computeTest(int i);
1513  /// compute test vector in \ref soplex::SPxSolver::ENTER "ENTER"ing Simplex.
1514  void computeTest();
1515 
1516  //------------------------------------
1517  /**@name Shifting
1518  * The task of the ratio test (implemented in SPxRatioTester classes)
1519  * is to select a variable for the basis update, such that the basis
1520  * remains priced (i.e. both, the pricing and copricing vectors satisfy
1521  * their bounds) or feasible (i.e. the feasibility vector satisfies its
1522  * bounds). However, this can lead to numerically instable basis matrices
1523  * or -- after accumulation of various errors -- even to a singular basis
1524  * matrix.
1525  *
1526  * The key to overcome this problem is to allow the basis to become "a
1527  * bit" infeasible or unpriced, in order provide a better choice for the
1528  * ratio test to select a stable variable. This is equivalent to enlarging
1529  * the bounds by a small amount. This is referred to as \em shifting.
1530  *
1531  * These methods serve for shifting feasibility bounds, either in order
1532  * to maintain numerical stability or initially for computation of
1533  * phase 1. The sum of all shifts applied to any bound is stored in
1534  * \ref soplex::SPxSolver::theShift "theShift".
1535  *
1536  * The following methods are used to shift individual bounds. They are
1537  * mainly intended for stable implenentations of SPxRatioTester.
1538  */
1539  //@{
1540  /// Perform initial shifting to optain an feasible or pricable basis.
1541  void shiftFvec();
1542  /// Perform initial shifting to optain an feasible or pricable basis.
1543  void shiftPvec();
1544 
1545  /// shift \p i 'th \ref soplex::SPxSolver::ubBound "ubBound" to \p to.
1546  void shiftUBbound(int i, Real to)
1547  {
1548  assert(theType == ENTER);
1549  theShift += to - theUBbound[i];
1550  theUBbound[i] = to;
1551  }
1552  /// shift \p i 'th \ref soplex::SPxSolver::lbBound "lbBound" to \p to.
1553  void shiftLBbound(int i, Real to)
1554  {
1555  assert(theType == ENTER);
1556  theShift += theLBbound[i] - to;
1557  theLBbound[i] = to;
1558  }
1559  /// shift \p i 'th \ref soplex::SPxSolver::upBound "upBound" to \p to.
1560  void shiftUPbound(int i, Real to)
1561  {
1562  assert(theType == LEAVE);
1563  theShift += to - (*theUbound)[i];
1564  (*theUbound)[i] = to;
1565  }
1566  /// shift \p i 'th \ref soplex::SPxSolver::lpBound "lpBound" to \p to.
1567  void shiftLPbound(int i, Real to)
1568  {
1569  assert(theType == LEAVE);
1570  theShift += (*theLbound)[i] - to;
1571  (*theLbound)[i] = to;
1572  }
1573  /// shift \p i 'th \ref soplex::SPxSolver::ucBound "ucBound" to \p to.
1574  void shiftUCbound(int i, Real to)
1575  {
1576  assert(theType == LEAVE);
1577  theShift += to - (*theCoUbound)[i];
1578  (*theCoUbound)[i] = to;
1579  }
1580  /// shift \p i 'th \ref soplex::SPxSolver::lcBound "lcBound" to \p to.
1581  void shiftLCbound(int i, Real to)
1582  {
1583  assert(theType == LEAVE);
1584  theShift += (*theCoLbound)[i] - to;
1585  (*theCoLbound)[i] = to;
1586  }
1587  ///
1588  void testBounds() const;
1589 
1590  /// total current shift amount.
1591  virtual Real shift() const
1592  {
1593  return theShift;
1594  }
1595  /// remove shift as much as possible.
1596  virtual void unShift(void);
1597 
1598  /// get violation of constraints.
1599  virtual void qualConstraintViolation(Real& maxviol, Real& sumviol) const;
1600  /// get violations of bounds.
1601  virtual void qualBoundViolation(Real& maxviol, Real& sumviol) const;
1602  /// get the residuum |Ax-b|.
1603  virtual void qualSlackViolation(Real& maxviol, Real& sumviol) const;
1604  /// get violation of optimality criterion.
1605  virtual void qualRedCostViolation(Real& maxviol, Real& sumviol) const;
1606  //@}
1607 
1608 private:
1609 
1610  //------------------------------------
1611  /**@name Perturbation */
1612  //@{
1613  ///
1614  void perturbMin(
1615  const UpdateVector& vec, Vector& low, Vector& up, Real eps, Real delta,
1616  int start = 0, int incr = 1);
1617  ///
1618  void perturbMax(
1619  const UpdateVector& vec, Vector& low, Vector& up, Real eps, Real delta,
1620  int start = 0, int incr = 1);
1621  ///
1622  Real perturbMin(const UpdateVector& uvec,
1623  Vector& low, Vector& up, Real eps, Real delta,
1624  const SPxBasis::Desc::Status* stat, int start, int incr);
1625  ///
1626  Real perturbMax(const UpdateVector& uvec,
1627  Vector& low, Vector& up, Real eps, Real delta,
1628  const SPxBasis::Desc::Status* stat, int start, int incr);
1629  //@}
1630 
1631  //------------------------------------
1632  /**@name The Simplex Loop
1633  * We now present a set of methods that may be usefull when implementing
1634  * own SPxPricer or SPxRatioTester classes. Here is, how
1635  * SPxSolver will call methods from its loaded SPxPricer and
1636  * SPxRatioTester.
1637  *
1638  * For the entering Simplex:
1639  * -# \ref soplex::SPxPricer::selectEnter() "SPxPricer::selectEnter()"
1640  * -# \ref soplex::SPxRatioTester::selectLeave() "SPxRatioTester::selectLeave()"
1641  * -# \ref soplex::SPxPricer::entered4() "SPxPricer::entered4()"
1642  *
1643  * For the leaving Simplex:
1644  * -# \ref soplex::SPxPricer::selectLeave() "SPxPricer::selectLeave()"
1645  * -# \ref soplex::SPxRatioTester::selectEnter() "SPxRatioTester::selectEnter()"
1646  * -# \ref soplex::SPxPricer::left4() "SPxPricer::left4()"
1647  */
1648  //@{
1649 public:
1650  /// Setup vectors to be solved within Simplex loop.
1651  /** Load vector \p y to be #solve%d with the basis matrix during the
1652  * #LEAVE Simplex. The system will be solved after #SPxSolver%'s call
1653  * to SPxRatioTester. The system will be solved along with
1654  * another system. Solving two linear system at a time has
1655  * performance advantages over solving the two linear systems
1656  * seperately.
1657  */
1658  void setup4solve(SSVector* p_y, SSVector* p_rhs)
1659  {
1660  assert(type() == LEAVE);
1661  solveVector2 = p_y;
1662  solveVector2rhs = p_rhs;
1663  }
1664  /// Setup vectors to be solved within Simplex loop.
1665  /** Load a second additional vector \p y2 to be #solve%d with the
1666  * basis matrix during the #LEAVE Simplex. The system will be
1667  * solved after #SPxSolver%'s call to SPxRatioTester.
1668  * The system will be solved along with at least one
1669  * other system. Solving several linear system at a time has
1670  * performance advantages over solving them seperately.
1671  */
1672  void setup4solve2(SSVector* p_y2, SSVector* p_rhs2)
1673  {
1674  assert(type() == LEAVE);
1675  solveVector3 = p_y2;
1676  solveVector3rhs = p_rhs2;
1677  }
1678  /// Setup vectors to be cosolved within Simplex loop.
1679  /** Load vector \p y to be #coSolve%d with the basis matrix during
1680  * the #ENTER Simplex. The system will be solved after #SPxSolver%'s
1681  * call to SPxRatioTester. The system will be solved along
1682  * with another system. Solving two linear system at a time has
1683  * performance advantages over solving the two linear systems
1684  * seperately.
1685  */
1686  void setup4coSolve(SSVector* p_y, SSVector* p_rhs)
1687  {
1688  assert(type() == ENTER);
1689  coSolveVector2 = p_y;
1690  coSolveVector2rhs = p_rhs;
1691  }
1692  /// Setup vectors to be cosolved within Simplex loop.
1693  /** Load a second vector \p z to be #coSolve%d with the basis matrix during
1694  * the #ENTER Simplex. The system will be solved after #SPxSolver%'s
1695  * call to SPxRatioTester. The system will be solved along
1696  * with two other systems.
1697  */
1698  void setup4coSolve2(SSVector* p_z, SSVector* p_rhs)
1699  {
1700  assert(type() == ENTER);
1701  coSolveVector3 = p_z;
1702  coSolveVector3rhs = p_rhs;
1703  }
1704 
1705  /// maximal infeasibility of basis
1706  /** This method is called before concluding optimality. Since it is
1707  * possible that some stable implementation of class
1708  * SPxRatioTester yielded a slightly infeasible (or unpriced)
1709  * basis, this must be checked before terminating with an optimal
1710  * solution.
1711  */
1712  virtual Real maxInfeas() const;
1713 
1714  /// check for violations above tol and immediately return false w/o checking the remaining values
1715  /** This method is useful for verifying whether an objective limit can be used as termination criterion
1716  */
1717  virtual bool noViols(Real tol) const;
1718 
1719  /// Return current basis.
1720  /**@note The basis can be used to solve linear systems or use
1721  * any other of its (const) methods. It is, however, encuraged
1722  * to use methods #setup4solve() and #setup4coSolve() for solving
1723  * systems, since this is likely to have perfomance advantages.
1724  */
1725  const SPxBasis& basis() const
1726  {
1727  return *this;
1728  }
1729  ///
1730  SPxBasis& basis()
1731  {
1732  return *this;
1733  }
1734  /// return loaded SPxPricer.
1735  const SPxPricer* pricer() const
1736  {
1737  return thepricer;
1738  }
1739  /// return loaded SLinSolver.
1740  const SLinSolver* slinSolver() const
1741  {
1743  }
1744  /// return loaded SPxRatioTester.
1745  const SPxRatioTester* ratiotester() const
1746  {
1748  }
1749 
1750  /// Factorize basis matrix.
1751  /// @throw SPxStatusException if loaded matrix is singular
1752  virtual void factorize();
1753 
1754 private:
1755 
1756  /** let index \p i leave the basis and manage entering of another one.
1757  @returns \c false if LP is unbounded/infeasible. */
1758  bool leave(int i, bool polish = false);
1759  /** let id enter the basis and manage leaving of another one.
1760  @returns \c false if LP is unbounded/infeasible. */
1761  bool enter(SPxId& id, bool polish = false);
1762 
1763  /// test coVector \p i with status \p stat.
1764  Real coTest(int i, SPxBasis::Desc::Status stat) const;
1765  /// compute coTest vector.
1766  void computeCoTest();
1767  /// recompute coTest vector.
1768  void updateCoTest();
1769 
1770  /// test vector \p i with status \p stat.
1771  Real test(int i, SPxBasis::Desc::Status stat) const;
1772  /// recompute test vector.
1773  void updateTest();
1774 
1775  /// compute basis feasibility test vector.
1776  void computeFtest();
1777  /// update basis feasibility test vector.
1778  void updateFtest();
1779 
1780  //@}
1781 
1782  //------------------------------------
1783  /**@name Parallelization
1784  * In this section we present the methods, that are provided in order to
1785  * allow a parallel version to be implemented as a derived class, thereby
1786  * inheriting most of the code of SPxSolver.
1787  *
1788  * @par Initialization
1789  * These methods are used to setup all the vectors used in the Simplex
1790  * loop, that where described in the previous sectios.
1791  */
1792  //@{
1793 public:
1794  /// intialize data structures.
1795  /** If SPxSolver is not \ref isInitialized() "initialized", the method
1796  * #solve() calls #init() to setup all vectors and internal data structures.
1797  * Most of the other methods within this section are called by #init().
1798  *
1799  * Derived classes should add the initialization of additional
1800  * data structures by overriding this method. Don't forget,
1801  * however, to call SPxSolver::init().
1802  */
1803  virtual void init();
1804 
1805 protected:
1806 
1807  /// has the internal data been initialized?
1808  /** As long as an instance of SPxSolver is not initialized, no member
1809  * contains setup data. Initialization is performed via method
1810  * #init(). Afterwards all data structures are kept up to date (even
1811  * for all manipulation methods), until #unInit() is called. However,
1812  * some manipulation methods call #unInit() themselfs.
1813  */
1814  bool isInitialized() const
1815  {
1816  return initialized;
1817  }
1818 
1819  /// resets clock average statistics
1820  void resetClockStats();
1821 
1822  /// uninitialize data structures.
1823  virtual void unInit()
1824  {
1825  initialized = false;
1826  }
1827  /// setup all vecs fresh
1828  virtual void reinitializeVecs();
1829  /// reset dimensions of vectors according to loaded LP.
1830  virtual void reDim();
1831  /// compute feasibility vector from scratch.
1832  void computeFrhs();
1833  ///
1834  virtual void computeFrhsXtra();
1835  ///
1836  virtual void computeFrhs1(const Vector&, const Vector&);
1837  ///
1838  void computeFrhs2(Vector&, Vector&);
1839  /// compute \ref soplex::SPxSolver::theCoPrhs "theCoPrhs" for entering Simplex.
1840  virtual void computeEnterCoPrhs();
1841  ///
1842  void computeEnterCoPrhs4Row(int i, int n);
1843  ///
1844  void computeEnterCoPrhs4Col(int i, int n);
1845  /// compute \ref soplex::SPxSolver::theCoPrhs "theCoPrhs" for leaving Simplex.
1846  virtual void computeLeaveCoPrhs();
1847  ///
1848  void computeLeaveCoPrhs4Row(int i, int n);
1849  ///
1850  void computeLeaveCoPrhs4Col(int i, int n);
1851 
1852  /// Compute part of objective value.
1853  /** This method is called from #value() in order to compute the part of
1854  * the objective value resulting form nonbasic variables for #COLUMN
1855  * Representation.
1856  */
1857  Real nonbasicValue();
1858 
1859  /// Get pointer to the \p id 'th vector
1860  virtual const SVector* enterVector(const SPxId& p_id)
1861  {
1862  assert(p_id.isValid());
1863  return p_id.isSPxRowId()
1864  ? &vector(SPxRowId(p_id)) : &vector(SPxColId(p_id));
1865  }
1866  ///
1867  virtual void getLeaveVals(int i,
1868  SPxBasis::Desc::Status& leaveStat, SPxId& leaveId,
1869  Real& leaveMax, Real& leavebound, int& leaveNum, Real& objChange);
1870  ///
1871  virtual void getLeaveVals2(Real leaveMax, SPxId enterId,
1872  Real& enterBound, Real& newUBbound,
1873  Real& newLBbound, Real& newCoPrhs, Real& objChange);
1874  ///
1875  virtual void getEnterVals(SPxId id, Real& enterTest,
1876  Real& enterUB, Real& enterLB, Real& enterVal, Real& enterMax,
1877  Real& enterPric, SPxBasis::Desc::Status& enterStat, Real& enterRO, Real& objChange);
1878  ///
1879  virtual void getEnterVals2(int leaveIdx,
1880  Real enterMax, Real& leaveBound, Real& objChange);
1881  ///
1882  virtual void ungetEnterVal(SPxId enterId, SPxBasis::Desc::Status enterStat,
1883  Real leaveVal, const SVector& vec, Real& objChange);
1884  ///
1885  virtual void rejectEnter(SPxId enterId,
1886  Real enterTest, SPxBasis::Desc::Status enterStat);
1887  ///
1888  virtual void rejectLeave(int leaveNum, SPxId leaveId,
1889  SPxBasis::Desc::Status leaveStat, const SVector* newVec = 0);
1890  ///
1891  virtual void setupPupdate(void);
1892  ///
1893  virtual void doPupdate(void);
1894  ///
1895  virtual void clearUpdateVecs(void);
1896  ///
1897  virtual void perturbMinEnter(void);
1898  /// perturb basis bounds.
1899  virtual void perturbMaxEnter(void);
1900  ///
1901  virtual void perturbMinLeave(void);
1902  /// perturb nonbasic bounds.
1903  virtual void perturbMaxLeave(void);
1904  //@}
1905 
1906  //------------------------------------
1907  /** The following methods serve for initializing the bounds for dual or
1908  * primal Simplex algorithm of entering or leaving type.
1909  */
1910  //@{
1911  ///
1913  ///
1914  void setDualColBounds();
1915  ///
1916  void setDualRowBounds();
1917  /// setup feasibility bounds for entering algorithm
1918  void setPrimalBounds();
1919  ///
1920  void setEnterBound4Col(int, int);
1921  ///
1922  void setEnterBound4Row(int, int);
1923  ///
1924  virtual void setEnterBounds();
1925  ///
1926  void setLeaveBound4Row(int i, int n);
1927  ///
1928  void setLeaveBound4Col(int i, int n);
1929  ///
1930  virtual void setLeaveBounds();
1931  //@}
1932 
1933  //------------------------------------
1934  /** Compute the primal ray or the farkas proof in case of unboundedness
1935  * or infeasibility.
1936  */
1937  //@{
1938  ///
1939  void computePrimalray4Col(Real direction, SPxId enterId);
1940  ///
1941  void computePrimalray4Row(Real direction);
1942  ///
1943  void computeDualfarkas4Col(Real direction);
1944  ///
1945  void computeDualfarkas4Row(Real direction, SPxId enterId);
1946  //@}
1947 
1948 public:
1949 
1950  //------------------------------------
1951  /** Limits and status inquiry */
1952  //@{
1953  /// set time limit.
1954  virtual void setTerminationTime(Real time = infinity);
1955  /// return time limit.
1956  virtual Real terminationTime() const;
1957  /// set iteration limit.
1958  virtual void setTerminationIter(int iteration = -1);
1959  /// return iteration limit.
1960  virtual int terminationIter() const;
1961  /// set objective limit.
1962  virtual void setTerminationValue(Real value = infinity);
1963  /// return objective limit.
1964  virtual Real terminationValue() const;
1965  /// get objective value of current solution.
1966  virtual Real objValue()
1967  {
1968  return value();
1969  }
1970  /// get all results of last solve.
1971  Status
1972  getResult( Real* value = 0, Vector* primal = 0,
1973  Vector* slacks = 0, Vector* dual = 0,
1974  Vector* reduCost = 0);
1975 
1976 protected:
1977 
1978  /**@todo put the following basis methods near the variable status methods!*/
1979  /// converts basis status to VarStatus
1981 
1982  /// converts VarStatus to basis status for rows
1984  const;
1985 
1986  /// converts VarStatus to basis status for columns
1988  const;
1989 
1990 public:
1991 
1992  /// gets basis status for a single row
1993  VarStatus getBasisRowStatus( int row ) const;
1994 
1995  /// gets basis status for a single column
1996  VarStatus getBasisColStatus( int col ) const;
1997 
1998  /// get current basis, and return solver status.
1999  Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize = -1, const int colsSize = -1) const;
2000 
2001  /// gets basis status
2003  {
2005  }
2006 
2007  /// check a given basis for validity.
2009 
2010  /// set the lp solver's basis.
2011  void setBasis(const VarStatus rows[], const VarStatus cols[]);
2012 
2013  /// set the lp solver's basis status.
2014  void setBasisStatus( SPxBasis::SPxStatus stat )
2015  {
2016  if( m_status == OPTIMAL )
2017  m_status = UNKNOWN;
2018  SPxBasis::setStatus( stat );
2019  }
2020 
2021  /// setting the solver status external from the solve loop.
2022  void setSolverStatus( SPxSolver::Status stat )
2023  {
2024  m_status = stat;
2025  }
2026 
2027  /// get level of dual degeneracy
2028  // this function is used for the improved dual simplex
2029  Real getDegeneracyLevel(Vector degenvec);
2030 
2031  /// get number of dual norms
2032  void getNdualNorms(int& nnormsRow, int& nnormsCol) const;
2033 
2034  /// get dual norms
2035  bool getDualNorms(int& nnormsRow, int& nnormsCol, Real* norms) const;
2036 
2037  /// set dual norms
2038  bool setDualNorms(int nnormsRow, int nnormsCol, Real* norms);
2039 
2040  /// pass integrality information about the variables to the solver
2041  void setIntegralityInformation(int ncols, int* intInfo);
2042 
2043  /// reset cumulative time counter to zero.
2044  void resetCumulativeTime()
2045  {
2046  theCumulativeTime = 0.0;
2047  }
2048 
2049  /// get number of bound flips.
2050  int boundFlips() const
2051  {
2053  }
2054 
2055  /// get number of dual degenerate pivots
2056  int dualDegeneratePivots()
2057  {
2058  return (rep() == ROW) ? enterCycles : leaveCycles;
2059  }
2060 
2061  /// get number of primal degenerate pivots
2063  {
2064  return (rep() == ROW) ? leaveCycles : enterCycles;
2065  }
2066 
2067  /// get the sum of dual degeneracy
2069  {
2071  }
2072 
2073  /// get the sum of primal degeneracy
2075  {
2077  }
2078 
2079  /// get number of iterations of current solution.
2080  int iterations() const
2081  {
2082  return basis().iteration();
2083  }
2084 
2085  /// return number of iterations done with primal algorithm
2086  int primalIterations()
2087  {
2088  assert(iterations() == 0 || primalCount <= iterations());
2089  return (iterations() == 0) ? 0 : primalCount;
2090  }
2091 
2092  /// return number of iterations done with primal algorithm
2093  int dualIterations()
2094  {
2096  }
2097 
2098  /// return number of iterations done with primal algorithm
2099  int polishIterations()
2100  {
2101  return polishCount;
2102  }
2103 
2104  /// time spent in last call to method solve().
2105  Real time() const
2106  {
2107  return theTime->time();
2108  }
2109 
2110  /// returns whether current time limit is reached; call to time() may be skipped unless \p forceCheck is true
2111  ///
2112  bool isTimeLimitReached(const bool forceCheck = false);
2113 
2114  /// the maximum runtime
2115  Real getMaxTime()
2116  {
2117  return maxTime;
2118  }
2119 
2120  /// cumulative time spent in all calls to method solve().
2121  Real cumulativeTime() const
2122  {
2124  }
2125 
2126  /// the maximum number of iterations
2127  int getMaxIters()
2128  {
2129  return maxIters;
2130  }
2131 
2132  /// return const lp's rows if available.
2133  const LPRowSet& rows() const
2134  {
2135  return *lprowset();
2136  }
2137 
2138  /// return const lp's cols if available.
2139  const LPColSet& cols() const
2140  {
2141  return *lpcolset();
2142  }
2143 
2144  /// copy lower bound vector to \p p_low.
2145  void getLower(Vector& p_low) const
2146  {
2147  p_low = SPxLP::lower();
2148  }
2149  /// copy upper bound vector to \p p_up.
2150  void getUpper(Vector& p_up) const
2151  {
2152  p_up = SPxLP::upper();
2153  }
2154 
2155  /// copy lhs value vector to \p p_lhs.
2156  void getLhs(Vector& p_lhs) const
2157  {
2158  p_lhs = SPxLP::lhs();
2159  }
2160 
2161  /// copy rhs value vector to \p p_rhs.
2162  void getRhs(Vector& p_rhs) const
2163  {
2164  p_rhs = SPxLP::rhs();
2165  }
2166 
2167  /// optimization sense.
2168  SPxSense sense() const
2169  {
2170  return spxSense();
2171  }
2172 
2173  /// returns statistical information in form of a string.
2174  std::string statistics() const
2175  {
2176  std::stringstream s;
2177  s << basis().statistics()
2178  << "Solution time : " << std::setw(10) << std::fixed << std::setprecision(2) << time() << std::endl
2179  << "Iterations : " << std::setw(10) << iterations() << std::endl;
2180 
2181  return s.str();
2182  }
2183 
2184  /// returns whether a basis needs to be found for the improved dual simplex
2186  {
2187  if( getStartingDecompBasis )
2188  return FINDSTARTBASIS;
2189  else
2190  return DONTFINDSTARTBASIS;
2191  }
2192 
2193  /// sets whether the degeneracy is computed at each iteration
2194  void setComputeDegenFlag(bool computeDegen)
2195  {
2196  computeDegeneracy = computeDegen;
2197  }
2198 
2199 
2200  /// returns whether the degeneracy is computed in each iteration
2201  bool getComputeDegeneracy() const
2202  {
2204  }
2205 
2206 
2207  /// sets the offset for the number of iterations before the degeneracy is computed
2208  void setDegenCompOffset(int iterOffset)
2209  {
2210  degenCompIterOffset = iterOffset;
2211  }
2212 
2213 
2214  /// gets the offset for the number of iterations before the degeneracy is computed
2215  int getDegenCompOffset() const
2216  {
2218  }
2219 
2220  /// sets the iteration limit for the decomposition simplex initialisation
2221  void setDecompIterationLimit(int iterationLimit)
2222  {
2223  decompIterationLimit = iterationLimit;
2224  }
2225 
2226  /// returns the iteration limit for the decomposition simplex initialisation
2227  int getDecompIterationLimit() const
2228  {
2230  }
2231  //@}
2232 
2233  //------------------------------------
2234  /** Mapping between numbers and Ids */
2235  //@{
2236  /// RowId of \p i 'th inequality.
2237  SPxRowId rowId(int i) const
2238  {
2239  return rId(i);
2240  }
2241  /// ColId of \p i 'th column.
2242  SPxColId colId(int i) const
2243  {
2244  return cId(i);
2245  }
2246  //@}
2247 
2248  //------------------------------------
2249  /** Constructors / destructors */
2250  //@{
2251  /// default constructor.
2252  explicit
2253  SPxSolver( Type type = LEAVE,
2255  Timer::TYPE ttype = Timer::USER_TIME);
2256  // virtual destructor
2257  virtual ~SPxSolver();
2258  //@}
2259 
2260  //------------------------------------
2261  /** Miscellaneous */
2262  //@{
2263  /// check consistency.
2264  bool isConsistent() const;
2265  //@}
2266 
2267  //------------------------------------
2268  /** assignment operator and copy constructor */
2269  //@{
2270  /// assignment operator
2271  SPxSolver& operator=(const SPxSolver& base);
2272  /// copy constructor
2273  SPxSolver(const SPxSolver& base);
2274  //@}
2275 
2276  void testVecs();
2277 };
2278 
2279 //
2280 // Auxiliary functions.
2281 //
2282 
2283 /// Pretty-printing of variable status.
2284 std::ostream& operator<<( std::ostream& os,
2285  const SPxSolver::VarStatus& status );
2286 
2287 /// Pretty-printing of solver status.
2288 std::ostream& operator<<( std::ostream& os,
2289  const SPxSolver::Status& status );
2290 
2291 /// Pretty-printing of algorithm.
2292 std::ostream& operator<<( std::ostream& os,
2293  const SPxSolver::Type& status );
2294 
2295 /// Pretty-printing of representation.
2296 std::ostream& operator<<( std::ostream& os,
2298 
2299 
2300 } // namespace soplex
2301 #endif // _SPXSOLVER_H_
virtual void unShift(void)
remove shift as much as possible.
Definition: spxshift.cpp:496
const VectorBase< Real > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:219
void computeFtest()
compute basis feasibility test vector.
Definition: leave.cpp:38
virtual Real objValue()
get objective value of current solution.
Definition: spxsolver.h:1968
Real getMaxTime()
the maximum runtime
Definition: spxsolver.h:2117
Random numbers.
SPxId coId(int i) const
id of i &#39;th covector.
Definition: spxsolver.h:1089
virtual ~SPxSolver()
Definition: spxsolver.cpp:1047
virtual void addedRows(int n)
const Vector & ucBound() const
Definition: spxsolver.h:1389
Starting basis has been found and the simplex can be executed as normal.
Definition: spxsolver.h:186
int iteration() const
returns number of basis changes since last load().
Definition: spxbasis.h:545
bool enter(SPxId &id, bool polish=false)
Definition: enter.cpp:1091
virtual void changeRow(int i, const LPRow &newRow, bool scale=false)
void setEnterBound4Col(int, int)
Definition: spxbounds.cpp:190
virtual Real shift() const
total current shift amount.
Definition: spxsolver.h:1593
int iterations() const
get number of iterations of current solution.
Definition: spxsolver.h:2082
Bound flipping ratio test ("long step dual") for SoPlex.Class SPxBoundFlippingRT provides an implemen...
free variable fixed to zero.
Definition: spxsolver.h:194
SPxRowId rId(int n) const
Returns the row identifier for row n.
Definition: spxlpbase.h:542
Status & coStatus(int i)
Definition: spxbasis.h:284
Real fillFactor
allowed increase in relative fill before refactorization
Definition: spxbasis.h:379
int getDisplayFreq()
get display frequency
Definition: spxsolver.h:826
not initialised error
Definition: spxsolver.h:208
virtual void rejectLeave(int leaveNum, SPxId leaveId, SPxBasis::Desc::Status leaveStat, const SVector *newVec=0)
Definition: leave.cpp:581
int getMaxIters()
the maximum number of iterations
Definition: spxsolver.h:2129
virtual void changeObj(SPxColId p_id, const Real &p_newVal, bool scale=false)
Definition: spxsolver.h:928
const SVector & coVector(int i) const
i &#39;th covector of LP.
Definition: spxsolver.h:1173
int enterDegenCand
the number of degenerate candidates in the entering algorithm
Definition: spxsolver.h:375
int nClckSkipsLeft
remaining number of times the clock can be safely skipped
Definition: spxsolver.h:251
virtual void changeLower(const Vector &newLower, bool scale=false)
UpdateVector primVec
primal vector
Definition: spxsolver.h:323
SPxBasis::SPxStatus getBasisStatus() const
gets basis status
Definition: spxsolver.h:2004
virtual void changeBounds(SPxColId p_id, const Real &p_newLower, const Real &p_newUpper, bool scale=false)
Definition: spxsolver.h:983
int boundflips
number of performed bound flips
Definition: spxsolver.h:370
bool getDualNorms(int &nnormsRow, int &nnormsCol, Real *norms) const
get dual norms
Definition: spxsolver.cpp:1953
const VectorBase< Real > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:456
const Vector & fTest() const
Violations of fVec.
Definition: spxsolver.h:1357
virtual Status getPrimal(Vector &vector) const
get solution vector for primal variables.
Definition: spxsolve.cpp:1562
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
get number of dual norms
Definition: spxsolver.cpp:1881
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing ...
Definition: spxsolver.h:406
SPxOut * spxout
message handler
Definition: spxsolver.h:427
bool sparsePricingLeave
These values enable or disable sparse pricing.
Definition: spxsolver.h:417
THREADLOCAL const Real infinity
Definition: spxdefines.cpp:26
Type
Algorithmic type.
Definition: spxsolver.h:124
bool leave(int i, bool polish=false)
Definition: leave.cpp:644
const SPxRatioTester * ratiotester() const
return loaded SPxRatioTester.
Definition: spxsolver.h:1747
DVector * theUbound
Upper bound for vars.
Definition: spxsolver.h:353
Pricing pricing() const
return current Pricing.
Definition: spxsolver.h:481
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver&#39;s basis.
Definition: spxsolver.cpp:1863
void testBounds() const
Definition: spxbounds.cpp:311
UpdateVector addVec
storage for thePvec = &addVec
Definition: spxsolver.h:326
int dualIterations()
return number of iterations done with primal algorithm
Definition: spxsolver.h:2095
std::string statistics() const
returns statistical information in form of a string.
Definition: spxsolver.h:2176
virtual void rejectEnter(SPxId enterId, Real enterTest, SPxBasis::Desc::Status enterStat)
Definition: enter.cpp:1033
DVector theCoTest
Definition: spxsolver.h:359
virtual void qualRedCostViolation(Real &maxviol, Real &sumviol) const
get violation of optimality criterion.
Definition: spxquality.cpp:118
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
Definition: spxsolver.h:770
SolutionPolish getSolutionPolishing()
return objective of solution polishing
Definition: spxsolver.h:613
DVector * theCoUbound
Upper bound for covars.
Definition: spxsolver.h:355
SSVector * solveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:274
void setSolutionPolishing(SolutionPolish _polishObj)
set objective of solution polishing (0: off, 1: max_basic_slack, 2: min_basic_slack) ...
Definition: spxsolver.h:607
void computeTest()
compute test vector in ENTERing Simplex.
Definition: enter.cpp:102
Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get current basis, and return solver status.
Definition: spxsolver.cpp:1790
virtual void setStarter(SPxStarter *starter, const bool destroy=false)
setup starting basis generator to use. If destroy is true, starter will be freed in destructor...
Definition: spxsolver.cpp:154
int degenCompIterOffset
the number of iterations performed before the degeneracy level is computed
Definition: spxsolver.h:305
minimize number of basic slack variables, i.e. more variables in between bounds
Definition: spxsolver.h:231
void updateFtest()
update basis feasibility test vector.
Definition: leave.cpp:104
virtual void reDim()
reset dimensions of vectors according to loaded LP.
Definition: spxsolver.cpp:460
Real feastol() const
allowed primal feasibility tolerance.
Definition: spxsolver.h:777
UpdateVector dualVec
dual vector
Definition: spxsolver.h:325
void unscaleLPandReloadBasis()
unscales the LP and reloads the basis
Definition: spxsolver.cpp:524
Random numbers.Class Random provides random Real variables, i.e. a value variable that gives another ...
Definition: random.h:56
virtual void setBasisSolver(SLinSolver *slu, const bool destroy=false)
setup linear solver to use. If destroy is true, slusolver will be freed in destructor.
Definition: spxsolver.cpp:83
Real sumDualDegeneracy()
get the sum of dual degeneracy
Definition: spxsolver.h:2070
Type theType
entering or leaving algortihm.
Definition: spxsolver.h:242
void computePrimalray4Row(Real direction)
Definition: leave.cpp:622
Representation
LP basis representation.
Definition: spxsolver.h:105
bool sparsePricingEnterCo
true if sparsePricing is turned on in the entering Simplex
Definition: spxsolver.h:419
virtual void clearRowObjs()
Definition: spxsolver.h:951
virtual void clear()
clear all data in solver.
Definition: spxsolver.cpp:494
virtual void qualBoundViolation(Real &maxviol, Real &sumviol) const
get violations of bounds.
Definition: spxquality.cpp:60
void setType(Type tp)
set LEAVE or ENTER algorithm.
Definition: spxsolver.cpp:169
void setFillFactor(Real f)
set refactor threshold for fill-in in current factor update compared to fill-in in last factorization...
Definition: spxsolver.h:445
VarStatus basisStatusToVarStatus(SPxBasis::Desc::Status stat) const
converts basis status to VarStatus
Definition: spxsolver.cpp:1621
void localAddCols(int start)
void clearDualBounds(SPxBasis::Desc::Status, Real &, Real &) const
Definition: spxbounds.cpp:76
solve() aborted due to iteration limit.
Definition: spxsolver.h:213
int leaveDegenCand
the number of degenerate candidates in the leaving algorithm
Definition: spxsolver.h:376
#define SOPLEX_VERSION
Definition: spxdefines.h:42
DecompStatus
Improved dual simplex status.
Definition: spxsolver.h:181
virtual int terminationIter() const
return iteration limit.
Definition: spxsolver.cpp:1565
void computePrimalray4Col(Real direction, SPxId enterId)
Definition: enter.cpp:1053
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
Definition: spxshift.cpp:483
virtual void changeUpper(const Vector &newUpper, bool scale=false)
int m_maxCycle
maximum steps before cycling is detected.
Definition: spxsolver.h:268
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:413
No Problem has been loaded.
Definition: spxsolver.h:216
Safe arrays of arbitrary types.Class Array provides safe arrays of arbitrary type. Array elements are accessed just like ordinary C++ array elements by means of the index operator[](). Safety is provided by.
Definition: array.h:62
void setSolverStatus(SPxSolver::Status stat)
setting the solver status external from the solve loop.
Definition: spxsolver.h:2024
Pricing thePricing
full or partial pricing.
Definition: spxsolver.h:243
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
Definition: spxlpbase.h:522
virtual void addedCols(int n)
virtual bool noViols(Real tol) const
check for violations above tol and immediately return false w/o checking the remaining values ...
Definition: spxsolver.cpp:697
Abstract ratio test base class.Class SPxRatioTester is the virtual base class for computing the ratio...
bool isId(const SPxId &p_id) const
Is p_id an SPxId ?
Definition: spxsolver.h:1107
DVector primRhs
rhs vector for computing the primal vector
Definition: spxsolver.h:322
const LPRowSetBase< Real > * lprowset() const
Returns the LP as an LPRowSetBase.
Definition: spxlpbase.h:1905
const Vector & lcBound() const
Definition: spxsolver.h:1410
virtual void computeFrhsXtra()
Definition: spxvecs.cpp:148
virtual void perturbMinEnter(void)
Definition: spxshift.cpp:305
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:1047
void shiftLBbound(int i, Real to)
shift i &#39;th lbBound to to.
Definition: spxsolver.h:1555
SoPlex start basis generation base class.SPxStarter is the virtual base class for classes generating ...
Definition: spxstarter.h:41
void setup4solve(SSVector *p_y, SSVector *p_rhs)
Setup vectors to be solved within Simplex loop.
Definition: spxsolver.h:1660
virtual void changeElement(SPxRowId rid, SPxColId cid, const Real &val, bool scale=false)
Definition: spxsolver.h:1035
variable fixed to identical bounds.
Definition: spxsolver.h:193
Real sparsePricingFactor
enable sparse pricing when viols < factor * dim()
Definition: spxsolver.h:301
Real getFastCondition(int type=0)
Definition: spxbasis.cpp:1112
LP has been proven to be primal infeasible.
Definition: spxsolver.h:222
void setComputeDegenFlag(bool computeDegen)
sets whether the degeneracy is computed at each iteration
Definition: spxsolver.h:2196
void setPrimalBounds()
setup feasibility bounds for entering algorithm
Definition: spxbounds.cpp:32
void setLeaveBound4Col(int i, int n)
Definition: spxbounds.cpp:266
SSVector * solveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:273
bool isTimeLimitReached(const bool forceCheck=false)
returns whether current time limit is reached; call to time() may be skipped unless forceCheck is tru...
Definition: spxsolver.cpp:1571
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
Definition: spxid.h:36
void setSparsePricingFactor(Real fac)
Definition: spxsolver.h:838
virtual void changeCol(int i, const LPCol &newCol, bool scale=false)
virtual void perturbMaxEnter(void)
perturb basis bounds.
Definition: spxshift.cpp:314
void setOpttol(Real d)
set parameter opttol.
Definition: spxsolver.cpp:940
Real time() const
time spent in last call to method solve().
Definition: spxsolver.h:2107
int getDecompIterationLimit() const
returns the iteration limit for the decomposition simplex initialisation
Definition: spxsolver.h:2229
virtual void doPupdate(void)
Definition: spxvecs.cpp:526
void setDegenCompOffset(int iterOffset)
sets the offset for the number of iterations before the degeneracy is computed
Definition: spxsolver.h:2210
void setPrimal(Vector &p_vector)
Definition: spxsolve.cpp:1772
bool freeRatioTester
true iff theratiotester should be freed inside of object
Definition: spxsolver.h:282
void resetCumulativeTime()
reset cumulative time counter to zero.
Definition: spxsolver.h:2046
void setRep()
sets descriptor representation according to loaded LP.
Definition: spxbasis.cpp:307
Sparse Linear Solver virtual base class.Class SLinSolver provides a class for solving sparse linear s...
Definition: slinsolver.h:43
Real m_nonbasicValue
nonbasic part of current objective value
Definition: spxsolver.h:256
const SPxPricer * pricer() const
return loaded SPxPricer.
Definition: spxsolver.h:1737
virtual bool readBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
Definition: spxfileio.cpp:24
virtual Real value()
current objective value.
Definition: spxsolver.cpp:887
rowwise representation.
Definition: spxsolver.h:107
bool setDualNorms(int nnormsRow, int nnormsCol, Real *norms)
set dual norms
Definition: spxsolver.cpp:1959
virtual void computeLeaveCoPrhs()
compute theCoPrhs for leaving Simplex.
Definition: spxvecs.cpp:478
Real lastShift
for forcing feasibility.
Definition: spxsolver.h:267
TimerFactory class.
SPxSolver(Type type=LEAVE, Representation rep=ROW, Timer::TYPE ttype=Timer::USER_TIME)
default constructor.
Definition: spxsolver.cpp:973
virtual void setTerminationTime(Real time=infinity)
set time limit.
Definition: spxsolver.cpp:1546
const LPRowSet & rows() const
return const lp&#39;s rows if available.
Definition: spxsolver.h:2135
bool isBasic(const SPxRowId &rid) const
is the rid &#39;th vector basic ?
Definition: spxsolver.h:1250
Real memFactor
allowed total increase in memory consumption before refactorization
Definition: spxbasis.h:382
bool freePricer
true iff thepricer should be freed inside of object
Definition: spxsolver.h:281
SPxColId cId(int n) const
Returns the column identifier for column n.
Definition: spxlpbase.h:548
maximize number of basic slack variables, i.e. more variables on bounds
Definition: spxsolver.h:230
Representation theRep
row or column representation.
Definition: spxsolver.h:244
int maxCycle() const
maximum number of degenerate simplex steps before we detect cycling.
Definition: spxsolver.h:856
Real getDegeneracyLevel(Vector degenvec)
get level of dual degeneracy
Definition: spxsolver.cpp:1891
virtual void changeCol(SPxColId p_id, const LPCol &p_newCol, bool scale=false)
Definition: spxsolver.h:1028
No ratiotester loaded.
Definition: spxsolver.h:205
No pricer loaded.
Definition: spxsolver.h:206
const Vector & ubBound() const
upper bound for fVec.
Definition: spxsolver.h:1313
virtual void changeRhs(const Vector &newRhs, bool scale=false)
Entering Simplex.
Definition: spxsolver.h:134
int dualDegeneratePivots()
get number of dual degenerate pivots
Definition: spxsolver.h:2058
const Vector & fRhs() const
right-hand side vector for fVec
Definition: spxsolver.h:1308
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
UpdateVector & coPvec() const
copricing vector.
Definition: spxsolver.h:1370
int remainingRoundsLeave
number of dense rounds/refactorizations until sparsePricing is enabled again
Definition: spxsolver.h:423
virtual Status getDualfarkas(Vector &vector) const
get dual farkas proof of infeasibility.
Definition: spxsolve.cpp:1703
virtual void changeBounds(const Vector &newLower, const Vector &newUpper, bool scale=false)
Fast shifting ratio test.Class SPxFastRT is an implementation class of SPxRatioTester providing fast ...
Definition: spxfastrt.h:41
LP is primal infeasible or unbounded.
Definition: spxsolver.h:223
int m_numCycle
actual number of degenerate steps so far.
Definition: spxsolver.h:269
int maxIters
maximum allowed iterations.
Definition: spxsolver.h:249
Leaving Simplex.
Definition: spxsolver.h:143
Real m_entertol
feasibility tolerance maintained during entering algorithm
Definition: spxsolver.h:264
virtual void changeLhsStatus(int i, Real newLhs, Real oldLhs=0.0)
void setNonzeroFactor(Real f)
set refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix ...
Definition: spxsolver.h:439
SPxSense
Optimization sense.
Definition: spxlpbase.h:97
virtual void changeRange(SPxRowId p_id, const Real &p_newLhs, const Real &p_newRhs, bool scale=false)
Definition: spxsolver.h:1014
virtual void doRemoveRow(int i)
nothing known about basis status (possibly due to a singular basis in transformed problem) ...
Definition: spxsolver.h:196
virtual void changeRowObj(const Vector &newObj, bool scale=false)
SPxStatus status() const
returns current SPxStatus.
Definition: spxbasis.h:425
SPxStarter * thestarter
Definition: spxsolver.h:382
SSVector * solveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:275
Timer::TYPE getTiming()
set timing type
Definition: spxsolver.h:813
UpdateVector * theRPvec
row pricing vector
Definition: spxsolver.h:348
bool m_pricingViolCoUpToDate
true, if the stored violation in coDim is up to date
Definition: spxsolver.h:262
double Real
Definition: spxdefines.h:215
SSVector * coSolveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:278
bool isColBasic(int i) const
is the i &#39;th column vector basic ?
Definition: spxsolver.h:1268
void setSlacks(Vector &p_vector)
Definition: spxsolve.cpp:1857
Pricing
Pricing type.
Definition: spxsolver.h:152
void setStatus(SPxStatus stat)
sets basis SPxStatus to stat.
Definition: spxbasis.h:431
DVector * theFrhs
Definition: spxsolver.h:341
void localAddRows(int start)
virtual void doRemoveCols(int perm[])
Status status() const
Status of solution process.
Definition: spxsolve.cpp:1879
Real sumPrimalDegeneracy()
get the sum of primal degeneracy
Definition: spxsolver.h:2076
void shiftLPbound(int i, Real to)
shift i &#39;th lpBound to to.
Definition: spxsolver.h:1569
DVector * theLbound
Lower bound for vars.
Definition: spxsolver.h:354
SPxSense spxSense() const
Returns the optimization sense.
Definition: spxlpbase.h:510
virtual const SVector * enterVector(const SPxId &p_id)
Get pointer to the id &#39;th vector.
Definition: spxsolver.h:1862
Real m_pricingViol
maximal feasibility violation of current solution
Definition: spxsolver.h:259
virtual void unInit()
uninitialize data structures.
Definition: spxsolver.h:1825
virtual void changeRhs(SPxRowId p_id, const Real &p_newRhs, bool scale=false)
Definition: spxsolver.h:1005
virtual void changeLower(SPxColId p_id, const Real &p_newLower, bool scale=false)
Definition: spxsolver.h:963
Dense vector with semi-sparse vector for updates.
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
Definition: basevectors.h:1151
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
Definition: spxsolver.h:763
UpdateVector * thePvec
Definition: spxsolver.h:346
SPxColId colId(int i) const
ColId of i &#39;th column.
Definition: spxsolver.h:2244
void performSolutionPolishing()
Definition: spxsolve.cpp:1014
SPxBasis::Desc::Status varStatusToBasisStatusRow(int row, VarStatus stat) const
converts VarStatus to basis status for rows
Definition: spxsolver.cpp:1655
LP has been solved to optimality.
Definition: spxsolver.h:220
bool computeDegeneracy
Definition: spxsolver.h:304
virtual void setPricer(SPxPricer *pricer, const bool destroy=false)
setup pricer to use. If destroy is true, pricer will be freed in destructor.
Definition: spxsolver.cpp:103
void getUpper(Vector &p_up) const
copy upper bound vector to p_up.
Definition: spxsolver.h:2152
Real cumulativeTime() const
cumulative time spent in all calls to method solve().
Definition: spxsolver.h:2123
const Vector & lbBound() const
lower bound for fVec.
Definition: spxsolver.h:1331
virtual void changeSense(SPxSense sns)
virtual bool precisionReached(Real &newpricertol) const
is the solution precise enough, or should we increase delta() ?
Definition: spxsolve.cpp:37
virtual void setLeaveBounds()
Definition: spxbounds.cpp:297
SPxPricer * thepricer
Definition: spxsolver.h:380
const SVSet * thecovectors
the LP coVectors according to representation
Definition: spxsolver.h:320
void getLower(Vector &p_low) const
copy lower bound vector to p_low.
Definition: spxsolver.h:2147
virtual void changeElement(int i, int j, const Real &val, bool scale=false)
void computeEnterCoPrhs4Col(int i, int n)
Definition: spxvecs.cpp:367
virtual Real terminationTime() const
return time limit.
Definition: spxsolver.cpp:1553
Wrapper for several output streams. A verbosity level is used to decide which stream to use and wheth...
Definition: spxout.h:63
SPxId id(int i) const
id of i &#39;th vector.
Definition: spxsolver.h:1070
UpdateVector & fVec() const
feasibility vector.
Definition: spxsolver.h:1295
virtual void reinitializeVecs()
setup all vecs fresh
Definition: spxsolver.cpp:264
SPxId instableEnterId
Definition: spxsolver.h:295
solve() aborted due to commence decomposition simplex
Definition: spxsolver.h:210
void setDisplayFreq(int freq)
set display frequency
Definition: spxsolver.h:820
SPxLPBase< Real > SPxLP
Definition: spxlp.h:35
solve() aborted due to time limit.
Definition: spxsolver.h:212
DVector theLBbound
Lower Basic Feasibility bound.
Definition: spxsolver.h:339
SPxStarter * starter() const
return current starter.
Definition: spxsolver.h:487
an error occured.
Definition: spxsolver.h:204
virtual void setupPupdate(void)
Definition: spxvecs.cpp:506
virtual bool writeState(const char *filename, const NameSet *rowNames=NULL, const NameSet *colNames=NULL, const bool cpxFormat=false) const
virtual void changeLhs(const Vector &newLhs, bool scale=false)
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
Definition: spxsolver.h:1235
Real delta() const
guaranteed primal and dual bound violation for optimal solution, returning the maximum of feastol() a...
Definition: spxsolver.h:793
int info
user information to store values -1, 0, +1
Definition: datakey.h:55
virtual void qualSlackViolation(Real &maxviol, Real &sumviol) const
get the residuum |Ax-b|.
Definition: spxquality.cpp:89
void setDual(Vector &p_vector)
Definition: spxsolve.cpp:1792
solve() aborted to exit decomposition simplex
Definition: spxsolver.h:209
const VectorBase< Real > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:253
static Timer * switchTimer(Timer *timer, Timer::TYPE ttype)
Definition: timerfactory.h:66
bool getComputeDegeneracy() const
returns whether the degeneracy is computed in each iteration
Definition: spxsolver.h:2203
SPxSolver & operator=(const SPxSolver &base)
assignment operator
Definition: spxsolver.cpp:1078
int primalCount
number of primal iterations
Definition: spxsolver.h:367
Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer ...
Definition: spxpricer.h:46
SolutionPolish
objective for solution polishing
Definition: spxsolver.h:227
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:79
Dense vector with semi-sparse vector for updatesIn many algorithms vectors are updated in every itera...
Definition: updatevector.h:53
SSVector * coSolveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:279
virtual void changeLhs(SPxRowId p_id, const Real &p_newLhs, bool scale=false)
Definition: spxsolver.h:994
variable set to its upper bound.
Definition: spxsolver.h:191
int primalDegeneratePivots()
get number of primal degenerate pivots
Definition: spxsolver.h:2064
void shiftUCbound(int i, Real to)
shift i &#39;th ucBound to to.
Definition: spxsolver.h:1576
void updateTest()
recompute test vector.
Definition: enter.cpp:301
bool updateNonbasicValue(Real objChange)
Definition: spxsolver.cpp:910
Basis descriptor.
Definition: spxbasis.h:104
Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed ...
Definition: didxset.h:42
DVector theURbound
Upper Row Feasibility bound.
Definition: spxsolver.h:328
virtual void ungetEnterVal(SPxId enterId, SPxBasis::Desc::Status enterStat, Real leaveVal, const SVector &vec, Real &objChange)
Definition: enter.cpp:978
DVectorBase< R > up
vector of upper bounds.
Definition: lpcolsetbase.h:54
bool freeStarter
true iff thestarter should be freed inside of object
Definition: spxsolver.h:283
int getDegenCompOffset() const
gets the offset for the number of iterations before the degeneracy is computed
Definition: spxsolver.h:2217
bool sparsePricingEnter
true if sparsePricing is turned on in the entering Simplex for slack variables
Definition: spxsolver.h:418
virtual void getLeaveVals2(Real leaveMax, SPxId enterId, Real &enterBound, Real &newUBbound, Real &newLBbound, Real &newCoPrhs, Real &objChange)
Definition: leave.cpp:364
int polishIterations()
return number of iterations done with primal algorithm
Definition: spxsolver.h:2101
virtual Real time() const =0
int remainingRoundsEnterCo
Definition: spxsolver.h:425
int boundFlips() const
get number of bound flips.
Definition: spxsolver.h:2052
void useFullPerturbation(bool full)
perturb entire problem or only the bounds relevant to the current pivot
Definition: spxsolver.h:867
int leaveCycles
the number of degenerate steps during the leaving algorithm
Definition: spxsolver.h:374
virtual Real getFastCondition()
Definition: spxsolver.h:872
algorithm is running
Definition: spxsolver.h:218
void setup4coSolve(SSVector *p_y, SSVector *p_rhs)
Setup vectors to be cosolved within Simplex loop.
Definition: spxsolver.h:1688
virtual void changeLowerStatus(int i, Real newLower, Real oldLower=0.0)
Timer * theTime
time spent in last call to method solve()
Definition: spxsolver.h:246
const Vector & test() const
Violations of pVec.
Definition: spxsolver.h:1503
void shiftUBbound(int i, Real to)
shift i &#39;th ubBound to to.
Definition: spxsolver.h:1548
Real m_leavetol
feasibility tolerance maintained during leaving algorithm
Definition: spxsolver.h:265
(In)equality for LPs.Class LPRowBase provides constraints for linear programs in the form where a is...
Definition: lprowbase.h:45
virtual void loadLP(const SPxLP &LP, bool initSlackBasis=true)
copy LP.
Definition: spxsolver.cpp:68
variable set to its lower bound.
Definition: spxsolver.h:192
DVector theUBbound
Upper Basic Feasibility bound.
Definition: spxsolver.h:338
Preconfigured SoPlexLegacy LP-solver.
Definition: soplexlegacy.h:41
Real m_pricingViolCo
maximal feasibility violation of current solution in coDim
Definition: spxsolver.h:261
virtual void changeRhsStatus(int i, Real newRhs, Real oldRhs=0.0)
DVector * theCoLbound
Lower bound for covars.
Definition: spxsolver.h:356
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:758
void computeDualfarkas4Col(Real direction)
Definition: leave.cpp:633
virtual void changeMaxObj(const Vector &newObj, bool scale=false)
Debugging, floating point type and parameter definitions.
virtual void loadBasis(const SPxBasis::Desc &)
set a start basis.
Definition: spxsolver.cpp:92
Simplex basis.Consider the linear program as provided from class SPxLP: where , and ...
Definition: spxbasis.h:82
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
Definition: nameset.h:61
Simplex basis.
bool isCoId(const SPxId &p_id) const
Is p_id a CoId.
Definition: spxsolver.h:1116
Status getResult(Real *value=0, Vector *primal=0, Vector *slacks=0, Vector *dual=0, Vector *reduCost=0)
get all results of last solve.
Definition: spxsolve.cpp:1927
int totalboundflips
total number of bound flips
Definition: spxsolver.h:371
int polishCount
number of solution polishing iterations
Definition: spxsolver.h:368
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
virtual bool writeBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames, const bool cpxFormat=false) const
Definition: spxfileio.cpp:39
SolutionPolish polishObj
objective of solution polishing
Definition: spxsolver.h:245
UpdateVector & pVec() const
pricing vector.
Definition: spxsolver.h:1450
virtual void getLeaveVals(int i, SPxBasis::Desc::Status &leaveStat, SPxId &leaveId, Real &leaveMax, Real &leavebound, int &leaveNum, Real &objChange)
Definition: leave.cpp:184
virtual void changeRowObj(SPxRowId p_id, const Real &p_newVal, bool scale=false)
Definition: spxsolver.h:946
bool fullPerturbation
whether to perturb the entire problem or just the bounds relevant for the current pivot ...
Definition: spxsolver.h:308
Full pricing.
Definition: spxsolver.h:160
const Vector & lpBound() const
Definition: spxsolver.h:1476
SSVector * solveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:272
DIdxSet infeasibilities
Definition: spxsolver.h:400
DVector theLRbound
Lower Row Feasibility bound.
Definition: spxsolver.h:329
void perturbMin(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
Definition: spxshift.cpp:150
DVector theUCbound
Upper Column Feasibility bound.
Definition: spxsolver.h:330
void setDualColBounds()
Definition: spxbounds.cpp:103
virtual void setTerminationIter(int iteration=-1)
set iteration limit.
Definition: spxsolver.cpp:1558
bool isInitialized() const
has the internal data been initialized?
Definition: spxsolver.h:1816
DecompStatus getDecompStatus() const
returns whether a basis needs to be found for the improved dual simplex
Definition: spxsolver.h:2187
void computeLeaveCoPrhs4Col(int i, int n)
Definition: spxvecs.cpp:448
virtual bool read(std::istream &in, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
read LP from input stream.
Definition: spxsolver.cpp:31
int decompIterationLimit
the maximum number of iterations before the decomposition simplex is aborted.
Definition: spxsolver.h:306
void computeEnterCoPrhs4Row(int i, int n)
Definition: spxvecs.cpp:336
Status m_status
status of algorithm.
Definition: spxsolver.h:254
Starting basis has not been found yet.
Definition: spxsolver.h:184
SPxBasis::Desc::Status covarStatus(int i) const
Status of i &#39;th covariable.
Definition: spxsolver.h:1229
int remainingRoundsEnter
Definition: spxsolver.h:424
Everything should be within this namespace.
void shiftUPbound(int i, Real to)
shift i &#39;th upBound to to.
Definition: spxsolver.h:1562
Timer class.
virtual void changeRange(const Vector &newLhs, const Vector &newRhs, bool scale=false)
bool isBasisValid(DataArray< VarStatus > rows, DataArray< VarStatus > cols)
check a given basis for validity.
Definition: spxsolver.cpp:1809
virtual bool terminate()
Termination criterion.
Definition: spxsolve.cpp:1370
void computeLeaveCoPrhs4Row(int i, int n)
Definition: spxvecs.cpp:419
TYPE
types of timers
Definition: timer.h:99
SLinSolver * factor
Definition: spxbasis.h:355
void shiftLCbound(int i, Real to)
shift i &#39;th lcBound to to.
Definition: spxsolver.h:1583
R getEpsilon() const
Returns the non-zero epsilon used.
Definition: ssvectorbase.h:104
Real theCumulativeTime
cumulative time spent in all calls to method solve()
Definition: spxsolver.h:248
UpdateVector * theFvec
Definition: spxsolver.h:342
virtual void setTester(SPxRatioTester *tester, const bool destroy=false)
setup ratio-tester to use. If destroy is true, tester will be freed in destructor.
Definition: spxsolver.cpp:130
Real dualDegenSum
the sum of the dual degeneracy percentage
Definition: spxsolver.h:378
SSVector * coSolveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:277
virtual void printDisplayLine(const bool force=false, const bool forceHead=false)
print display line of flying table
Definition: spxsolve.cpp:1333
solve() aborted due to detection of cycling.
Definition: spxsolver.h:211
virtual void changeMaxObj(SPxColId p_id, const Real &p_newVal, bool scale=false)
Definition: spxsolver.h:937
void updateCoTest()
recompute coTest vector.
Definition: enter.cpp:352
DVectorBase< R > low
vector of lower bounds.
Definition: lpcolsetbase.h:53
bool isBasic(const SPxColId &cid) const
is the cid &#39;th vector basic ?
Definition: spxsolver.h:1256
SPxSense sense() const
optimization sense.
Definition: spxsolver.h:2170
Set of LP columns.Class LPColSetBase implements a set of LPColBase%s. Unless for memory limitations...
Definition: lpcolsetbase.h:43
virtual void clearRowObjs()
Clears row objective function values for all rows.
Definition: spxlpbase.h:1540
bool isBasic(int i) const
is the i &#39;th vector basic ?
Definition: spxsolver.h:1274
bool m_nonbasicValueUpToDate
true, if the stored objValue is up to date
Definition: spxsolver.h:257
void setIntegralityInformation(int ncols, int *intInfo)
pass integrality information about the variables to the solver
Definition: spxsolver.cpp:1965
Save arrays of arbitrary types.
void setEnterBound4Row(int, int)
Definition: spxbounds.cpp:165
void setConditionInformation(int condInfo)
print condition number within the usual output
Definition: spxsolver.h:832
DVector theLCbound
Lower Column Feasibility bound.
Definition: spxsolver.h:331
virtual void clearUpdateVecs(void)
Definition: spxsolver.cpp:532
int leaveCount
number of LEAVE iterations
Definition: spxsolver.h:365
int numCycle() const
actual number of degenerate simplex steps encountered so far.
Definition: spxsolver.h:861
Sparse vector .
Saving LPs in a form suitable for SoPlex.
const LPColSetBase< Real > * lpcolset() const
Returns the LP as an LPColSetBase.
Definition: spxlpbase.h:1911
nothing known on loaded problem.
Definition: spxsolver.h:219
don&#39;t perform modifications on optimal basis
Definition: spxsolver.h:229
VarStatus getBasisRowStatus(int row) const
gets basis status for a single row
Definition: spxsolver.cpp:1778
bool isConsistent() const
check consistency.
Definition: spxsolver.cpp:1439
variable is basic.
Definition: spxsolver.h:195
const Vector & upBound() const
Definition: spxsolver.h:1455
VarStatus getBasisColStatus(int col) const
gets basis status for a single column
Definition: spxsolver.cpp:1784
const Vector & coTest() const
violations of coPvec.
Definition: spxsolver.h:1437
int subversion() const
return the internal subversion of SPxSolver as number
Definition: spxsolver.h:464
void computeFrhs()
compute feasibility vector from scratch.
Definition: spxvecs.cpp:42
virtual void perturbMinLeave(void)
Definition: spxshift.cpp:470
void setDualRowBounds()
Definition: spxbounds.cpp:133
virtual void changeUpperStatus(int i, Real newUpper, Real oldLower=0.0)
bool isSPxRowId() const
is id a row id?
Definition: spxid.h:160
SPxBasis::Desc::Status varStatusToBasisStatusCol(int col, VarStatus stat) const
converts VarStatus to basis status for columns
Definition: spxsolver.cpp:1714
SPxRatioTester * theratiotester
Definition: spxsolver.h:381
Partial pricing.
Definition: spxsolver.h:174
virtual Real terminationValue() const
return objective limit.
Definition: spxsolver.cpp:1615
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:25
DVector * theCoPrhs
Definition: spxsolver.h:344
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
Definition: spxid.h:150
int enterCycles
the number of degenerate steps during the entering algorithm
Definition: spxsolver.h:373
DSVector primalRay
stores primal ray in case of unboundedness
Definition: spxsolver.h:362
void getLhs(Vector &p_lhs) const
copy lhs value vector to p_lhs.
Definition: spxsolver.h:2158
virtual void changeRow(SPxRowId p_id, const LPRow &p_newRow, bool scale=false)
Definition: spxsolver.h:1021
Type type() const
return current Type.
Definition: spxsolver.h:475
DataArray< int > isInfeasibleCo
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:414
Real theShift
sum of all shifts applied to any bound.
Definition: spxsolver.h:266
int coDim() const
codimension.
Definition: spxsolver.h:1052
virtual void getEnterVals(SPxId id, Real &enterTest, Real &enterUB, Real &enterLB, Real &enterVal, Real &enterMax, Real &enterPric, SPxBasis::Desc::Status &enterStat, Real &enterRO, Real &objChange)
Definition: enter.cpp:412
virtual Status getRedCost(Vector &vector) const
get vector of reduced costs.
Definition: spxsolve.cpp:1642
virtual void doRemoveCol(int i)
bool hyperPricingEnter
true if hyper sparse pricing is turned on in the entering Simplex
Definition: spxsolver.h:421
SPxStatus
basis status.
Definition: spxbasis.h:90
DSVector dualFarkas
stores dual farkas proof in case of infeasibility
Definition: spxsolver.h:363
Random random
The random number generator used throughout the whole computation. Its seed can be modified...
Definition: spxsolver.h:395
int enterCount
number of ENTER iterations
Definition: spxsolver.h:366
const SLinSolver * slinSolver() const
return loaded SLinSolver.
Definition: spxsolver.h:1742
const Vector & coPrhs() const
Right-hand side vector for coPvec.
Definition: spxsolver.h:1383
int printCondition
printing the current condition number in the log (0 - off, 1 - estimate,exact, 2 - exact)";ratio esti...
Definition: spxsolver.h:309
Array< UnitVector > unitVecs
array of unit vectors
Definition: spxsolver.h:318
bool isCoBasic(int i) const
is the i &#39;th covector basic ?
Definition: spxsolver.h:1280
const SVSet * thevectors
the LP vectors according to representation
Definition: spxsolver.h:319
DataArray< int > integerVariables
supplementary variable information, 0: continous variable, 1: integer variable
Definition: spxsolver.h:429
#define SOPLEX_SUBVERSION
Definition: spxdefines.h:43
virtual void setEnterBounds()
Definition: spxbounds.cpp:215
void perturbMax(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
Definition: spxshift.cpp:228
Real maxTime
maximum allowed time.
Definition: spxsolver.h:250
void setFeastol(Real d)
set parameter feastol.
Definition: spxsolver.cpp:928
virtual void init()
intialize data structures.
Definition: spxsolver.cpp:317
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
Definition: spxid.h:55
virtual void doRemoveRows(int perm[])
bool initialized
true, if all vectors are setup.
Definition: spxsolver.h:270
virtual void computeEnterCoPrhs()
compute theCoPrhs for entering Simplex.
Definition: spxvecs.cpp:405
void forceRecompNonbasicValue()
Definition: spxsolver.h:633
virtual void qualConstraintViolation(Real &maxviol, Real &sumviol) const
get violation of constraints.
Definition: spxquality.cpp:25
const SVector & vector(int i) const
i &#39;th vector.
Definition: spxsolver.h:1129
void initRep(Representation p_rep)
initialize ROW or COLUMN representation.
Definition: spxsolver.cpp:198
SSVector & delta()
update vector , writeable
Definition: updatevector.h:122
DIdxSet updateViolsCo
Definition: spxsolver.h:407
Real opttol() const
allowed optimality, i.e., dual feasibility tolerance.
Definition: spxsolver.h:785
bool isRowBasic(int i) const
is the i &#39;th row vector basic ?
Definition: spxsolver.h:1262
bool m_pricingViolUpToDate
true, if the stored violation is up to date
Definition: spxsolver.h:260
std::string statistics() const
returns statistical information in form of a string.
Definition: spxbasis.h:910
void hyperPricing(bool h)
enable or disable hyper sparse pricing
Definition: spxsolver.cpp:962
void getRhs(Vector &p_rhs) const
copy rhs value vector to p_rhs.
Definition: spxsolver.h:2164
Status & status(int i)
Definition: spxbasis.h:269
Real objLimit
< the number of calls to the method isTimeLimitReached()
Definition: spxsolver.h:253
const LPColSet & cols() const
return const lp&#39;s cols if available.
Definition: spxsolver.h:2141
void setOutstream(SPxOut &newOutstream)
Definition: spxsolver.h:432
void setDecompIterationLimit(int iterationLimit)
sets the iteration limit for the decomposition simplex initialisation
Definition: spxsolver.h:2223
void computePvec()
compute entire pVec().
Definition: spxvecs.cpp:498
virtual void setTerminationValue(Real value=infinity)
set objective limit.
Definition: spxsolver.cpp:1610
bool getStartingDecompBasis
flag to indicate whether the simplex is solved to get the starting improved dual simplex basis ...
Definition: spxsolver.h:303
UpdateVector * theCoPvec
Definition: spxsolver.h:345
void setMemFactor(Real f)
set refactor threshold for memory growth in current factor update compared to the last factorization ...
Definition: spxsolver.h:451
void computeDualfarkas4Row(Real direction, SPxId enterId)
Definition: enter.cpp:1072
void computeFrhs2(Vector &, Vector &)
Definition: spxvecs.cpp:254
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1727
void setup4solve2(SSVector *p_y2, SSVector *p_rhs2)
Setup vectors to be solved within Simplex loop.
Definition: spxsolver.h:1674
Status
Status of a variable.
Definition: spxbasis.h:185
virtual void changeObj(const Vector &newObj, bool scale=false)
scale determines whether the new data needs to be scaled according to the existing LP (persistent sca...
void setLeaveBound4Row(int i, int n)
Definition: spxbounds.cpp:235
SSVector * coSolveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:276
virtual void reLoad()
reload LP.
Definition: spxsolver.cpp:55
virtual Status solve()
solve loaded LP.
Definition: spxsolve.cpp:73
virtual Real maxInfeas() const
maximal infeasibility of basis
Definition: spxsolver.cpp:652
DIdxSet infeasibilitiesCo
Definition: spxsolver.h:403
Wrapper for the system time query methods.
Definition: timer.h:76
DVector dualRhs
rhs vector for computing the dual vector
Definition: spxsolver.h:324
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
Definition: spxsolver.h:420
int num() const
Current number of SVectorBases.
Definition: svsetbase.h:746
const VectorBase< Real > & lower() const
Returns (internal and possibly scaled) lower bound vector.
Definition: spxlpbase.h:483
void setTiming(Timer::TYPE ttype)
set timing type
Definition: spxsolver.h:807
virtual void computeFrhs1(const Vector &, const Vector &)
Definition: spxvecs.cpp:198
Real nonzeroFactor
allowed increase of nonzeros before refactorization.
Definition: spxbasis.h:373
void setDecompStatus(DecompStatus decomp_stat)
turn on or off the improved dual simplex.
Definition: spxsolver.cpp:448
SPxRowId rowId(int i) const
RowId of i &#39;th inequality.
Definition: spxsolver.h:2239
LP column.Class LPColBase provides a datatype for storing the column of an LP a the form similar to ...
Definition: lpcolbase.h:45
const Desc & desc() const
Definition: spxbasis.h:463
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:469
Real nonbasicValue()
Compute part of objective value.
Definition: spxsolver.cpp:733
solve() aborted due to objective limit.
Definition: spxsolver.h:214
columnwise representation.
Definition: spxsolver.h:108
int version() const
return the version of SPxSolver as number like 123 for 1.2.3
Definition: spxsolver.h:459
void setRedCost(Vector &p_vector)
Definition: spxsolve.cpp:1823
virtual Status getDual(Vector &vector) const
get current solution vector for dual variables.
Definition: spxsolve.cpp:1611
Basis is singular, numerical troubles?
Definition: spxsolver.h:215
const SVector & unitVector(int i) const
return i &#39;th unit vector.
Definition: spxsolver.h:1208
virtual Status getPrimalray(Vector &vector) const
get primal ray in case of unboundedness.
Definition: spxsolve.cpp:1685
UpdateVector * theCPvec
column pricing vector
Definition: spxsolver.h:349
virtual void factorize()
Factorize basis matrix.
Definition: spxsolver.cpp:547
void resetClockStats()
resets clock average statistics
Definition: spxsolver.cpp:310
LP has a usable Basis (maybe LP is changed).
Definition: spxsolver.h:217
int primalIterations()
return number of iterations done with primal algorithm
Definition: spxsolver.h:2088
virtual Status getSlacks(Vector &vector) const
get vector of slack variables.
Definition: spxsolve.cpp:1721
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2016
void setPricing(Pricing pr)
set FULL or PARTIAL pricing.
Definition: spxsolver.cpp:437
LP has been proven to be primal unbounded.
Definition: spxsolver.h:221
SPxBasis::Desc::Status varStatus(int i) const
Status of i &#39;th variable.
Definition: spxsolver.h:1223
No linear solver loaded.
Definition: spxsolver.h:207
void setup4coSolve2(SSVector *p_z, SSVector *p_rhs)
Setup vectors to be cosolved within Simplex loop.
Definition: spxsolver.h:1700
virtual TYPE type()=0
return type of timer
virtual void getEnterVals2(int leaveIdx, Real enterMax, Real &leaveBound, Real &objChange)
Definition: enter.cpp:710
bool isValid() const
returns TRUE, iff the DataKey is valid.
Definition: datakey.h:106
void setDelta(Real d)
set parameter delta, i.e., set feastol and opttol to same value.
Definition: spxsolver.cpp:952
Timer::TYPE timerType
type of timer (user or wallclock)
Definition: spxsolver.h:247
virtual void changeUpper(SPxColId p_id, const Real &p_newUpper, bool scale=false)
Definition: spxsolver.h:974
void computeCoTest()
compute coTest vector.
Definition: enter.cpp:228
Real primalDegenSum
the sum of the primal degeneracy percentage
Definition: spxsolver.h:377