Scippy

SoPlex

Sequential object-oriented simPlex

spxautopr.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file spxautopr.h
17  * @brief Auto pricer.
18  */
19 #ifndef _SPXAUTOPR_H_
20 #define _SPXAUTOPR_H_
21 
22 #include <assert.h>
23 
24 #include "spxpricer.h"
25 #include "spxdevexpr.h"
26 #include "spxsteeppr.h"
27 #include "spxsteepexpr.h"
28 
29 
30 namespace soplex
31 {
32 
33 /**@brief Auto pricer.
34  @ingroup Algo
35 
36  This pricer switches between Devex and Steepest edge pricer based on the difficulty of the problem
37  which is determined by the number of iterations.
38 
39  See SPxPricer for a class documentation.
40 */
41 class SPxAutoPR : public SPxPricer
42 {
43 private:
44 
45  int switchIters; ///< number of iterations before switching pricers
46  SPxPricer* activepricer; ///< pointer to currently selected pricer
47  SPxDevexPR devex; ///< internal Devex pricer
48  SPxSteepExPR steep; ///< internal Steepest edge pricer
49 
50  bool setActivePricer(SPxSolver::Type type); ///< switches active pricing method
51 
52 public:
53 
54  //-------------------------------------
55  /**@name Constructors / destructors */
56  //@{
57  /// default constructor
59  : SPxPricer("Auto")
60  , switchIters(10000)
61  , activepricer(&devex)
62  , devex()
63  , steep()
64  {}
65  /// copy constructor
66  SPxAutoPR(const SPxAutoPR& old )
67  : SPxPricer(old)
68  , switchIters(old.switchIters)
69  , devex(old.devex)
70  , steep(old.steep)
71  {
72  assert(old.activepricer == &old.devex || old.activepricer == &old.steep);
73  if( old.activepricer == &old.devex )
74  activepricer = &devex;
75  else
76  activepricer = &steep;
77  }
78  /// assignment operator
80  {
81  if(this != &rhs)
82  {
84  switchIters = rhs.switchIters;
85  devex = rhs.devex;
86  steep = rhs.steep;
87 
88  assert(rhs.activepricer == &rhs.devex || rhs.activepricer == &rhs.steep);
89  if( rhs.activepricer == &rhs.devex )
90  activepricer = &devex;
91  else
92  activepricer = &steep;
93  }
94 
95  return *this;
96  }
97  /// destructor
98  virtual ~SPxAutoPR()
99  {}
100  /// clone function for polymorphism
101  inline virtual SPxPricer* clone() const
102  {
103  return new SPxAutoPR(*this);
104  }
105  //@}
106 
107  //-------------------------------------
108  /**@name Access / modification */
109  //@{
110  /// set max number of iterations before switching pricers
111  void setSwitchIters(int iters);
112  /// clear the data
113  void clear();
114  /// set epsilon of internal pricers
115  void setEpsilon(Real eps);
116  /// set the solver
117  virtual void load(SPxSolver* base);
118  /// set entering/leaving algorithm
119  virtual void setType(SPxSolver::Type);
120  /// set row/column representation
121  virtual void setRep(SPxSolver::Representation);
122  ///
123  virtual int selectLeave();
124  ///
125  virtual SPxId selectEnter();
126  ///
127  virtual void left4(int n, SPxId id);
128  ///
129  virtual void entered4(SPxId id, int n);
130  //@}
131 };
132 } // namespace soplex
133 #endif // _SPXAUTOPR_H_
void clear()
clear the data
Definition: spxautopr.cpp:33
SPxSteepExPR steep
internal Steepest edge pricer
Definition: spxautopr.h:48
void setSwitchIters(int iters)
set max number of iterations before switching pricers
virtual SPxPricer * clone() const
clone function for polymorphism
Definition: spxautopr.h:101
Devex pricer.The Devex Pricer for SoPlex implements an approximate steepest edge pricing, that does without solving an extra linear system and computing the scalar products.
Definition: spxdevexpr.h:43
Type
Algorithmic type.
Definition: spxsolver.h:124
Steepest edge pricer.Class SPxSteepExPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteepexpr.h:40
virtual void load(SPxSolver *base)
set the solver
Definition: spxautopr.cpp:25
Abstract pricer base class.
virtual void setType(SPxSolver::Type)
set entering/leaving algorithm
Definition: spxautopr.cpp:47
Representation
LP basis representation.
Definition: spxsolver.h:105
int switchIters
number of iterations before switching pricers
Definition: spxautopr.h:45
SPxAutoPR()
default constructor
Definition: spxautopr.h:58
SPxPricer & operator=(const SPxPricer &rhs)
assignment operator
Definition: spxpricer.h:382
Auto pricer.This pricer switches between Devex and Steepest edge pricer based on the difficulty of th...
Definition: spxautopr.h:41
Devex pricer.
virtual SPxId selectEnter()
Definition: spxautopr.cpp:92
virtual void entered4(SPxId id, int n)
Definition: spxautopr.cpp:100
Steepest edge pricer.
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
virtual int selectLeave()
Definition: spxautopr.cpp:79
SPxDevexPR devex
internal Devex pricer
Definition: spxautopr.h:47
double Real
Definition: spxdefines.h:215
virtual void left4(int n, SPxId id)
Definition: spxautopr.cpp:87
void setEpsilon(Real eps)
set epsilon of internal pricers
Definition: spxautopr.cpp:40
virtual ~SPxAutoPR()
destructor
Definition: spxautopr.h:98
Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer ...
Definition: spxpricer.h:46
SPxPricer * activepricer
pointer to currently selected pricer
Definition: spxautopr.h:46
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
virtual void setRep(SPxSolver::Representation)
set row/column representation
Definition: spxautopr.cpp:52
Everything should be within this namespace.
Steepest edge pricer with exact initialization of weights.
SPxAutoPR(const SPxAutoPR &old)
copy constructor
Definition: spxautopr.h:66
bool setActivePricer(SPxSolver::Type type)
switches active pricing method
Definition: spxautopr.cpp:58
SPxAutoPR & operator=(const SPxAutoPR &rhs)
assignment operator
Definition: spxautopr.h:79