Scippy

SoPlex

Sequential object-oriented simPlex

spxhybridpr.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-2015 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 spxhybridpr.h
17  * @brief Hybrid pricer.
18  */
19 #ifndef _SPXHYBRIDPR_H_
20 #define _SPXHYBRIDPR_H_
21 
22 #include <assert.h>
23 
24 #include "spxdefines.h"
25 #include "spxpricer.h"
26 #include "spxdevexpr.h"
27 #include "spxparmultpr.h"
28 #include "spxsteeppr.h"
29 
30 namespace soplex
31 {
32 
33 /**@brief Hybrid pricer.
34  @ingroup Algo
35 
36  The hybrid pricer for SoPlex tries to guess the best pricing strategy to
37  use for pricing the loaded LP with the loaded algorithm type and basis
38  representation. Currently it does so by switching between SPxSteepPR,
39  SPxDevexPR and SPxParMultPR.
40 
41  See SPxPricer for a class documentation.
42 */
43 class SPxHybridPR : public SPxPricer
44 {
45  //-------------------------------------
46  /**@name Data */
47  //@{
48  /// steepest edge pricer
50  /// partial multiple pricer
52  /// devex pricer
54  /// the currently used pricer
56  /// factor between dim and coDim of the problem to decide about the pricer
58  //@}
59 
60 public:
61 
62  //-------------------------------------
63  /**@name Access / modification */
64  //@{
65  /// sets the epsilon
66  virtual void setEpsilon(Real eps);
67  /// sets the solver
68  virtual void load(SPxSolver* solver);
69  /// clears all pricers and unselects the current pricer
70  virtual void clear();
71  /// sets entering or leaving algorithm
72  virtual void setType(SPxSolver::Type tp);
73  /// sets row or column representation
74  virtual void setRep(SPxSolver::Representation rep);
75  /// selects the leaving algorithm
76  virtual int selectLeave();
77  /// selects the entering algorithm
78  virtual SPxId selectEnter();
79  /// calls left4 on the current pricer
80  virtual void left4(int n, SPxId id);
81  /// calls entered4 on the current pricer
82  virtual void entered4(SPxId id, int n);
83  /// calls addedVecs(n) on all pricers
84  virtual void addedVecs (int n);
85  /// calls addedCoVecs(n) on all pricers
86  virtual void addedCoVecs (int n);
87  //@}
88 
89  //-------------------------------------
90  /**@name Consistency check */
91  //@{
92  /// consistency check
93  virtual bool isConsistent() const;
94  //@}
95 
96  //-------------------------------------
97  /**@name Construction / destruction */
98  //@{
99  /// default constructor
101  : SPxPricer("Hybrid")
102  , thepricer(0)
103  , hybridFactor(3.0) // we want the ParMult pricer
104  {}
105  /// copy constructor
107  : SPxPricer(old)
108  , steep(old.steep)
109  , parmult(old.parmult)
110  , devex(old.devex)
112  {
113  if(old.thepricer == &old.steep)
114  {
115  thepricer = &steep;
116  }
117  else if(old.thepricer == &old.parmult)
118  {
119  thepricer = &parmult;
120  }
121  else if(old.thepricer == &old.devex)
122  {
123  thepricer = &devex;
124  }
125  else // old.thepricer should be 0
126  {
127  thepricer = 0;
128  }
129  }
130  /// assignment operator
132  {
133  if(this != &rhs)
134  {
136  steep = rhs.steep;
137  parmult = rhs.parmult;
138  devex = rhs.devex;
140  if(rhs.thepricer == &rhs.steep)
141  {
142  thepricer = &steep;
143  }
144  else if(rhs.thepricer == &rhs.parmult)
145  {
146  thepricer = &parmult;
147  }
148  else if(rhs.thepricer == &rhs.devex)
149  {
150  thepricer = &devex;
151  }
152  else // rhs.thepricer should be 0
153  {
154  thepricer = 0;
155  }
156  }
157 
158  return *this;
159  }
160  /// destructor
161  virtual ~SPxHybridPR()
162  {}
163  /// clone function for polymorphism
164  inline virtual SPxPricer* clone() const
165  {
166  return new SPxHybridPR(*this);
167  }
168  //@}
169 };
170 
171 } // namespace soplex
172 #endif // _SPXHYBRIDPR_H_