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