Scippy

SoPlex

Sequential object-oriented simPlex

spxmainsm.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-2018 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 spxmainsm.h
17  * @brief General methods in LP preprocessing.
18  */
19 #ifndef _SPXMAINSM_H_
20 #define _SPXMAINSM_H_
21 
22 #include <assert.h>
23 
24 #include "spxdefines.h"
25 #include "spxsimplifier.h"
26 #include "array.h"
27 #include "exceptions.h"
28 
29 namespace soplex
30 {
31 //---------------------------------------------------------------------
32 // class SPxMainSM
33 //---------------------------------------------------------------------
34 
35 /**@brief LP simplifier for removing uneccessary row/columns.
36  @ingroup Algo
37 
38  This #SPxSimplifier is mainly based on the paper "Presolving in
39  linear programming" by E. Andersen and K. Andersen (Mathematical
40  Programming, 1995). It implements all proposed methods and some
41  other preprocessing techniques for removing redundant rows and
42  columns and bounds. Also infeasibility and unboundedness may be
43  detected.
44 
45  Removed are:
46  - empty rows / columns
47  - unconstraint rows
48  - row singletons
49  - forcing rows
50  - zero objective column singletons
51  - (implied) free column singletons
52  - doubleton equations combined with a column singleton
53  - (implicitly) fixed columns
54  - redundant lhs / rhs
55  - redundant variable bounds
56  - variables that are free in one direction
57  - (weakly) dominated columns
58  - duplicate rows / columns
59 */
60 class SPxMainSM : public SPxSimplifier
61 {
62 private:
63  //---------------------------------------------------------------------
64  // class PostsolveStep
65  //---------------------------------------------------------------------
66 
67  /**@brief Base class for postsolving operations.
68  @ingroup Algo
69 
70  Class #PostStep is an abstract base class providing the
71  interface for operations in the postsolving process.
72  */
73  class PostStep
74  {
75  private:
76  /// name of the simplifier
77  const char* m_name;
78  /// number of cols
79  int nCols;
80  /// number of rows
81  int nRows;
82 
83  public:
84  /// constructor.
85  PostStep(const char* p_name, int nR = 0, int nC = 0)
86  : m_name(p_name)
87  , nCols(nC)
88  , nRows(nR)
89  {}
90  /// copy constructor.
91  PostStep(const PostStep& old)
92  : m_name(old.m_name)
93  , nCols(old.nCols)
94  , nRows(old.nRows)
95  {}
96  /// assignment operator
97  PostStep& operator=(const PostStep& /*rhs*/)
98  {
99  return *this;
100  }
101  /// destructor.
102  virtual ~PostStep()
103  {
104  m_name = 0;
105  }
106  /// get name of simplifying step.
107  virtual const char* getName() const
108  {
109  return m_name;
110  }
111  /// clone function for polymorphism
112  virtual PostStep* clone() const = 0;
113  /// executes the postsolving.
114  virtual void execute(
115  DVector& x, //*< Primal solution vector */
116  DVector& y, //*< Dual solution vector */
117  DVector& s, //*< Vector of slacks */
118  DVector& r, //*< Reduced cost vector */
119  DataArray<SPxSolver::VarStatus>& cBasis, //*< Basis status of column basis */
120  DataArray<SPxSolver::VarStatus>& rBasis, //*< Basis status of row basis */
121  bool isOptimal
122  ) const = 0;
123 
125 
126  static Real eps()
127  {
128  return 1e-6;
129  }
130  };
131 
132  /**@brief Postsolves row objectives.
133  @ingroup Algo
134  */
135  class RowObjPS : public PostStep
136  {
137  private:
138  int m_i; ///< row index
139  int m_j; ///< slack column index
140 
141  public:
142  ///
143  RowObjPS(const SPxLP& lp, int _i, int _j)
144  : PostStep("RowObj", lp.nRows(), lp.nCols())
145  , m_i(_i)
146  , m_j(_j)
147  {}
148  /// copy constructor
149  RowObjPS(const RowObjPS& old)
150  : PostStep(old)
151  , m_i(old.m_i)
152  , m_j(old.m_j)
153  {}
154  /// assignment operator
156  {
157  if(this != &rhs)
158  {
159  m_i = rhs.m_i;
160  m_j = rhs.m_j;
161  }
162 
163  return *this;
164  }
165  ///
166  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
167  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
168  /// clone function for polymorphism
169  inline virtual PostStep* clone() const
170  {
171  return new RowObjPS(*this);
172  }
173  };
174 
175  /**@brief Postsolves unconstraint constraints.
176  @ingroup Algo
177  */
178  class FreeConstraintPS : public PostStep
179  {
180  private:
181  int m_i;
182  int m_old_i;
185 
186  public:
187  ///
188  FreeConstraintPS(const SPxLP& lp, int _i)
189  : PostStep("FreeConstraint", lp.nRows(), lp.nCols())
190  , m_i(_i)
191  , m_old_i(lp.nRows()-1)
192  , m_row(lp.rowVector(_i))
193  , m_row_obj(lp.rowObj(_i))
194  {}
195  /// copy constructor
197  : PostStep(old)
198  , m_i(old.m_i)
199  , m_old_i(old.m_old_i)
200  , m_row(old.m_row)
201  , m_row_obj(old.m_row_obj)
202  {}
203  /// assignment operator
205  {
206  if(this != &rhs)
207  {
208  m_i = rhs.m_i;
209  m_old_i = rhs.m_old_i;
210  m_row = rhs.m_row;
211  m_row_obj = rhs.m_row_obj;
212  }
213 
214  return *this;
215  }
216  ///
217  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
218  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
219  /// clone function for polymorphism
220  inline virtual PostStep* clone() const
221  {
222  return new FreeConstraintPS(*this);
223  }
224  };
225 
226  /**@brief Postsolves empty constraints.
227  @ingroup Algo
228  */
230  {
231  private:
232  int m_i;
233  int m_old_i;
235 
236  public:
237  ///
238  EmptyConstraintPS(const SPxLP& lp, int _i)
239  : PostStep("EmptyConstraint", lp.nRows(), lp.nCols())
240  , m_i(_i)
241  , m_old_i(lp.nRows()-1)
242  , m_row_obj(lp.rowObj(_i))
243  {}
244  /// copy constructor
246  : PostStep(old)
247  , m_i(old.m_i)
248  , m_old_i(old.m_old_i)
249  , m_row_obj(old.m_row_obj)
250  {}
251  /// assignment operator
253  {
254  if(this != &rhs)
255  {
256  m_i = rhs.m_i;
257  m_old_i = rhs.m_old_i;
258  m_row_obj = rhs.m_row_obj;
259  }
260 
261  return *this;
262  }
263  ///
264  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
265  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
266  /// clone function for polymorphism
267  inline virtual PostStep* clone() const
268  {
269  return new EmptyConstraintPS(*this);
270  }
271  };
272 
273  /**@brief Postsolves row singletons.
274  @ingroup Algo
275  */
276  class RowSingletonPS : public PostStep
277  {
278  private:
279  const int m_i;
280  const int m_old_i;
281  const int m_j;
282  const Real m_lhs;
283  const Real m_rhs;
284  const bool m_strictLo;
285  const bool m_strictUp;
286  const bool m_maxSense;
287  const Real m_obj;
289  const Real m_newLo;
290  const Real m_newUp;
291  const Real m_oldLo;
292  const Real m_oldUp;
294 
295  public:
296  ///
297  RowSingletonPS(const SPxLP& lp, int _i, int _j, bool strictLo, bool strictUp,
298  Real newLo, Real newUp, Real oldLo, Real oldUp)
299  : PostStep("RowSingleton", lp.nRows(), lp.nCols())
300  , m_i(_i)
301  , m_old_i(lp.nRows()-1)
302  , m_j(_j)
303  , m_lhs(lp.lhs(_i))
304  , m_rhs(lp.rhs(_i))
305  , m_strictLo(strictLo)
306  , m_strictUp(strictUp)
307  , m_maxSense(lp.spxSense() == SPxLP::MAXIMIZE)
308  , m_obj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
309  , m_col(lp.colVector(_j))
310  , m_newLo(newLo)
311  , m_newUp(newUp)
312  , m_oldLo(oldLo)
313  , m_oldUp(oldUp)
314  , m_row_obj(lp.rowObj(_i))
315  {}
316  /// copy constructor
318  : PostStep(old)
319  , m_i(old.m_i)
320  , m_old_i(old.m_old_i)
321  , m_j(old.m_j)
322  , m_lhs(old.m_lhs)
323  , m_rhs(old.m_rhs)
324  , m_strictLo(old.m_strictLo)
325  , m_strictUp(old.m_strictUp)
326  , m_maxSense(old.m_maxSense)
327  , m_obj(old.m_obj)
328  , m_col(old.m_col)
329  , m_newLo(old.m_newLo)
330  , m_newUp(old.m_newUp)
331  , m_oldLo(old.m_oldLo)
332  , m_oldUp(old.m_oldUp)
333  , m_row_obj(old.m_row_obj)
334  {}
335  /// assignment operator
337  {
338  if(this != &rhs)
339  {
340  PostStep::operator=(rhs);
341  m_col = rhs.m_col;
342  }
343 
344  return *this;
345  }
346  /// clone function for polymorphism
347  inline virtual PostStep* clone() const
348  {
349  return new RowSingletonPS(*this);
350  }
351  ///
352  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
353  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
354  };
355 
356  /**@brief Postsolves forcing constraints.
357  @ingroup Algo
358  */
360  {
361  private:
362  const int m_i;
363  const int m_old_i;
364  const Real m_lRhs;
369  const bool m_lhsFixed;
370  const bool m_maxSense;
373  const Real m_lhs;
374  const Real m_rhs;
375  const Real m_rowobj;
376 
377  public:
378  ///
379  ForceConstraintPS(const SPxLP& lp, int _i, bool lhsFixed, DataArray<bool>& fixCols, DataArray<Real>& lo, DataArray<Real>& up)
380  : PostStep("ForceConstraint", lp.nRows(), lp.nCols())
381  , m_i(_i)
382  , m_old_i(lp.nRows()-1)
383  , m_lRhs(lhsFixed ? lp.lhs(_i) : lp.rhs(_i))
384  , m_row(lp.rowVector(_i))
385  , m_objs(lp.rowVector(_i).size())
386  , m_fixed(fixCols)
387  , m_cols(lp.rowVector(_i).size())
388  , m_lhsFixed(lhsFixed)
389  , m_maxSense(lp.spxSense() == SPxLP::MAXIMIZE)
390  , m_oldLowers(lo)
391  , m_oldUppers(up)
392  , m_lhs(lp.lhs(_i))
393  , m_rhs(lp.rhs(_i))
394  , m_rowobj(lp.rowObj(_i))
395  {
396  for(int k = 0; k < m_row.size(); ++k)
397  {
398  m_objs[k] = (lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(m_row.index(k)) : -lp.obj(m_row.index(k)));
399  m_cols[k] = lp.colVector(m_row.index(k));
400  }
401  }
402  /// copy constructor
404  : PostStep(old)
405  , m_i(old.m_i)
406  , m_old_i(old.m_old_i)
407  , m_lRhs(old.m_lRhs)
408  , m_row(old.m_row)
409  , m_objs(old.m_objs)
410  , m_fixed(old.m_fixed)
411  , m_cols(old.m_cols)
412  , m_lhsFixed(old.m_lhsFixed)
413  , m_maxSense(old.m_maxSense)
414  , m_oldLowers(old.m_oldLowers)
415  , m_oldUppers(old.m_oldUppers)
416  , m_lhs(old.m_lhs)
417  , m_rhs(old.m_rhs)
418  , m_rowobj(old.m_rowobj)
419  {}
420  /// assignment operator
422  {
423  if(this != &rhs)
424  {
425  PostStep::operator=(rhs);
426  m_row = rhs.m_row;
427  m_objs = rhs.m_objs;
428  m_fixed = rhs.m_fixed;
429  m_cols = rhs.m_cols;
430  m_oldLowers = rhs.m_oldLowers;
431  m_oldUppers = rhs.m_oldUppers;
432  }
433 
434  return *this;
435  }
436  /// clone function for polymorphism
437  inline virtual PostStep* clone() const
438  {
439  return new ForceConstraintPS(*this);
440  }
441  ///
442  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
443  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
444  };
445 
446  /**@brief Postsolves variable fixing.
447  @ingroup Algo
448  */
449  class FixVariablePS : public PostStep
450  {
451  private:
452  const int m_j;
453  const int m_old_j;
454  const Real m_val;
455  const Real m_obj;
456  const Real m_lower;
457  const Real m_upper;
458  const bool m_correctIdx; /// does the index mapping have to be updated in postsolving?
460 
461  public:
462  ///
463  FixVariablePS(const SPxLP& lp, SPxMainSM& simplifier, int _j, const Real val, bool correctIdx = true)
464  : PostStep("FixVariable", lp.nRows(), lp.nCols())
465  , m_j(_j)
466  , m_old_j(lp.nCols()-1)
467  , m_val(val)
468  , m_obj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
469  , m_lower(lp.lower(_j))
470  , m_upper(lp.upper(_j))
471  , m_correctIdx(correctIdx)
472  , m_col(lp.colVector(_j))
473  {
474  simplifier.addObjoffset(m_val*lp.obj(m_j));
475  }
476  /// copy constructor
478  : PostStep(old)
479  , m_j(old.m_j)
480  , m_old_j(old.m_old_j)
481  , m_val(old.m_val)
482  , m_obj(old.m_obj)
483  , m_lower(old.m_lower)
484  , m_upper(old.m_upper)
485  , m_correctIdx(old.m_correctIdx)
486  , m_col(old.m_col)
487  {}
488  /// assignment operator
490  {
491  if(this != &rhs)
492  {
493  PostStep::operator=(rhs);
494  m_col = rhs.m_col;
495  }
496 
497  return *this;
498  }
499  /// clone function for polymorphism
500  inline virtual PostStep* clone() const
501  {
502  return new FixVariablePS(*this);
503  }
504  ///
505  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
506  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
507  };
508 
509  /**@brief Postsolves variable bound fixing.
510  @ingroup Algo
511  */
512  class FixBoundsPS : public PostStep
513  {
514  private:
515  const int m_j;
517 
518  public:
519  ///
520  FixBoundsPS(const SPxLP& lp, int j, Real val)
521  : PostStep("FixBounds", lp.nRows(), lp.nCols())
522  , m_j(j)
523  {
524  if (EQrel(lp.lower(j), lp.upper(j), eps()))
525  m_status = SPxSolver::FIXED;
526  else if (EQrel(val, lp.lower(j), eps()))
527  m_status = SPxSolver::ON_LOWER;
528  else if (EQrel(val, lp.upper(j), eps()))
529  m_status = SPxSolver::ON_UPPER;
530  else if (lp.lower(j) <= -infinity && lp.upper(j) >= infinity)
531  m_status = SPxSolver::ZERO;
532  else
533  {
534  throw SPxInternalCodeException("XMAISM14 This should never happen.");
535  }
536  }
537  /// copy constructor
539  : PostStep(old)
540  , m_j(old.m_j)
541  , m_status(old.m_status)
542  {}
543  /// assignment operator
545  {
546  if(this != &rhs)
547  {
548  PostStep::operator=(rhs);
549  m_status = rhs.m_status;
550  }
551 
552  return *this;
553  }
554  /// clone function for polymorphism
555  inline virtual PostStep* clone() const
556  {
557  FixBoundsPS* FixBoundsPSptr = 0;
558  spx_alloc(FixBoundsPSptr);
559  return new (FixBoundsPSptr) FixBoundsPS(*this);
560  }
561  ///
562  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
563  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
564  };
565 
566  /**@brief Postsolves the case when constraints are removed due to a
567  variable with zero objective that is free in one direction.
568  @ingroup Algo
569  */
571  {
572  private:
573  const int m_j;
574  const int m_old_j;
575  const int m_old_i;
576  const Real m_bnd;
581  const bool m_loFree;
582 
583  public:
584  ///
585  FreeZeroObjVariablePS(const SPxLP& lp, int _j, bool loFree, SVector col_idx_sorted)
586  : PostStep("FreeZeroObjVariable", lp.nRows(), lp.nCols())
587  , m_j(_j)
588  , m_old_j(lp.nCols()-1)
589  , m_old_i(lp.nRows()-1)
590  , m_bnd(loFree ? lp.upper(_j) : lp.lower(_j))
591  , m_col(col_idx_sorted)
592  , m_lRhs(lp.colVector(_j).size())
593  , m_rowObj(lp.colVector(_j).size())
594  , m_rows(lp.colVector(_j).size())
595  , m_loFree(loFree)
596  {
597  for(int k = 0; k < m_col.size(); ++k)
598  {
599  assert(isNotZero(m_col.value(k)));
600 
601  int r = m_col.index(k);
602  if ((m_loFree && m_col.value(k) > 0) ||
603  (!m_loFree && m_col.value(k) < 0))
604  m_lRhs.add(k, lp.rhs(r));
605  else
606  m_lRhs.add(k, lp.lhs(r));
607 
608  m_rows[k] = lp.rowVector(r);
609  m_rowObj.add(k, lp.rowObj(r));
610  }
611  }
612  /// copy constructor
614  : PostStep(old)
615  , m_j(old.m_j)
616  , m_old_j(old.m_old_j)
617  , m_old_i(old.m_old_i)
618  , m_bnd(old.m_bnd)
619  , m_col(old.m_col)
620  , m_lRhs(old.m_lRhs)
621  , m_rowObj(old.m_rowObj)
622  , m_rows(old.m_rows)
623  , m_loFree(old.m_loFree)
624  {}
625  /// assignment operator
627  {
628  if(this != &rhs)
629  {
630  PostStep::operator=(rhs);
631  m_col = rhs.m_col;
632  m_lRhs = rhs.m_lRhs;
633  m_rowObj = rhs.m_rowObj;
634  m_rows = rhs.m_rows;
635  }
636 
637  return *this;
638  }
639  /// clone function for polymorphism
640  inline virtual PostStep* clone() const
641  {
642  FreeZeroObjVariablePS* FreeZeroObjVariablePSptr = 0;
643  spx_alloc(FreeZeroObjVariablePSptr);
644  return new (FreeZeroObjVariablePSptr) FreeZeroObjVariablePS(*this);
645  }
646  ///
647  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
648  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
649  };
650 
651  /**@brief Postsolves column singletons with zero objective.
652  @ingroup Algo
653  */
655  {
656  private:
657  const int m_j;
658  const int m_i;
659  const int m_old_j;
660  const Real m_lhs;
661  const Real m_rhs;
662  const Real m_lower;
663  const Real m_upper;
665 
666  public:
667  ///
668  ZeroObjColSingletonPS(const SPxLP& lp, const SPxMainSM& , int _j, int _i)
669  : PostStep("ZeroObjColSingleton", lp.nRows(), lp.nCols())
670  , m_j(_j)
671  , m_i(_i)
672  , m_old_j(lp.nCols()-1)
673  , m_lhs(lp.lhs(_i))
674  , m_rhs(lp.rhs(_i))
675  , m_lower(lp.lower(_j))
676  , m_upper(lp.upper(_j))
677  , m_row(lp.rowVector(_i))
678  {}
679  /// copy constructor
681  : PostStep(old)
682  , m_j(old.m_j)
683  , m_i(old.m_i)
684  , m_old_j(old.m_old_j)
685  , m_lhs(old.m_lhs)
686  , m_rhs(old.m_rhs)
687  , m_lower(old.m_lower)
688  , m_upper(old.m_upper)
689  , m_row(old.m_row)
690  {}
691  /// assignment operator
693  {
694  if(this != &rhs)
695  {
696  PostStep::operator=(rhs);
697  m_row = rhs.m_row;
698  }
699 
700  return *this;
701  }
702  /// clone function for polymorphism
703  inline virtual PostStep* clone() const
704  {
705  ZeroObjColSingletonPS* ZeroObjColSingletonPSptr = 0;
706  spx_alloc(ZeroObjColSingletonPSptr);
707  return new (ZeroObjColSingletonPSptr) ZeroObjColSingletonPS(*this);
708  }
709  ///
710  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
711  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
712  };
713 
714  /**@brief Postsolves free column singletons.
715  @ingroup Algo
716  */
718  {
719  private:
720  const int m_j;
721  const int m_i;
722  const int m_old_j;
723  const int m_old_i;
724  const Real m_obj;
725  const Real m_lRhs;
726  const bool m_onLhs;
727  const bool m_eqCons;
729 
730  public:
731  ///
732  FreeColSingletonPS(const SPxLP& lp, SPxMainSM& simplifier, int _j, int _i, Real slackVal)
733  : PostStep("FreeColSingleton", lp.nRows(), lp.nCols())
734  , m_j(_j)
735  , m_i(_i)
736  , m_old_j(lp.nCols()-1)
737  , m_old_i(lp.nRows()-1)
738  , m_obj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
739  , m_lRhs(slackVal)
740  , m_onLhs(EQ(slackVal, lp.lhs(_i)))
741  , m_eqCons(EQ(lp.lhs(_i), lp.rhs(_i)))
742  , m_row(lp.rowVector(_i))
743  {
744  assert(m_row[m_j] != 0.0);
745  simplifier.addObjoffset(m_lRhs*(lp.obj(m_j)/m_row[m_j]));
746  }
747  /// copy constructor
749  : PostStep(old)
750  , m_j(old.m_j)
751  , m_i(old.m_i)
752  , m_old_j(old.m_old_j)
753  , m_old_i(old.m_old_i)
754  , m_obj(old.m_obj)
755  , m_lRhs(old.m_lRhs)
756  , m_onLhs(old.m_onLhs)
757  , m_eqCons(old.m_eqCons)
758  , m_row(old.m_row)
759  {}
760  /// assignment operator
762  {
763  if(this != &rhs)
764  {
765  PostStep::operator=(rhs);
766  m_row = rhs.m_row;
767  }
768 
769  return *this;
770  }
771  /// clone function for polymorphism
772  inline virtual PostStep* clone() const
773  {
774  FreeColSingletonPS* FreeColSingletonPSptr = 0;
775  spx_alloc(FreeColSingletonPSptr);
776  return new (FreeColSingletonPSptr) FreeColSingletonPS(*this);
777  }
778  ///
779  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
780  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
781  };
782 
783  /**@brief Postsolves doubleton equations combined with a column singleton.
784  @ingroup Algo
785  */
787  {
788  private:
789  const int m_j;
790  const int m_k;
791  const int m_i;
792  const bool m_maxSense;
793  const bool m_jFixed;
794  const Real m_jObj;
795  const Real m_kObj;
796  const Real m_aij;
797  const bool m_strictLo;
798  const bool m_strictUp;
799  const Real m_newLo;
800  const Real m_newUp;
801  const Real m_oldLo;
802  const Real m_oldUp;
803  const Real m_Lo_j;
804  const Real m_Up_j;
805  const Real m_lhs;
806  const Real m_rhs;
808 
809  public:
810  ///
811  DoubletonEquationPS(const SPxLP& lp, int _j, int _k, int _i, Real oldLo, Real oldUp)
812  : PostStep("DoubletonEquation", lp.nRows(), lp.nCols())
813  , m_j(_j)
814  , m_k(_k)
815  , m_i(_i)
816  , m_maxSense(lp.spxSense() == SPxLP::MAXIMIZE)
817  , m_jFixed(EQ(lp.lower(_j), lp.upper(_j)))
818  , m_jObj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
819  , m_kObj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_k) : -lp.obj(_k))
820  , m_aij(lp.colVector(_j).value(0))
821  , m_strictLo(lp.lower(_k) > oldLo)
822  , m_strictUp(lp.upper(_k) < oldUp)
823  , m_newLo(lp.lower(_k))
824  , m_newUp(lp.upper(_k))
825  , m_oldLo(oldLo)
826  , m_oldUp(oldUp)
827  , m_Lo_j(lp.lower(_j))
828  , m_Up_j(lp.upper(_j))
829  , m_lhs(lp.lhs(_i))
830  , m_rhs(lp.rhs(_i))
831  , m_col(lp.colVector(_k))
832  {}
833  /// copy constructor
835  : PostStep(old)
836  , m_j(old.m_j)
837  , m_k(old.m_k)
838  , m_i(old.m_i)
839  , m_maxSense(old.m_maxSense)
840  , m_jFixed(old.m_jFixed)
841  , m_jObj(old.m_jObj)
842  , m_kObj(old.m_kObj)
843  , m_aij(old.m_aij)
844  , m_strictLo(old.m_strictLo)
845  , m_strictUp(old.m_strictUp)
846  , m_newLo(old.m_newLo)
847  , m_newUp(old.m_newUp)
848  , m_oldLo(old.m_oldLo)
849  , m_oldUp(old.m_oldUp)
850  , m_Lo_j(old.m_Lo_j)
851  , m_Up_j(old.m_Up_j)
852  , m_lhs(old.m_lhs)
853  , m_rhs(old.m_rhs)
854  , m_col(old.m_col)
855  {}
856  /// assignment operator
858  {
859  if(this != &rhs)
860  {
861  PostStep::operator=(rhs);
862  m_col = rhs.m_col;
863  }
864 
865  return *this;
866  }
867  /// clone function for polymorphism
868  inline virtual PostStep* clone() const
869  {
870  DoubletonEquationPS* DoubletonEquationPSptr = 0;
871  spx_alloc(DoubletonEquationPSptr);
872  return new (DoubletonEquationPSptr) DoubletonEquationPS(*this);
873  }
874  ///
875  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
876  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
877  };
878 
879  /**@brief Postsolves duplicate rows.
880  @ingroup Algo
881  */
882  class DuplicateRowsPS : public PostStep
883  {
884  private:
885  const int m_i;
887  const int m_maxLhsIdx;
888  const int m_minRhsIdx;
889  const bool m_maxSense;
890  const bool m_isFirst;
891  const bool m_isLast;
892  const bool m_fixed;
893  const int m_nCols;
899 
900  public:
901  DuplicateRowsPS(const SPxLP& lp, int _i,
902  int maxLhsIdx, int minRhsIdx, const DSVector& dupRows,
903  const DataArray<Real> scale, const DataArray<int> perm, const DataArray<bool> isLhsEqualRhs,
904  bool isTheLast, bool isFixedRow, bool isFirst = false)
905  : PostStep("DuplicateRows", lp.nRows(), lp.nCols())
906  , m_i(_i)
907  , m_i_rowObj(lp.rowObj(_i))
908  , m_maxLhsIdx((maxLhsIdx == -1) ? -1 : maxLhsIdx)
909  , m_minRhsIdx((minRhsIdx == -1) ? -1 : minRhsIdx)
910  , m_maxSense(lp.spxSense() == SPxLP::MAXIMIZE)
911  , m_isFirst(isFirst)
912  , m_isLast(isTheLast)
913  , m_fixed(isFixedRow)
914  , m_nCols(lp.nCols())
915  , m_scale(dupRows.size())
916  , m_rowObj(dupRows.size())
917  , m_rIdxLocalOld(dupRows.size())
918  , m_perm(perm)
919  , m_isLhsEqualRhs(isLhsEqualRhs)
920  {
921  Real rowScale = scale[_i];
922 
923  for(int k = 0; k < dupRows.size(); ++k)
924  {
925  m_scale.add(dupRows.index(k), rowScale / scale[dupRows.index(k)]);
926  m_rowObj.add(dupRows.index(k), lp.rowObj(dupRows.index(k)));
927  m_rIdxLocalOld[k] = dupRows.index(k);
928  }
929  }
930  /// copy constructor
932  : PostStep(old)
933  , m_i(old.m_i)
934  , m_i_rowObj(old.m_i_rowObj)
935  , m_maxLhsIdx(old.m_maxLhsIdx)
936  , m_minRhsIdx(old.m_minRhsIdx)
937  , m_maxSense(old.m_maxSense)
938  , m_isFirst(old.m_isFirst)
939  , m_isLast(old.m_isLast)
940  , m_fixed(old.m_fixed)
941  , m_nCols(old.m_nCols)
942  , m_scale(old.m_scale)
943  , m_rowObj(old.m_rowObj)
944  , m_rIdxLocalOld(old.m_rIdxLocalOld)
945  , m_perm(old.m_perm)
946  , m_isLhsEqualRhs(old.m_isLhsEqualRhs)
947  {}
948  /// assignment operator
950  {
951  if(this != &rhs)
952  {
953  PostStep::operator=(rhs);
954  m_scale = rhs.m_scale;
955  m_rowObj = rhs.m_rowObj;
956  m_rIdxLocalOld = rhs.m_rIdxLocalOld;
957  m_perm = rhs.m_perm;
958  m_isLhsEqualRhs = rhs.m_isLhsEqualRhs;
959  }
960 
961  return *this;
962  }
963  /// clone function for polymorphism
964  inline virtual PostStep* clone() const
965  {
966  DuplicateRowsPS* DuplicateRowsPSptr = 0;
967  spx_alloc(DuplicateRowsPSptr);
968  return new (DuplicateRowsPSptr) DuplicateRowsPS(*this);
969  }
970  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
971  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
972  };
973 
974  /**@brief Postsolves duplicate columns.
975  @ingroup Algo
976  */
977  class DuplicateColsPS : public PostStep
978  {
979  private:
980  const int m_j;
981  const int m_k;
982  const Real m_loJ;
983  const Real m_upJ;
984  const Real m_loK;
985  const Real m_upK;
986  const Real m_scale;
987  const bool m_isFirst;
988  const bool m_isLast;
990 
991  public:
992  DuplicateColsPS(const SPxLP& lp, int _j, int _k, Real scale, DataArray<int> perm, bool isFirst = false, bool isTheLast = false)
993  : PostStep("DuplicateCols", lp.nRows(), lp.nCols())
994  , m_j(_j)
995  , m_k(_k)
996  , m_loJ(lp.lower(_j))
997  , m_upJ(lp.upper(_j))
998  , m_loK(lp.lower(_k))
999  , m_upK(lp.upper(_k))
1000  , m_scale(scale)
1001  , m_isFirst(isFirst)
1002  , m_isLast(isTheLast)
1003  , m_perm(perm)
1004  {}
1005  /// copy constructor
1007  : PostStep(old)
1008  , m_j(old.m_j)
1009  , m_k(old.m_k)
1010  , m_loJ(old.m_loJ)
1011  , m_upJ(old.m_upJ)
1012  , m_loK(old.m_loK)
1013  , m_upK (old.m_upK)
1014  , m_scale (old.m_scale)
1015  , m_isFirst(old.m_isFirst)
1016  , m_isLast(old.m_isLast)
1017  , m_perm(old.m_perm)
1018  {}
1019  /// assignment operator
1021  {
1022  if(this != &rhs)
1023  {
1024  PostStep::operator=(rhs);
1025  }
1026 
1027  return *this;
1028  }
1029  /// clone function for polymorphism
1030  inline virtual PostStep* clone() const
1031  {
1032  DuplicateColsPS* DuplicateColsPSptr = 0;
1033  spx_alloc(DuplicateColsPSptr);
1034  return new (DuplicateColsPSptr) DuplicateColsPS(*this);
1035  }
1036  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1037  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1038  };
1039 
1040  /**@brief Postsolves multi aggregation.
1041  @ingroup Algo
1042  */
1044  {
1045  private:
1046  const int m_j;
1047  const int m_i;
1048  const int m_old_j;
1049  const int m_old_i;
1050  const Real m_upper;
1051  const Real m_lower;
1052  const Real m_obj;
1053  const Real m_const;
1054  const bool m_onLhs;
1055  const bool m_eqCons;
1058 
1059  public:
1060  ///
1061  MultiAggregationPS(const SPxLP& lp, SPxMainSM& simplifier, int _i, int _j, Real constant)
1062  : PostStep("MultiAggregation", lp.nRows(), lp.nCols())
1063  , m_j(_j)
1064  , m_i(_i)
1065  , m_old_j(lp.nCols()-1)
1066  , m_old_i(lp.nRows()-1)
1067  , m_upper(lp.upper(_j))
1068  , m_lower(lp.lower(_j))
1069  , m_obj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
1070  , m_const(constant)
1071  , m_onLhs(EQ(constant, lp.lhs(_i)))
1072  , m_eqCons(EQ(lp.lhs(_i), lp.rhs(_i)))
1073  , m_row(lp.rowVector(_i))
1074  , m_col(lp.colVector(_j))
1075  {
1076  assert(m_row[m_j] != 0.0);
1077  simplifier.addObjoffset(m_obj*m_const/m_row[m_j]);
1078  }
1079  /// copy constructor
1081  : PostStep(old)
1082  , m_j(old.m_j)
1083  , m_i(old.m_i)
1084  , m_old_j(old.m_old_j)
1085  , m_old_i(old.m_old_i)
1086  , m_upper(old.m_upper)
1087  , m_lower(old.m_lower)
1088  , m_obj(old.m_obj)
1089  , m_const(old.m_const)
1090  , m_onLhs(old.m_onLhs)
1091  , m_eqCons(old.m_eqCons)
1092  , m_row(old.m_row)
1093  , m_col(old.m_col)
1094  {}
1095  /// assignment operator
1097  {
1098  if(this != &rhs)
1099  {
1100  PostStep::operator=(rhs);
1101  m_row = rhs.m_row;
1102  m_col = rhs.m_col;
1103  }
1104 
1105  return *this;
1106  }
1107  /// clone function for polymorphism
1108  inline virtual PostStep* clone() const
1109  {
1110  MultiAggregationPS* MultiAggregationPSptr = 0;
1111  spx_alloc(MultiAggregationPSptr);
1112  return new (MultiAggregationPSptr) MultiAggregationPS(*this);
1113  }
1114  ///
1115  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1116  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1117  };
1118 
1119  /**@brief Postsolves variable bound tightening from pseudo objective propagation.
1120  @ingroup Algo
1121  */
1122  class TightenBoundsPS : public PostStep
1123  {
1124  private:
1125  const int m_j;
1128 
1129  public:
1130  ///
1131  TightenBoundsPS(const SPxLP& lp, int j, Real origupper, Real origlower)
1132  : PostStep("TightenBounds", lp.nRows(), lp.nCols())
1133  , m_j(j)
1134  , m_origupper(origupper)
1135  , m_origlower(origlower)
1136  {
1137  }
1138  /// copy constructor
1140  : PostStep(old)
1141  , m_j(old.m_j)
1142  , m_origupper(old.m_origupper)
1143  , m_origlower(old.m_origlower)
1144  {}
1145  /// assignment operator
1147  {
1148  return *this;
1149  }
1150  /// clone function for polymorphism
1151  inline virtual PostStep* clone() const
1152  {
1153  TightenBoundsPS* TightenBoundsPSptr = 0;
1154  spx_alloc(TightenBoundsPSptr);
1155  return new (TightenBoundsPSptr) TightenBoundsPS(*this);
1156  }
1157  ///
1158  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1159  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1160  };
1161  // friends
1162  friend class FreeConstraintPS;
1163  friend class EmptyConstraintPS;
1164  friend class RowSingletonPS;
1165  friend class ForceConstraintPS;
1166  friend class FixVariablePS;
1167  friend class FixBoundsPS;
1170  friend class FreeColSingletonPS;
1171  friend class DoubletonEquationPS;
1172  friend class DuplicateRowsPS;
1173  friend class DuplicateColsPS;
1174 
1175 private:
1176  //------------------------------------
1177  //**@name Types */
1178  //@{
1179  /// Different simplification steps.
1181  {
1187  FIX_COL = 5,
1198  };
1199  //@}
1200 
1201  //------------------------------------
1202  //**@name Data */
1203  //@{
1204  ///
1205  DVector m_prim; ///< unsimplified primal solution vector.
1206  DVector m_slack; ///< unsimplified slack vector.
1207  DVector m_dual; ///< unsimplified dual solution vector.
1208  DVector m_redCost; ///< unsimplified reduced cost vector.
1209  DataArray<SPxSolver::VarStatus> m_cBasisStat; ///< basis status of columns.
1210  DataArray<SPxSolver::VarStatus> m_rBasisStat; ///< basis status of rows.
1211  DataArray<int> m_cIdx; ///< column index vector in original LP.
1212  DataArray<int> m_rIdx; ///< row index vector in original LP.
1213  DataArray<PostStep*> m_hist; ///< vector of presolve history.
1214  Array<DSVector> m_classSetRows; ///< stores parallel classes with non-zero colum entry
1215  Array<DSVector> m_classSetCols; ///< stores parallel classes with non-zero row entry
1216  Array<DSVector> m_dupRows; ///< arrange duplicate rows using bucket sort w.r.t. their pClass values
1217  Array<DSVector> m_dupCols; ///< arrange duplicate columns w.r.t. their pClass values
1218  bool m_postsolved; ///< status of postsolving.
1219  Real m_epsilon; ///< epsilon zero.
1220  Real m_feastol; ///< primal feasibility tolerance.
1221  Real m_opttol; ///< dual feasibility tolerance.
1222  DataArray<int> m_stat; ///< preprocessing history.
1223  SPxLP::SPxSense m_thesense; ///< optimization sense.
1224  bool m_keepbounds; ///< keep some bounds (for boundflipping)
1225  int m_addedcols; ///< columns added by handleRowObjectives()
1226  Result m_result; ///< result of the simplification.
1227  Real m_cutoffbound; ///< the cutoff bound that is found by heuristics
1228  Real m_pseudoobj; ///< the pseudo objective function value
1229  //@}
1230 
1231 private:
1232  //------------------------------------
1233  //**@name Private helpers */
1234  //@{
1235  /// handle row objectives
1236  void handleRowObjectives(SPxLP& lp);
1237 
1238  /// handles extreme values by setting them to zero or infinity.
1239  void handleExtremes(SPxLP& lp);
1240 
1241  /// computes the minimum and maximum residual activity for a given row and column. If colNumber is set to -1, then
1242  // the activity of the row is returned.
1243  void computeMinMaxResidualActivity(SPxLP& lp, int rowNumber, int colNumber, Real& minAct, Real& maxAct);
1244 
1245  /// calculate min/max value for the multi aggregated variables
1246  void computeMinMaxValues(SPxLP& lp, Real side, Real val, Real minRes, Real maxRes, Real& minVal, Real& maxVal);
1247 
1248  /// tries to find good lower bound solutions by applying some trivial heuristics
1249  void trivialHeuristic(SPxLP& lp);
1250 
1251  /// checks a solution for feasibility
1252  bool checkSolution(SPxLP& lp, DVector sol);
1253 
1254  /// tightens variable bounds by propagating the pseudo objective function value.
1255  void propagatePseudoobj(SPxLP& lp);
1256 
1257  /// removed empty rows and empty columns.
1258  Result removeEmpty(SPxLP& lp);
1259 
1260  /// remove row singletons.
1261  Result removeRowSingleton(SPxLP& lp, const SVector& row, int& i);
1262 
1263  /// performs simplification steps on the rows of the LP.
1264  Result simplifyRows(SPxLP& lp, bool& again);
1265 
1266  /// performs simplification steps on the columns of the LP.
1267  Result simplifyCols(SPxLP& lp, bool& again);
1268 
1269  /// performs simplification steps on the LP based on dual concepts.
1270  Result simplifyDual(SPxLP& lp, bool& again);
1271 
1272  /// performs multi-aggregations of variable based upon constraint activitu.
1273  Result multiaggregation(SPxLP& lp, bool& again);
1274 
1275  /// removes duplicate rows.
1276  Result duplicateRows(SPxLP& lp, bool& again);
1277 
1278  /// removes duplicate columns
1279  Result duplicateCols(SPxLP& lp, bool& again);
1280 
1281  /// handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated.
1282  void fixColumn(SPxLP& lp, int i, bool correctIdx = true);
1283 
1284  /// removes a row in the LP.
1285  void removeRow(SPxLP& lp, int i)
1286  {
1287  m_rIdx[i] = m_rIdx[lp.nRows()-1];
1288  lp.removeRow(i);
1289  }
1290  /// removes a column in the LP.
1291  void removeCol(SPxLP& lp, int j)
1292  {
1293  m_cIdx[j] = m_cIdx[lp.nCols()-1];
1294  lp.removeCol(j);
1295  }
1296  /// returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP.
1297  int rIdx(int i) const
1298  {
1299  return m_rIdx[i];
1300  }
1301  /// returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP.
1302  int cIdx(int j) const
1303  {
1304  return m_cIdx[j];
1305  }
1306  ///
1307  Real epsZero() const
1308  {
1309  return m_epsilon;
1310  }
1311  ///
1312  Real feastol() const
1313  {
1314  return m_feastol;
1315  }
1316  ///
1317  Real opttol() const
1318  {
1319  return m_opttol;
1320  }
1321  //@}
1322 
1323 public:
1324 
1325  //------------------------------------
1326  //**@name Constructors / destructors */
1327  //@{
1328  /// default constructor.
1330  : SPxSimplifier("MainSM", ttype)
1331  , m_postsolved(0)
1332  , m_epsilon(DEFAULT_EPS_ZERO)
1333  , m_feastol(DEFAULT_BND_VIOL)
1334  , m_opttol(DEFAULT_BND_VIOL)
1335  , m_stat(16)
1336  , m_thesense(SPxLP::MAXIMIZE)
1337  , m_keepbounds(false)
1338  , m_addedcols(0)
1339  , m_result(OKAY)
1340  , m_cutoffbound(-infinity)
1341  , m_pseudoobj(-infinity)
1342  {}
1343  /// copy constructor.
1344  SPxMainSM(const SPxMainSM& old)
1345  : SPxSimplifier(old)
1346  , m_prim(old.m_prim)
1347  , m_slack(old.m_slack)
1348  , m_dual(old.m_dual)
1349  , m_redCost(old.m_redCost)
1350  , m_cBasisStat(old.m_cBasisStat)
1351  , m_rBasisStat(old.m_rBasisStat)
1352  , m_cIdx(old.m_cIdx)
1353  , m_rIdx(old.m_rIdx)
1354  , m_postsolved(old.m_postsolved)
1355  , m_epsilon(old.m_epsilon)
1356  , m_feastol(old.m_feastol)
1357  , m_opttol(old.m_opttol)
1358  , m_stat(old.m_stat)
1359  , m_thesense(old.m_thesense)
1360  , m_keepbounds(old.m_keepbounds)
1361  , m_addedcols(old.m_addedcols)
1362  , m_result(old.m_result)
1363  , m_cutoffbound(old.m_cutoffbound)
1364  , m_pseudoobj(old.m_pseudoobj)
1365  {
1366  // copy pointers in m_hist
1367  m_hist.reSize(0);
1368  for(int k = 0; k < old.m_hist.size(); ++k)
1369  {
1370  if(old.m_hist[k] != 0)
1371  m_hist.append(old.m_hist[k]->clone());
1372  else
1373  m_hist.append(0);
1374  }
1375  }
1376  /// assignment operator
1378  {
1379  if(this != &rhs)
1380  {
1382  m_prim = rhs.m_prim;
1383  m_slack = rhs.m_slack;
1384  m_dual = rhs.m_dual;
1385  m_redCost = rhs.m_redCost;
1386  m_cBasisStat = rhs.m_cBasisStat;
1387  m_rBasisStat = rhs.m_rBasisStat;
1388  m_cIdx = rhs.m_cIdx;
1389  m_rIdx = rhs.m_rIdx;
1390  m_postsolved = rhs.m_postsolved;
1391  m_epsilon = rhs.m_epsilon;
1392  m_feastol = rhs.m_feastol;
1393  m_opttol = rhs.m_opttol;
1394  m_stat = rhs.m_stat;
1395  m_thesense = rhs.m_thesense;
1396  m_keepbounds = rhs.m_keepbounds;
1397  m_addedcols = rhs.m_addedcols;
1398  m_result = rhs.m_result;
1399  m_cutoffbound = rhs.m_cutoffbound;
1400  m_pseudoobj = rhs.m_pseudoobj;
1401 
1402  // delete pointers in m_hist
1403  for(int k = 0; k < m_hist.size(); ++k)
1404  {
1405  m_hist[k]->~PostStep();
1406  spx_free(m_hist[k]);
1407  }
1408 
1409  m_hist.clear();
1410 
1411  // copy pointers in m_hist
1412  for(int k = 0; k < rhs.m_hist.size(); ++k)
1413  {
1414  if(rhs.m_hist[k] != 0)
1415  m_hist.append(rhs.m_hist[k]->clone());
1416  else
1417  m_hist.append(0);
1418  }
1419  }
1420 
1421  return *this;
1422  }
1423  /// destructor.
1424  virtual ~SPxMainSM()
1425  {
1426  // delete pointers in m_hist
1427  for(int k = 0; k < m_hist.size(); ++k)
1428  {
1429  if( m_hist[k] != 0 )
1430  {
1431  m_hist[k]->~PostStep();
1432  spx_free(m_hist[k]);
1433  }
1434  }
1435  }
1436  /// clone function for polymorphism
1437  inline virtual SPxSimplifier* clone() const
1438  {
1439  return new SPxMainSM(*this);
1440  }
1441  //@}
1442 
1443  //------------------------------------
1444  //**@name LP simplification */
1445  //@{
1446  /// simplify SPxLP \p lp with identical primal and dual feasibility tolerance.
1447  virtual Result simplify(SPxLP& lp, Real eps, Real delta)
1448  {
1449  return simplify(lp, eps, delta, delta);
1450  }
1451  /// simplify SPxLP \p lp with independent primal and dual feasibility tolerance.
1452  virtual Result simplify(SPxLP& lp, Real eps, Real ftol, Real otol, bool keepbounds = false);
1453 
1454  /// reconstructs an optimal solution for the unsimplified LP.
1455  virtual void unsimplify(const Vector& x, const Vector& y, const Vector& s, const Vector& r,
1456  const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[], bool isOptimal = true);
1457 
1458  /// returns result status of the simplification
1459  virtual Result result() const
1460  {
1461  return m_result;
1462  }
1463 
1464  /// specifies whether an optimal solution has already been unsimplified.
1465  virtual bool isUnsimplified() const
1466  {
1467  return m_postsolved;
1468  }
1469  /// returns a reference to the unsimplified primal solution.
1470  virtual const Vector& unsimplifiedPrimal()
1471  {
1472  assert(m_postsolved);
1473  return m_prim;
1474  }
1475  /// returns a reference to the unsimplified dual solution.
1476  virtual const Vector& unsimplifiedDual()
1477  {
1478  assert(m_postsolved);
1479  return m_dual;
1480  }
1481  /// returns a reference to the unsimplified slack values.
1482  virtual const Vector& unsimplifiedSlacks()
1483  {
1484  assert(m_postsolved);
1485  return m_slack;
1486  }
1487  /// returns a reference to the unsimplified reduced costs.
1488  virtual const Vector& unsimplifiedRedCost()
1489  {
1490  assert(m_postsolved);
1491  return m_redCost;
1492  }
1493  /// gets basis status for a single row.
1495  {
1496  assert(m_postsolved);
1497  return m_rBasisStat[i];
1498  }
1499  /// gets basis status for a single column.
1501  {
1502  assert(m_postsolved);
1503  return m_cBasisStat[j];
1504  }
1505  /// get optimal basis.
1506  virtual void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[], const int rowsSize = -1, const int colsSize = -1) const
1507  {
1508  assert(m_postsolved);
1509  assert(rowsSize < 0 || rowsSize >= m_rBasisStat.size());
1510  assert(colsSize < 0 || colsSize >= m_cBasisStat.size());
1511 
1512  for(int i = 0; i < m_rBasisStat.size(); ++i)
1513  rows[i] = m_rBasisStat[i];
1514 
1515  for(int j = 0; j < m_cBasisStat.size(); ++j)
1516  cols[j] = m_cBasisStat[j];
1517  }
1518  //@}
1519 
1520 private:
1521  //------------------------------------
1522  //**@name Types */
1523  //@{
1524  /// comparator for class SVector::Element: compare nonzeros according to value
1526  {
1527  public:
1529 
1530  int operator()(const SVector::Element& e1, const SVector::Element& e2) const
1531  {
1532  if (EQ(e1.val, e2.val))
1533  return 0;
1534  if (e1.val < e2.val)
1535  return -1;
1536  else // (e1.val > e2.val)
1537  return 1;
1538  }
1539  };
1540  /// comparator for class SVector::Element: compare nonzeros according to index
1541  struct IdxCompare
1542  {
1543  public:
1545 
1546  int operator()(const SVector::Element& e1, const SVector::Element& e2) const
1547  {
1548  if (EQ(e1.idx, e2.idx))
1549  return 0;
1550  if (e1.idx < e2.idx)
1551  return -1;
1552  else // (e1.idx > e2.idx)
1553  return 1;
1554  }
1555  };
1556  //@}
1557 };
1558 
1559 } // namespace soplex
1560 #endif // _SPXMAINSM_H_
const VectorBase< R > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:219
DVector m_prim
unsimplified primal solution vector.
Definition: spxmainsm.h:1205
bool isNotZero(Real a, Real eps=Param::epsilon())
returns true iff |a| > eps
Definition: spxdefines.h:422
Real m_opttol
dual feasibility tolerance.
Definition: spxmainsm.h:1221
virtual bool isUnsimplified() const
specifies whether an optimal solution has already been unsimplified.
Definition: spxmainsm.h:1465
DataArray< PostStep * > m_hist
vector of presolve history.
Definition: spxmainsm.h:1213
Postsolves multi aggregation.
Definition: spxmainsm.h:1043
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
Definition: exceptions.h:109
RowObjPS & operator=(const RowObjPS &rhs)
assignment operator
Definition: spxmainsm.h:155
virtual void removeRow(int i)
Removes i &#39;th row.
Definition: spxlpbase.h:904
MultiAggregationPS(const MultiAggregationPS &old)
copy constructor
Definition: spxmainsm.h:1080
free variable fixed to zero.
Definition: spxsolver.h:194
friend class FreeConstraintPS
Definition: spxmainsm.h:1162
Result removeRowSingleton(SPxLP &lp, const SVector &row, int &i)
remove row singletons.
Definition: spxmainsm.cpp:2006
DataArray< int > m_stat
preprocessing history.
Definition: spxmainsm.h:1222
EmptyConstraintPS(const SPxLP &lp, int _i)
Definition: spxmainsm.h:238
ZeroObjColSingletonPS & operator=(const ZeroObjColSingletonPS &rhs)
assignment operator
Definition: spxmainsm.h:692
PostStep & operator=(const PostStep &)
assignment operator
Definition: spxmainsm.h:97
SPxMainSM(Timer::TYPE ttype=Timer::USER_TIME)
default constructor.
Definition: spxmainsm.h:1329
const VectorBase< R > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:456
#define DEFAULT_BND_VIOL
default allowed bound violation
Definition: spxdefines.h:226
Real m_epsilon
epsilon zero.
Definition: spxmainsm.h:1219
THREADLOCAL const Real infinity
Definition: spxdefines.cpp:26
Postsolves variable bound fixing.
Definition: spxmainsm.h:512
Result
Result of the simplification.
Definition: spxsimplifier.h:81
Postsolves duplicate rows.
Definition: spxmainsm.h:882
int size() const
Number of used indices.
Definition: svectorbase.h:152
const char * m_name
name of the simplifier
Definition: spxmainsm.h:77
FixVariablePS(const FixVariablePS &old)
copy constructor
Definition: spxmainsm.h:477
void computeMinMaxResidualActivity(SPxLP &lp, int rowNumber, int colNumber, Real &minAct, Real &maxAct)
computes the minimum and maximum residual activity for a given row and column. If colNumber is set to...
Definition: spxmainsm.cpp:1606
Real m_feastol
primal feasibility tolerance.
Definition: spxmainsm.h:1220
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:267
DataArray< SPxSolver::VarStatus > m_rBasisStat
basis status of rows.
Definition: spxmainsm.h:1210
Exception classes for SoPlex.
SPxMainSM & operator=(const SPxMainSM &rhs)
assignment operator
Definition: spxmainsm.h:1377
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:169
FreeZeroObjVariablePS(const SPxLP &lp, int _j, bool loFree, SVector col_idx_sorted)
Definition: spxmainsm.h:585
Real opttol() const
Definition: spxmainsm.h:1317
SPxLP::SPxSense m_thesense
optimization sense.
Definition: spxmainsm.h:1223
virtual void execute(DVector &x, DVector &y, DVector &s, DVector &r, DataArray< SPxSolver::VarStatus > &cBasis, DataArray< SPxSolver::VarStatus > &rBasis, bool isOptimal) const =0
executes the postsolving.
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
virtual Result simplify(SPxLP &lp, Real eps, Real delta)
simplify SPxLP lp with identical primal and dual feasibility tolerance.
Definition: spxmainsm.h:1447
friend class DuplicateRowsPS
Definition: spxmainsm.h:1172
PostStep(const PostStep &old)
copy constructor.
Definition: spxmainsm.h:91
FixVariablePS(const SPxLP &lp, SPxMainSM &simplifier, int _j, const Real val, bool correctIdx=true)
Definition: spxmainsm.h:463
int cIdx(int j) const
returns for a given column index of the (reduced) LP the corresponding column index in the unsimplifi...
Definition: spxmainsm.h:1302
void clear()
remove all elements.
Definition: dataarray.h:205
FixBoundsPS & operator=(const FixBoundsPS &rhs)
assignment operator
Definition: spxmainsm.h:544
variable fixed to identical bounds.
Definition: spxsolver.h:193
RowSingletonPS & operator=(const RowSingletonPS &rhs)
assignment operator
Definition: spxmainsm.h:336
Base class for postsolving operations.Class PostStep is an abstract base class providing the interfac...
Definition: spxmainsm.h:73
DVector m_dual
unsimplified dual solution vector.
Definition: spxmainsm.h:1207
virtual const Vector & unsimplifiedDual()
returns a reference to the unsimplified dual solution.
Definition: spxmainsm.h:1476
FreeConstraintPS(const FreeConstraintPS &old)
copy constructor
Definition: spxmainsm.h:196
virtual void removeCol(int i)
Removes i &#39;th column.
Definition: spxlpbase.h:1001
R & value(int n)
Reference to value of n &#39;th nonzero.
Definition: svectorbase.h:252
DuplicateRowsPS & operator=(const DuplicateRowsPS &rhs)
assignment operator
Definition: spxmainsm.h:949
Postsolves empty constraints.
Definition: spxmainsm.h:229
PostStep(const char *p_name, int nR=0, int nC=0)
constructor.
Definition: spxmainsm.h:85
FreeColSingletonPS(const FreeColSingletonPS &old)
copy constructor
Definition: spxmainsm.h:748
Real feastol() const
Definition: spxmainsm.h:1312
void handleExtremes(SPxLP &lp)
handles extreme values by setting them to zero or infinity.
Definition: spxmainsm.cpp:1408
bool m_postsolved
status of postsolving.
Definition: spxmainsm.h:1218
virtual SPxSolver::VarStatus getBasisRowStatus(int i) const
gets basis status for a single row.
Definition: spxmainsm.h:1494
int rIdx(int i) const
returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP...
Definition: spxmainsm.h:1297
virtual void unsimplify(const Vector &x, const Vector &y, const Vector &s, const Vector &r, const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[], bool isOptimal=true)
reconstructs an optimal solution for the unsimplified LP.
Definition: spxmainsm.cpp:4682
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1108
FreeColSingletonPS(const SPxLP &lp, SPxMainSM &simplifier, int _j, int _i, Real slackVal)
Definition: spxmainsm.h:732
ZeroObjColSingletonPS(const SPxLP &lp, const SPxMainSM &, int _j, int _i)
Definition: spxmainsm.h:668
int idx
Index of nonzero element.
Definition: svectorbase.h:40
LP simplification base class.
void fixColumn(SPxLP &lp, int i, bool correctIdx=true)
handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated...
Definition: spxmainsm.cpp:4376
FreeZeroObjVariablePS & operator=(const FreeZeroObjVariablePS &rhs)
assignment operator
Definition: spxmainsm.h:626
virtual void addObjoffset(const Real val)
add objective offset.
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:151
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
Definition: dsvectorbase.h:216
void spx_alloc(T &p, int n=1)
Allocate memory.
Definition: spxalloc.h:48
simplification could be done
Definition: spxsimplifier.h:83
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:555
MultiAggregationPS(const SPxLP &lp, SPxMainSM &simplifier, int _i, int _j, Real constant)
Definition: spxmainsm.h:1061
Postsolves the case when constraints are removed due to a variable with zero objective that is free i...
Definition: spxmainsm.h:570
virtual const char * getName() const
get name of simplifying step.
Definition: spxmainsm.h:107
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:640
friend class RowSingletonPS
Definition: spxmainsm.h:1164
EmptyConstraintPS(const EmptyConstraintPS &old)
copy constructor
Definition: spxmainsm.h:245
SPxSimplifier & operator=(const SPxSimplifier &rhs)
assignment operator
SPxSense
Optimization sense.
Definition: spxlpbase.h:97
TightenBoundsPS & operator=(const TightenBoundsPS &rhs)
assignment operator
Definition: spxmainsm.h:1146
virtual ~PostStep()
destructor.
Definition: spxmainsm.h:102
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:500
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:868
double Real
Definition: spxdefines.h:218
SPxSolver::VarStatus m_status
Definition: spxmainsm.h:516
Array< DSVector > m_classSetCols
stores parallel classes with non-zero row entry
Definition: spxmainsm.h:1215
RowSingletonPS(const RowSingletonPS &old)
copy constructor
Definition: spxmainsm.h:317
FreeConstraintPS(const SPxLP &lp, int _i)
Definition: spxmainsm.h:188
Result duplicateCols(SPxLP &lp, bool &again)
removes duplicate columns
Definition: spxmainsm.cpp:4000
void removeCol(SPxLP &lp, int j)
removes a column in the LP.
Definition: spxmainsm.h:1291
int nRows
number of rows
Definition: spxmainsm.h:81
TightenBoundsPS(const SPxLP &lp, int j, Real origupper, Real origlower)
Definition: spxmainsm.h:1131
SPxSense spxSense() const
Returns the optimization sense.
Definition: spxlpbase.h:510
int & index(int n)
Reference to index of n &#39;th nonzero.
Definition: svectorbase.h:234
Postsolves row singletons.
Definition: spxmainsm.h:276
MultiAggregationPS & operator=(const MultiAggregationPS &rhs)
assignment operator
Definition: spxmainsm.h:1096
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:703
Result simplifyRows(SPxLP &lp, bool &again)
performs simplification steps on the rows of the LP.
Definition: spxmainsm.cpp:2079
virtual void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get optimal basis.
Definition: spxmainsm.h:1506
DuplicateColsPS & operator=(const DuplicateColsPS &rhs)
assignment operator
Definition: spxmainsm.h:1020
LP simplification abstract base class.Instances of classes derived from SPxSimplifier may be loaded t...
Definition: spxsimplifier.h:41
bool checkSolution(SPxLP &lp, DVector sol)
checks a solution for feasibility
Definition: spxmainsm.cpp:1816
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:220
DuplicateColsPS(const SPxLP &lp, int _j, int _k, Real scale, DataArray< int > perm, bool isFirst=false, bool isTheLast=false)
Definition: spxmainsm.h:992
R rowObj(int i) const
Definition: spxlpbase.h:279
void append(const T &t)
append element t.
Definition: dataarray.h:121
friend class DoubletonEquationPS
Definition: spxmainsm.h:1171
SPxMainSM(const SPxMainSM &old)
copy constructor.
Definition: spxmainsm.h:1344
FixVariablePS & operator=(const FixVariablePS &rhs)
assignment operator
Definition: spxmainsm.h:489
ForceConstraintPS(const SPxLP &lp, int _i, bool lhsFixed, DataArray< bool > &fixCols, DataArray< Real > &lo, DataArray< Real > &up)
Definition: spxmainsm.h:379
Postsolves doubleton equations combined with a column singleton.
Definition: spxmainsm.h:786
Postsolves free column singletons.
Definition: spxmainsm.h:717
ForceConstraintPS & operator=(const ForceConstraintPS &rhs)
assignment operator
Definition: spxmainsm.h:421
#define DEFAULT_EPS_ZERO
default allowed additive zero: 1.0 + EPS_ZERO == 1.0
Definition: spxdefines.h:230
comparator for class SVector::Element: compare nonzeros according to value
Definition: spxmainsm.h:1525
R obj(int i) const
Returns objective value of column i.
Definition: spxlpbase.h:403
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1151
const VectorBase< R > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:253
friend class FixBoundsPS
Definition: spxmainsm.h:1167
DataArray< int > m_cIdx
column index vector in original LP.
Definition: spxmainsm.h:1211
Result m_result
result of the simplification.
Definition: spxmainsm.h:1226
FixBoundsPS(const FixBoundsPS &old)
copy constructor
Definition: spxmainsm.h:538
DuplicateColsPS(const DuplicateColsPS &old)
copy constructor
Definition: spxmainsm.h:1006
virtual Result result() const
returns result status of the simplification
Definition: spxmainsm.h:1459
variable set to its upper bound.
Definition: spxsolver.h:191
DoubletonEquationPS(const SPxLP &lp, int _j, int _k, int _i, Real oldLo, Real oldUp)
Definition: spxmainsm.h:811
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:347
DuplicateRowsPS(const DuplicateRowsPS &old)
copy constructor
Definition: spxmainsm.h:931
DoubletonEquationPS(const DoubletonEquationPS &old)
copy constructor
Definition: spxmainsm.h:834
variable set to its lower bound.
Definition: spxsolver.h:192
Array< DSVector > m_dupCols
arrange duplicate columns w.r.t. their pClass values
Definition: spxmainsm.h:1217
virtual PostStep * clone() const =0
clone function for polymorphism
Debugging, floating point type and parameter definitions.
Postsolves row objectives.
Definition: spxmainsm.h:135
bool EQ(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| <= eps
Definition: spxdefines.h:380
DataArray< int > m_rIdx
row index vector in original LP.
Definition: spxmainsm.h:1212
Postsolves column singletons with zero objective.
Definition: spxmainsm.h:654
TightenBoundsPS(const TightenBoundsPS &old)
copy constructor
Definition: spxmainsm.h:1139
bool m_keepbounds
keep some bounds (for boundflipping)
Definition: spxmainsm.h:1224
Everything should be within this namespace.
TYPE
types of timers
Definition: timer.h:99
bool EQrel(Real a, Real b, Real eps=Param::epsilon())
returns true iff |relDiff(a,b)| <= eps
Definition: spxdefines.h:428
virtual bool checkBasisDim(DataArray< SPxSolver::VarStatus > rows, DataArray< SPxSolver::VarStatus > cols) const
Definition: spxmainsm.cpp:66
friend class ForceConstraintPS
Definition: spxmainsm.h:1165
void handleRowObjectives(SPxLP &lp)
handle row objectives
Definition: spxmainsm.cpp:1391
RowSingletonPS(const SPxLP &lp, int _i, int _j, bool strictLo, bool strictUp, Real newLo, Real newUp, Real oldLo, Real oldUp)
Definition: spxmainsm.h:297
DuplicateRowsPS(const SPxLP &lp, int _i, int maxLhsIdx, int minRhsIdx, const DSVector &dupRows, const DataArray< Real > scale, const DataArray< int > perm, const DataArray< bool > isLhsEqualRhs, bool isTheLast, bool isFixedRow, bool isFirst=false)
Definition: spxmainsm.h:901
virtual ~SPxMainSM()
destructor.
Definition: spxmainsm.h:1424
Result duplicateRows(SPxLP &lp, bool &again)
removes duplicate rows.
Definition: spxmainsm.cpp:3646
Real m_cutoffbound
the cutoff bound that is found by heuristics
Definition: spxmainsm.h:1227
DSVector m_col
does the index mapping have to be updated in postsolving?
Definition: spxmainsm.h:459
Result multiaggregation(SPxLP &lp, bool &again)
performs multi-aggregations of variable based upon constraint activitu.
Definition: spxmainsm.cpp:3402
Save arrays of arbitrary types.
friend class DuplicateColsPS
Definition: spxmainsm.h:1173
FreeZeroObjVariablePS(const FreeZeroObjVariablePS &old)
copy constructor
Definition: spxmainsm.h:613
const SVectorBase< R > & rowVector(int i) const
Gets row vector of row i.
Definition: spxlpbase.h:204
comparator for class SVector::Element: compare nonzeros according to index
Definition: spxmainsm.h:1541
virtual const Vector & unsimplifiedPrimal()
returns a reference to the unsimplified primal solution.
Definition: spxmainsm.h:1470
FreeColSingletonPS & operator=(const FreeColSingletonPS &rhs)
assignment operator
Definition: spxmainsm.h:761
virtual const Vector & unsimplifiedRedCost()
returns a reference to the unsimplified reduced costs.
Definition: spxmainsm.h:1488
void trivialHeuristic(SPxLP &lp)
tries to find good lower bound solutions by applying some trivial heuristics
Definition: spxmainsm.cpp:1697
int m_j
slack column index
Definition: spxmainsm.h:139
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:437
Postsolves duplicate columns.
Definition: spxmainsm.h:977
DataArray< bool > m_isLhsEqualRhs
Definition: spxmainsm.h:898
virtual SPxSimplifier * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1437
SimpleStep
Different simplification steps.
Definition: spxmainsm.h:1180
Result removeEmpty(SPxLP &lp)
removed empty rows and empty columns.
Definition: spxmainsm.cpp:1898
int size() const
return nr. of elements.
Definition: dataarray.h:211
Postsolves forcing constraints.
Definition: spxmainsm.h:359
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:964
FixBoundsPS(const SPxLP &lp, int j, Real val)
Definition: spxmainsm.h:520
Result simplifyDual(SPxLP &lp, bool &again)
performs simplification steps on the LP based on dual concepts.
Definition: spxmainsm.cpp:3144
Postsolves unconstraint constraints.
Definition: spxmainsm.h:178
R val
Value of nonzero element.
Definition: svectorbase.h:39
Postsolves variable bound tightening from pseudo objective propagation.
Definition: spxmainsm.h:1122
const SVectorBase< R > & colVector(int i) const
Returns column vector of column i.
Definition: spxlpbase.h:373
Postsolves variable fixing.
Definition: spxmainsm.h:449
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:157
friend class FreeColSingletonPS
Definition: spxmainsm.h:1170
Real m_pseudoobj
the pseudo objective function value
Definition: spxmainsm.h:1228
friend class FreeZeroObjVariablePS
Definition: spxmainsm.h:1168
void computeMinMaxValues(SPxLP &lp, Real side, Real val, Real minRes, Real maxRes, Real &minVal, Real &maxVal)
calculate min/max value for the multi aggregated variables
Definition: spxmainsm.cpp:1664
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1030
int m_addedcols
columns added by handleRowObjectives()
Definition: spxmainsm.h:1225
virtual const Vector & unsimplifiedSlacks()
returns a reference to the unsimplified slack values.
Definition: spxmainsm.h:1482
friend class ZeroObjColSingletonPS
Definition: spxmainsm.h:1169
int operator()(const SVector::Element &e1, const SVector::Element &e2) const
Definition: spxmainsm.h:1546
void removeRow(SPxLP &lp, int i)
removes a row in the LP.
Definition: spxmainsm.h:1285
friend class EmptyConstraintPS
Definition: spxmainsm.h:1163
FreeConstraintPS & operator=(const FreeConstraintPS &rhs)
assignment operator
Definition: spxmainsm.h:204
int nCols
number of cols
Definition: spxmainsm.h:79
RowObjPS(const RowObjPS &old)
copy constructor
Definition: spxmainsm.h:149
RowObjPS(const SPxLP &lp, int _i, int _j)
Definition: spxmainsm.h:143
Result simplifyCols(SPxLP &lp, bool &again)
performs simplification steps on the columns of the LP.
Definition: spxmainsm.cpp:2615
Array< DSVector > m_dupRows
arrange duplicate rows using bucket sort w.r.t. their pClass values
Definition: spxmainsm.h:1216
EmptyConstraintPS & operator=(const EmptyConstraintPS &rhs)
assignment operator
Definition: spxmainsm.h:252
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:223
ZeroObjColSingletonPS(const ZeroObjColSingletonPS &old)
copy constructor
Definition: spxmainsm.h:680
DVector m_slack
unsimplified slack vector.
Definition: spxmainsm.h:1206
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
Definition: spxlpbase.h:483
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:109
virtual SPxSolver::VarStatus getBasisColStatus(int j) const
gets basis status for a single column.
Definition: spxmainsm.h:1500
DoubletonEquationPS & operator=(const DoubletonEquationPS &rhs)
assignment operator
Definition: spxmainsm.h:857
DataArray< SPxSolver::VarStatus > m_cBasisStat
basis status of columns.
Definition: spxmainsm.h:1209
void propagatePseudoobj(SPxLP &lp)
tightens variable bounds by propagating the pseudo objective function value.
Definition: spxmainsm.cpp:1836
LP simplifier for removing uneccessary row/columns.This SPxSimplifier is mainly based on the paper "P...
Definition: spxmainsm.h:60
Array< DSVector > m_classSetRows
stores parallel classes with non-zero colum entry
Definition: spxmainsm.h:1214
friend class FixVariablePS
Definition: spxmainsm.h:1166
Real epsZero() const
Definition: spxmainsm.h:1307
int operator()(const SVector::Element &e1, const SVector::Element &e2) const
Definition: spxmainsm.h:1530
DVector m_redCost
unsimplified reduced cost vector.
Definition: spxmainsm.h:1208
ForceConstraintPS(const ForceConstraintPS &old)
copy constructor
Definition: spxmainsm.h:403
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:772