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-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 spxhybridpr.h
17  * @brief Hybrid pricer.
18  */
19 #ifndef _SPXHYBRIDPR_H_
20 #define _SPXHYBRIDPR_H_
21 
22 #include <assert.h>
23 
24 #include "soplex/spxdefines.h"
25 #include "soplex/spxpricer.h"
26 #include "soplex/spxdevexpr.h"
27 #include "soplex/spxparmultpr.h"
28 #include "soplex/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 
141  if(rhs.thepricer == &rhs.steep)
142  {
143  thepricer = &steep;
144  }
145  else if(rhs.thepricer == &rhs.parmult)
146  {
147  thepricer = &parmult;
148  }
149  else if(rhs.thepricer == &rhs.devex)
150  {
151  thepricer = &devex;
152  }
153  else // rhs.thepricer should be 0
154  {
155  thepricer = 0;
156  }
157  }
158 
159  return *this;
160  }
161  /// destructor
162  virtual ~SPxHybridPR()
163  {}
164  /// clone function for polymorphism
165  inline virtual SPxPricer* clone() const
166  {
167  return new SPxHybridPR(*this);
168  }
169  //@}
170 };
171 
172 } // namespace soplex
173 #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:277
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
Definition: spxdefines.h:218
virtual int selectLeave()
selects the leaving algorithm
virtual void setEpsilon(Real eps)
sets the epsilon
Definition: spxhybridpr.cpp:60
virtual void clear()
clears all pricers and unselects the current pricer
Definition: spxhybridpr.cpp:52
virtual void setRep(SPxSolver::Representation rep)
sets row or column representation
Definition: spxhybridpr.cpp:99
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:85
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
Partial multiple pricing.
virtual SPxPricer * clone() const
clone function for polymorphism
Definition: spxhybridpr.h:165
virtual SPxSolver * solver() const
returns loaded SPxSolver object.
Definition: spxpricer.h:124
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 bool isConsistent() const
consistency check
Definition: spxhybridpr.cpp:25
virtual void load(SPxSolver *solver)
sets the solver
Definition: spxhybridpr.cpp:43
virtual ~SPxHybridPR()
destructor
Definition: spxhybridpr.h:162
virtual void setType(SPxSolver::Type tp)
sets entering or leaving algorithm
Definition: spxhybridpr.cpp:67
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