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