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 "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 
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 aggregation.
1041  @ingroup Algo
1042  */
1043  class AggregationPS : public PostStep
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;
1055  const Real m_rhs;
1058 
1059  public:
1060  ///
1061  AggregationPS(const SPxLP& lp, int _i, int _j, Real rhs, Real oldupper, Real oldlower)
1062  : PostStep("Aggregation", 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_oldupper(oldupper)
1071  , m_oldlower(oldlower)
1072  , m_rhs(rhs)
1073  , m_row(lp.rowVector(_i))
1074  , m_col(lp.colVector(_j))
1075  {
1076  assert(m_row[m_j] != 0.0);
1077  }
1078  /// copy constructor
1080  : PostStep(old)
1081  , m_j(old.m_j)
1082  , m_i(old.m_i)
1083  , m_old_j(old.m_old_j)
1084  , m_old_i(old.m_old_i)
1085  , m_upper(old.m_upper)
1086  , m_lower(old.m_lower)
1087  , m_obj(old.m_obj)
1088  , m_oldupper(old.m_oldupper)
1089  , m_oldlower(old.m_oldlower)
1090  , m_rhs(old.m_rhs)
1091  , m_row(old.m_row)
1092  , m_col(old.m_col)
1093  {}
1094  /// assignment operator
1096  {
1097  if(this != &rhs)
1098  {
1099  PostStep::operator=(rhs);
1100  m_row = rhs.m_row;
1101  m_col = rhs.m_col;
1102  }
1103 
1104  return *this;
1105  }
1106  /// clone function for polymorphism
1107  inline virtual PostStep* clone() const
1108  {
1109  AggregationPS* AggregationPSptr = 0;
1110  spx_alloc(AggregationPSptr);
1111  return new (AggregationPSptr) AggregationPS(*this);
1112  }
1113  ///
1114  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1116  DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1117  };
1118 
1119  /**@brief Postsolves multi aggregation.
1120  @ingroup Algo
1121  */
1123  {
1124  private:
1125  const int m_j;
1126  const int m_i;
1127  const int m_old_j;
1128  const int m_old_i;
1129  const Real m_upper;
1130  const Real m_lower;
1131  const Real m_obj;
1132  const Real m_const;
1133  const bool m_onLhs;
1134  const bool m_eqCons;
1137 
1138  public:
1139  ///
1140  MultiAggregationPS(const SPxLP& lp, SPxMainSM& simplifier, int _i, int _j, Real constant)
1141  : PostStep("MultiAggregation", lp.nRows(), lp.nCols())
1142  , m_j(_j)
1143  , m_i(_i)
1144  , m_old_j(lp.nCols()-1)
1145  , m_old_i(lp.nRows()-1)
1146  , m_upper(lp.upper(_j))
1147  , m_lower(lp.lower(_j))
1148  , m_obj(lp.spxSense() == SPxLP::MINIMIZE ? lp.obj(_j) : -lp.obj(_j))
1149  , m_const(constant)
1150  , m_onLhs(EQ(constant, lp.lhs(_i)))
1151  , m_eqCons(EQ(lp.lhs(_i), lp.rhs(_i)))
1152  , m_row(lp.rowVector(_i))
1153  , m_col(lp.colVector(_j))
1154  {
1155  assert(m_row[m_j] != 0.0);
1156  simplifier.addObjoffset(m_obj*m_const/m_row[m_j]);
1157  }
1158  /// copy constructor
1160  : PostStep(old)
1161  , m_j(old.m_j)
1162  , m_i(old.m_i)
1163  , m_old_j(old.m_old_j)
1164  , m_old_i(old.m_old_i)
1165  , m_upper(old.m_upper)
1166  , m_lower(old.m_lower)
1167  , m_obj(old.m_obj)
1168  , m_const(old.m_const)
1169  , m_onLhs(old.m_onLhs)
1170  , m_eqCons(old.m_eqCons)
1171  , m_row(old.m_row)
1172  , m_col(old.m_col)
1173  {}
1174  /// assignment operator
1176  {
1177  if(this != &rhs)
1178  {
1179  PostStep::operator=(rhs);
1180  m_row = rhs.m_row;
1181  m_col = rhs.m_col;
1182  }
1183 
1184  return *this;
1185  }
1186  /// clone function for polymorphism
1187  inline virtual PostStep* clone() const
1188  {
1189  MultiAggregationPS* MultiAggregationPSptr = 0;
1190  spx_alloc(MultiAggregationPSptr);
1191  return new (MultiAggregationPSptr) MultiAggregationPS(*this);
1192  }
1193  ///
1194  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1195  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1196  };
1197 
1198  /**@brief Postsolves variable bound tightening from pseudo objective propagation.
1199  @ingroup Algo
1200  */
1201  class TightenBoundsPS : public PostStep
1202  {
1203  private:
1204  const int m_j;
1207 
1208  public:
1209  ///
1210  TightenBoundsPS(const SPxLP& lp, int j, Real origupper, Real origlower)
1211  : PostStep("TightenBounds", lp.nRows(), lp.nCols())
1212  , m_j(j)
1213  , m_origupper(origupper)
1214  , m_origlower(origlower)
1215  {
1216  }
1217  /// copy constructor
1219  : PostStep(old)
1220  , m_j(old.m_j)
1221  , m_origupper(old.m_origupper)
1222  , m_origlower(old.m_origlower)
1223  {}
1224  /// assignment operator
1226  {
1227  return *this;
1228  }
1229  /// clone function for polymorphism
1230  inline virtual PostStep* clone() const
1231  {
1232  TightenBoundsPS* TightenBoundsPSptr = 0;
1233  spx_alloc(TightenBoundsPSptr);
1234  return new (TightenBoundsPSptr) TightenBoundsPS(*this);
1235  }
1236  ///
1237  virtual void execute(DVector& x, DVector& y, DVector& s, DVector& r,
1238  DataArray<SPxSolver::VarStatus>& cBasis, DataArray<SPxSolver::VarStatus>& rBasis, bool isOptimal) const;
1239  };
1240  // friends
1241  friend class FreeConstraintPS;
1242  friend class EmptyConstraintPS;
1243  friend class RowSingletonPS;
1244  friend class ForceConstraintPS;
1245  friend class FixVariablePS;
1246  friend class FixBoundsPS;
1249  friend class FreeColSingletonPS;
1250  friend class DoubletonEquationPS;
1251  friend class DuplicateRowsPS;
1252  friend class DuplicateColsPS;
1253  friend class AggregationPS;
1254 
1255 private:
1256  //------------------------------------
1257  //**@name Types */
1258  //@{
1259  /// Different simplification steps.
1261  {
1267  FIX_COL = 5,
1279  };
1280  //@}
1281 
1282  //------------------------------------
1283  //**@name Data */
1284  //@{
1285  ///
1286  DVector m_prim; ///< unsimplified primal solution vector.
1287  DVector m_slack; ///< unsimplified slack vector.
1288  DVector m_dual; ///< unsimplified dual solution vector.
1289  DVector m_redCost; ///< unsimplified reduced cost vector.
1290  DataArray<SPxSolver::VarStatus> m_cBasisStat; ///< basis status of columns.
1291  DataArray<SPxSolver::VarStatus> m_rBasisStat; ///< basis status of rows.
1292  DataArray<int> m_cIdx; ///< column index vector in original LP.
1293  DataArray<int> m_rIdx; ///< row index vector in original LP.
1294  DataArray<PostStep*> m_hist; ///< vector of presolve history.
1295  Array<DSVector> m_classSetRows; ///< stores parallel classes with non-zero colum entry
1296  Array<DSVector> m_classSetCols; ///< stores parallel classes with non-zero row entry
1297  Array<DSVector> m_dupRows; ///< arrange duplicate rows using bucket sort w.r.t. their pClass values
1298  Array<DSVector> m_dupCols; ///< arrange duplicate columns w.r.t. their pClass values
1299  bool m_postsolved; ///< status of postsolving.
1300  Real m_epsilon; ///< epsilon zero.
1301  Real m_feastol; ///< primal feasibility tolerance.
1302  Real m_opttol; ///< dual feasibility tolerance.
1303  DataArray<int> m_stat; ///< preprocessing history.
1304  SPxLP::SPxSense m_thesense; ///< optimization sense.
1305  bool m_keepbounds; ///< keep some bounds (for boundflipping)
1306  int m_addedcols; ///< columns added by handleRowObjectives()
1307  Result m_result; ///< result of the simplification.
1308  Real m_cutoffbound; ///< the cutoff bound that is found by heuristics
1309  Real m_pseudoobj; ///< the pseudo objective function value
1310  //@}
1311 
1312 private:
1313  //------------------------------------
1314  //**@name Private helpers */
1315  //@{
1316  /// handle row objectives
1317  void handleRowObjectives(SPxLP& lp);
1318 
1319  /// handles extreme values by setting them to zero or infinity.
1320  void handleExtremes(SPxLP& lp);
1321 
1322  /// computes the minimum and maximum residual activity for a given row and column. If colNumber is set to -1, then
1323  // the activity of the row is returned.
1324  void computeMinMaxResidualActivity(SPxLP& lp, int rowNumber, int colNumber, Real& minAct, Real& maxAct);
1325 
1326  /// calculate min/max value for the multi aggregated variables
1327  void computeMinMaxValues(SPxLP& lp, Real side, Real val, Real minRes, Real maxRes, Real& minVal, Real& maxVal);
1328 
1329  /// tries to find good lower bound solutions by applying some trivial heuristics
1330  void trivialHeuristic(SPxLP& lp);
1331 
1332  /// checks a solution for feasibility
1333  bool checkSolution(SPxLP& lp, DVector sol);
1334 
1335  /// tightens variable bounds by propagating the pseudo objective function value.
1336  void propagatePseudoobj(SPxLP& lp);
1337 
1338  /// removed empty rows and empty columns.
1339  Result removeEmpty(SPxLP& lp);
1340 
1341  /// remove row singletons.
1342  Result removeRowSingleton(SPxLP& lp, const SVector& row, int& i);
1343 
1344  /// aggregate two variables that appear in an equation.
1345  Result aggregateVars(SPxLP& lp, const SVector& row, int& i);
1346 
1347  /// performs simplification steps on the rows of the LP.
1348  Result simplifyRows(SPxLP& lp, bool& again);
1349 
1350  /// performs simplification steps on the columns of the LP.
1351  Result simplifyCols(SPxLP& lp, bool& again);
1352 
1353  /// performs simplification steps on the LP based on dual concepts.
1354  Result simplifyDual(SPxLP& lp, bool& again);
1355 
1356  /// performs multi-aggregations of variable based upon constraint activitu.
1357  Result multiaggregation(SPxLP& lp, bool& again);
1358 
1359  /// removes duplicate rows.
1360  Result duplicateRows(SPxLP& lp, bool& again);
1361 
1362  /// removes duplicate columns
1363  Result duplicateCols(SPxLP& lp, bool& again);
1364 
1365  /// handles the fixing of a variable. correctIdx is true iff the index mapping has to be updated.
1366  void fixColumn(SPxLP& lp, int i, bool correctIdx = true);
1367 
1368  /// removes a row in the LP.
1369  void removeRow(SPxLP& lp, int i)
1370  {
1371  m_rIdx[i] = m_rIdx[lp.nRows()-1];
1372  lp.removeRow(i);
1373  }
1374  /// removes a column in the LP.
1375  void removeCol(SPxLP& lp, int j)
1376  {
1377  m_cIdx[j] = m_cIdx[lp.nCols()-1];
1378  lp.removeCol(j);
1379  }
1380  /// returns for a given row index of the (reduced) LP the corresponding row index in the unsimplified LP.
1381  int rIdx(int i) const
1382  {
1383  return m_rIdx[i];
1384  }
1385  /// returns for a given column index of the (reduced) LP the corresponding column index in the unsimplified LP.
1386  int cIdx(int j) const
1387  {
1388  return m_cIdx[j];
1389  }
1390  //@}
1391 
1392 protected:
1393 
1394  ///
1395  Real epsZero() const
1396  {
1397  return m_epsilon;
1398  }
1399  ///
1400  Real feastol() const
1401  {
1402  return m_feastol;
1403  }
1404  ///
1405  Real opttol() const
1406  {
1407  return m_opttol;
1408  }
1409 
1410 public:
1411 
1412  //------------------------------------
1413  //**@name Constructors / destructors */
1414  //@{
1415  /// default constructor.
1417  : SPxSimplifier("MainSM", ttype)
1418  , m_postsolved(0)
1419  , m_epsilon(DEFAULT_EPS_ZERO)
1420  , m_feastol(DEFAULT_BND_VIOL)
1421  , m_opttol(DEFAULT_BND_VIOL)
1422  , m_stat(16)
1423  , m_thesense(SPxLP::MAXIMIZE)
1424  , m_keepbounds(false)
1425  , m_addedcols(0)
1426  , m_result(OKAY)
1427  , m_cutoffbound(-infinity)
1428  , m_pseudoobj(-infinity)
1429  {}
1430  /// copy constructor.
1431  SPxMainSM(const SPxMainSM& old)
1432  : SPxSimplifier(old)
1433  , m_prim(old.m_prim)
1434  , m_slack(old.m_slack)
1435  , m_dual(old.m_dual)
1436  , m_redCost(old.m_redCost)
1437  , m_cBasisStat(old.m_cBasisStat)
1438  , m_rBasisStat(old.m_rBasisStat)
1439  , m_cIdx(old.m_cIdx)
1440  , m_rIdx(old.m_rIdx)
1441  , m_postsolved(old.m_postsolved)
1442  , m_epsilon(old.m_epsilon)
1443  , m_feastol(old.m_feastol)
1444  , m_opttol(old.m_opttol)
1445  , m_stat(old.m_stat)
1446  , m_thesense(old.m_thesense)
1447  , m_keepbounds(old.m_keepbounds)
1448  , m_addedcols(old.m_addedcols)
1449  , m_result(old.m_result)
1450  , m_cutoffbound(old.m_cutoffbound)
1451  , m_pseudoobj(old.m_pseudoobj)
1452  {
1453  // copy pointers in m_hist
1454  m_hist.reSize(0);
1455  for(int k = 0; k < old.m_hist.size(); ++k)
1456  {
1457  if(old.m_hist[k] != 0)
1458  m_hist.append(old.m_hist[k]->clone());
1459  else
1460  m_hist.append(0);
1461  }
1462  }
1463  /// assignment operator
1465  {
1466  if(this != &rhs)
1467  {
1469  m_prim = rhs.m_prim;
1470  m_slack = rhs.m_slack;
1471  m_dual = rhs.m_dual;
1472  m_redCost = rhs.m_redCost;
1473  m_cBasisStat = rhs.m_cBasisStat;
1474  m_rBasisStat = rhs.m_rBasisStat;
1475  m_cIdx = rhs.m_cIdx;
1476  m_rIdx = rhs.m_rIdx;
1477  m_postsolved = rhs.m_postsolved;
1478  m_epsilon = rhs.m_epsilon;
1479  m_feastol = rhs.m_feastol;
1480  m_opttol = rhs.m_opttol;
1481  m_stat = rhs.m_stat;
1482  m_thesense = rhs.m_thesense;
1483  m_keepbounds = rhs.m_keepbounds;
1484  m_addedcols = rhs.m_addedcols;
1485  m_result = rhs.m_result;
1486  m_cutoffbound = rhs.m_cutoffbound;
1487  m_pseudoobj = rhs.m_pseudoobj;
1488 
1489  // delete pointers in m_hist
1490  for(int k = 0; k < m_hist.size(); ++k)
1491  {
1492  m_hist[k]->~PostStep();
1493  spx_free(m_hist[k]);
1494  }
1495 
1496  m_hist.clear();
1497 
1498  // copy pointers in m_hist
1499  for(int k = 0; k < rhs.m_hist.size(); ++k)
1500  {
1501  if(rhs.m_hist[k] != 0)
1502  m_hist.append(rhs.m_hist[k]->clone());
1503  else
1504  m_hist.append(0);
1505  }
1506  }
1507 
1508  return *this;
1509  }
1510  /// destructor.
1511  virtual ~SPxMainSM()
1512  {
1513  // delete pointers in m_hist
1514  for(int k = 0; k < m_hist.size(); ++k)
1515  {
1516  if( m_hist[k] != 0 )
1517  {
1518  m_hist[k]->~PostStep();
1519  spx_free(m_hist[k]);
1520  }
1521  }
1522  }
1523  /// clone function for polymorphism
1524  inline virtual SPxSimplifier* clone() const
1525  {
1526  return new SPxMainSM(*this);
1527  }
1528  //@}
1529 
1530  //------------------------------------
1531  //**@name LP simplification */
1532  //@{
1533  /// simplify SPxLP \p lp with identical primal and dual feasibility tolerance.
1534  virtual Result simplify(SPxLP& lp, Real eps, Real delta)
1535  {
1536  return simplify(lp, eps, delta, delta);
1537  }
1538  /// simplify SPxLP \p lp with independent primal and dual feasibility tolerance.
1539  virtual Result simplify(SPxLP& lp, Real eps, Real ftol, Real otol, bool keepbounds = false);
1540 
1541  /// reconstructs an optimal solution for the unsimplified LP.
1542  virtual void unsimplify(const Vector& x, const Vector& y, const Vector& s, const Vector& r,
1543  const SPxSolver::VarStatus rows[], const SPxSolver::VarStatus cols[], bool isOptimal = true);
1544 
1545  /// returns result status of the simplification
1546  virtual Result result() const
1547  {
1548  return m_result;
1549  }
1550 
1551  /// specifies whether an optimal solution has already been unsimplified.
1552  virtual bool isUnsimplified() const
1553  {
1554  return m_postsolved;
1555  }
1556  /// returns a reference to the unsimplified primal solution.
1557  virtual const Vector& unsimplifiedPrimal()
1558  {
1559  assert(m_postsolved);
1560  return m_prim;
1561  }
1562  /// returns a reference to the unsimplified dual solution.
1563  virtual const Vector& unsimplifiedDual()
1564  {
1565  assert(m_postsolved);
1566  return m_dual;
1567  }
1568  /// returns a reference to the unsimplified slack values.
1569  virtual const Vector& unsimplifiedSlacks()
1570  {
1571  assert(m_postsolved);
1572  return m_slack;
1573  }
1574  /// returns a reference to the unsimplified reduced costs.
1575  virtual const Vector& unsimplifiedRedCost()
1576  {
1577  assert(m_postsolved);
1578  return m_redCost;
1579  }
1580  /// gets basis status for a single row.
1582  {
1583  assert(m_postsolved);
1584  return m_rBasisStat[i];
1585  }
1586  /// gets basis status for a single column.
1588  {
1589  assert(m_postsolved);
1590  return m_cBasisStat[j];
1591  }
1592  /// get optimal basis.
1593  virtual void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[], const int rowsSize = -1, const int colsSize = -1) const
1594  {
1595  assert(m_postsolved);
1596  assert(rowsSize < 0 || rowsSize >= m_rBasisStat.size());
1597  assert(colsSize < 0 || colsSize >= m_cBasisStat.size());
1598 
1599  for(int i = 0; i < m_rBasisStat.size(); ++i)
1600  rows[i] = m_rBasisStat[i];
1601 
1602  for(int j = 0; j < m_cBasisStat.size(); ++j)
1603  cols[j] = m_cBasisStat[j];
1604  }
1605  //@}
1606 
1607 private:
1608  //------------------------------------
1609  //**@name Types */
1610  //@{
1611  /// comparator for class SVector::Element: compare nonzeros according to value
1613  {
1614  public:
1616 
1617  int operator()(const SVector::Element& e1, const SVector::Element& e2) const
1618  {
1619  if (EQ(e1.val, e2.val))
1620  return 0;
1621  if (e1.val < e2.val)
1622  return -1;
1623  else // (e1.val > e2.val)
1624  return 1;
1625  }
1626  };
1627  /// comparator for class SVector::Element: compare nonzeros according to index
1628  struct IdxCompare
1629  {
1630  public:
1632 
1633  int operator()(const SVector::Element& e1, const SVector::Element& e2) const
1634  {
1635  if (EQ(e1.idx, e2.idx))
1636  return 0;
1637  if (e1.idx < e2.idx)
1638  return -1;
1639  else // (e1.idx > e2.idx)
1640  return 1;
1641  }
1642  };
1643  //@}
1644 };
1645 
1646 } // namespace soplex
1647 #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:1286
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:1302
virtual bool isUnsimplified() const
specifies whether an optimal solution has already been unsimplified.
Definition: spxmainsm.h:1552
DataArray< PostStep * > m_hist
vector of presolve history.
Definition: spxmainsm.h:1294
Postsolves multi aggregation.
Definition: spxmainsm.h:1122
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:1159
free variable fixed to zero.
Definition: spxsolver.h:193
friend class FreeConstraintPS
Definition: spxmainsm.h:1241
Result removeRowSingleton(SPxLP &lp, const SVector &row, int &i)
remove row singletons.
Definition: spxmainsm.cpp:2108
DataArray< int > m_stat
preprocessing history.
Definition: spxmainsm.h:1303
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:1416
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:1300
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
AggregationPS & operator=(const AggregationPS &rhs)
assignment operator
Definition: spxmainsm.h:1095
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:1708
Real m_feastol
primal feasibility tolerance.
Definition: spxmainsm.h:1301
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:267
DataArray< SPxSolver::VarStatus > m_rBasisStat
basis status of rows.
Definition: spxmainsm.h:1291
Exception classes for SoPlex.
SPxMainSM & operator=(const SPxMainSM &rhs)
assignment operator
Definition: spxmainsm.h:1464
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:1405
SPxLP::SPxSense m_thesense
optimization sense.
Definition: spxmainsm.h:1304
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:1534
friend class DuplicateRowsPS
Definition: spxmainsm.h:1251
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:1386
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:192
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:1288
virtual const Vector & unsimplifiedDual()
returns a reference to the unsimplified dual solution.
Definition: spxmainsm.h:1563
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:1400
void handleExtremes(SPxLP &lp)
handles extreme values by setting them to zero or infinity.
Definition: spxmainsm.cpp:1510
bool m_postsolved
status of postsolving.
Definition: spxmainsm.h:1299
virtual SPxSolver::VarStatus getBasisRowStatus(int i) const
gets basis status for a single row.
Definition: spxmainsm.h:1581
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:1381
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:5039
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1187
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:4710
FreeZeroObjVariablePS & operator=(const FreeZeroObjVariablePS &rhs)
assignment operator
Definition: spxmainsm.h:626
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1107
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:1140
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:1243
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:1225
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:1296
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:4334
void removeCol(SPxLP &lp, int j)
removes a column in the LP.
Definition: spxmainsm.h:1375
int nRows
number of rows
Definition: spxmainsm.h:81
TightenBoundsPS(const SPxLP &lp, int j, Real origupper, Real origlower)
Definition: spxmainsm.h:1210
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:1175
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:2405
virtual void getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get optimal basis.
Definition: spxmainsm.h:1593
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:1918
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:1250
SPxMainSM(const SPxMainSM &old)
copy constructor.
Definition: spxmainsm.h:1431
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:1612
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:1230
const VectorBase< R > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:253
friend class FixBoundsPS
Definition: spxmainsm.h:1246
DataArray< int > m_cIdx
column index vector in original LP.
Definition: spxmainsm.h:1292
Result m_result
result of the simplification.
Definition: spxmainsm.h:1307
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:1546
variable set to its upper bound.
Definition: spxsolver.h:190
AggregationPS(const SPxLP &lp, int _i, int _j, Real rhs, Real oldupper, Real oldlower)
Definition: spxmainsm.h:1061
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:191
Array< DSVector > m_dupCols
arrange duplicate columns w.r.t. their pClass values
Definition: spxmainsm.h:1298
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:376
DataArray< int > m_rIdx
row index vector in original LP.
Definition: spxmainsm.h:1293
Postsolves column singletons with zero objective.
Definition: spxmainsm.h:654
TightenBoundsPS(const TightenBoundsPS &old)
copy constructor
Definition: spxmainsm.h:1218
bool m_keepbounds
keep some bounds (for boundflipping)
Definition: spxmainsm.h:1305
Everything should be within this namespace.
AggregationPS(const AggregationPS &old)
copy constructor
Definition: spxmainsm.h:1079
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:1244
void handleRowObjectives(SPxLP &lp)
handle row objectives
Definition: spxmainsm.cpp:1493
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:1511
Result aggregateVars(SPxLP &lp, const SVector &row, int &i)
aggregate two variables that appear in an equation.
Definition: spxmainsm.cpp:2182
Result duplicateRows(SPxLP &lp, bool &again)
removes duplicate rows.
Definition: spxmainsm.cpp:3980
Real m_cutoffbound
the cutoff bound that is found by heuristics
Definition: spxmainsm.h:1308
friend class AggregationPS
Definition: spxmainsm.h:1253
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:3738
Save arrays of arbitrary types.
friend class DuplicateColsPS
Definition: spxmainsm.h:1252
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:1628
virtual const Vector & unsimplifiedPrimal()
returns a reference to the unsimplified primal solution.
Definition: spxmainsm.h:1557
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:1575
void trivialHeuristic(SPxLP &lp)
tries to find good lower bound solutions by applying some trivial heuristics
Definition: spxmainsm.cpp:1799
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:1524
SimpleStep
Different simplification steps.
Definition: spxmainsm.h:1260
Result removeEmpty(SPxLP &lp)
removed empty rows and empty columns.
Definition: spxmainsm.cpp:2000
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:3480
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:1201
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:1249
Real m_pseudoobj
the pseudo objective function value
Definition: spxmainsm.h:1309
Postsolves aggregation.
Definition: spxmainsm.h:1043
friend class FreeZeroObjVariablePS
Definition: spxmainsm.h:1247
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:1766
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:1030
int m_addedcols
columns added by handleRowObjectives()
Definition: spxmainsm.h:1306
virtual const Vector & unsimplifiedSlacks()
returns a reference to the unsimplified slack values.
Definition: spxmainsm.h:1569
friend class ZeroObjColSingletonPS
Definition: spxmainsm.h:1248
int operator()(const SVector::Element &e1, const SVector::Element &e2) const
Definition: spxmainsm.h:1633
void removeRow(SPxLP &lp, int i)
removes a row in the LP.
Definition: spxmainsm.h:1369
friend class EmptyConstraintPS
Definition: spxmainsm.h:1242
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:2951
Array< DSVector > m_dupRows
arrange duplicate rows using bucket sort w.r.t. their pClass values
Definition: spxmainsm.h:1297
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:1287
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:1587
DoubletonEquationPS & operator=(const DoubletonEquationPS &rhs)
assignment operator
Definition: spxmainsm.h:857
DataArray< SPxSolver::VarStatus > m_cBasisStat
basis status of columns.
Definition: spxmainsm.h:1290
void propagatePseudoobj(SPxLP &lp)
tightens variable bounds by propagating the pseudo objective function value.
Definition: spxmainsm.cpp:1938
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:1295
friend class FixVariablePS
Definition: spxmainsm.h:1245
Real epsZero() const
Definition: spxmainsm.h:1395
int operator()(const SVector::Element &e1, const SVector::Element &e2) const
Definition: spxmainsm.h:1617
DVector m_redCost
unsimplified reduced cost vector.
Definition: spxmainsm.h:1289
ForceConstraintPS(const ForceConstraintPS &old)
copy constructor
Definition: spxmainsm.h:403
virtual PostStep * clone() const
clone function for polymorphism
Definition: spxmainsm.h:772