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-2016 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)
111  , hybridFactor(old.hybridFactor)
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;
139  hybridFactor = rhs.hybridFactor;
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_
SPxSteepPR steep
steepest edge pricer
Definition: spxhybridpr.h:49
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
SPxHybridPR & operator=(const SPxHybridPR &rhs)
assignment operator
Definition: spxhybridpr.h:131
Abstract pricer base class.
Representation
LP basis representation.
Definition: spxsolver.h:105
SPxPricer & operator=(const SPxPricer &rhs)
assignment operator
Definition: spxpricer.h:382
virtual void entered4(SPxId id, int n)
calls entered4 on the current pricer
SPxDevexPR devex
devex pricer
Definition: spxhybridpr.h:53
Devex pricer.
Partial multiple pricing.Class SPxParMultPr is an implementation class for SPxPricer implementing Dan...
Definition: spxparmultpr.h:47
SPxHybridPR(const SPxHybridPR &old)
copy constructor
Definition: spxhybridpr.h:106
virtual SPxId selectEnter()
selects the entering algorithm
Steepest edge pricer.
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
double Real
SOPLEX_DEBUG.
Definition: spxdefines.h:200
virtual int selectLeave()
selects the leaving algorithm
virtual void setEpsilon(Real eps)
sets the epsilon
Definition: spxhybridpr.cpp:59
virtual void clear()
clears all pricers and unselects the current pricer
Definition: spxhybridpr.cpp:51
virtual SPxSolver * solver() const
returns loaded SPxSolver object.
Definition: spxpricer.h:129
virtual void setRep(SPxSolver::Representation rep)
sets row or column representation
Definition: spxhybridpr.cpp:98
Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer ...
Definition: spxpricer.h:46
SPxPricer * thepricer
the currently used pricer
Definition: spxhybridpr.h:55
SPxParMultPR parmult
partial multiple pricer
Definition: spxhybridpr.h:51
Debugging, floating point type and parameter definitions.
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
Hybrid pricer.The hybrid pricer for SoPlex tries to guess the best pricing strategy to use for pricin...
Definition: spxhybridpr.h:43
Everything should be within this namespace.
virtual void addedVecs(int n)
calls addedVecs(n) on all pricers
virtual bool isConsistent() const
consistency check
Definition: spxhybridpr.cpp:25
Partial multiple pricing.
virtual SPxPricer * clone() const
clone function for polymorphism
Definition: spxhybridpr.h:164
SPxHybridPR()
default constructor
Definition: spxhybridpr.h:100
Real hybridFactor
factor between dim and coDim of the problem to decide about the pricer
Definition: spxhybridpr.h:57
virtual void load(SPxSolver *solver)
sets the solver
Definition: spxhybridpr.cpp:42
virtual ~SPxHybridPR()
destructor
Definition: spxhybridpr.h:161
virtual void setType(SPxSolver::Type tp)
sets entering or leaving algorithm
Definition: spxhybridpr.cpp:66
virtual void left4(int n, SPxId id)
calls left4 on the current pricer
Steepest edge pricer.Class SPxSteepPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteeppr.h:41
virtual void addedCoVecs(int n)
calls addedCoVecs(n) on all pricers