Scippy

SoPlex

Sequential object-oriented simPlex

spxsteeppr.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 
17 /**@file spxsteeppr.h
18  * @brief Steepest edge pricer.
19  */
20 #ifndef _SPXSTEEPPR_H_
21 #define _SPXSTEEPPR_H_
22 
23 
24 #include <assert.h>
25 
26 #include "soplex/spxdefines.h"
27 #include "soplex/spxpricer.h"
28 #include "soplex/random.h"
29 
30 namespace soplex
31 {
32 
33 /**@brief Steepest edge pricer.
34  @ingroup Algo
35 
36  Class SPxSteepPR implements a steepest edge pricer to be used with
37  SoPlex.
38 
39  See SPxPricer for a class documentation.
40 */
41 class SPxSteepPR : public SPxPricer
42 {
43 public:
44 
45  //-------------------------------------
46  /**@name Types */
47  //@{
48  /// How to setup the direction multipliers.
49  /** Possible settings are #EXACT for starting with exactly computed
50  values, or #DEFAULT for starting with multipliers set to 1. The
51  latter is the default.
52  */
53  enum Setup
54  {
55  EXACT, ///< starting with exactly computed values
56  DEFAULT ///< starting with multipliers set to 1
57  };
58  //@}
59  /// setup steepest edge weights
60  void setupWeights(SPxSolver::Type type);
61 
62 private:
63 
64  //-------------------------------------
65  /**@name Data */
66  //@{
67  /// working vector
69  /// working vector
71  /// temporary array of precomputed pricing values
73  /// temporary array of precomputed pricing values
75  /// array of best pricing candidates
77  /// array of best pricing candidates
79  ///
81  /// setup type.
83  /// has a refinement step already been tried?
84  bool refined;
85  //@}
86 
87  //-------------------------------------
88  /// prepare data structures for hyper sparse pricing
89  int buildBestPriceVectorLeave(Real feastol);
90  /// implementation of full pricing
91  int selectLeaveX(Real tol);
92  /// implementation of sparse pricing in the leaving Simplex
93  int selectLeaveSparse(Real tol);
94  /// implementation of hyper sparse pricing in the leaving Simplex
95  int selectLeaveHyper(Real tol);
96  /// build up vector of pricing values for later use
99  /// choose the best entering index among columns and rows but prefer sparsity
100  SPxId selectEnterX(Real tol);
101  /// implementation of sparse pricing for the entering Simplex (slack variables)
102  SPxId selectEnterSparseDim(Real& best, Real tol);
103  /// implementation of sparse pricing for the entering Simplex
105  /// implementation of selectEnter() in dense case (slack variables)
106  SPxId selectEnterDenseDim(Real& best, Real tol);
107  /// implementation of selectEnter() in dense case
108  SPxId selectEnterDenseCoDim(Real& best, Real tol);
109  /// implementation of hyper sparse pricing in the entering Simplex
110  SPxId selectEnterHyperDim(Real& best, Real feastol);
111  /// implementation of hyper sparse pricing in the entering Simplex
112  SPxId selectEnterHyperCoDim(Real& best, Real feastol);
113 
114 public:
115 
116  //-------------------------------------
117  /**@name Construction / destruction */
118  //@{
119  ///
120  SPxSteepPR(const char* name = "Steep", Setup mode = DEFAULT)
121  : SPxPricer(name)
122  , workVec(0)
123  , workRhs(0)
124  , pi_p(1.0)
125  , setup(mode)
126  , refined(false)
127  {
128  assert(isConsistent());
129  }
130  /// copy constructor
131  SPxSteepPR(const SPxSteepPR& old)
132  : SPxPricer(old)
133  , workVec(old.workVec)
134  , workRhs(old.workRhs)
135  , pi_p(old.pi_p)
136  , setup(old.setup)
137  , refined(old.refined)
138  {
139  assert(isConsistent());
140  }
141  /// assignment operator
143  {
144  if(this != &rhs)
145  {
147  workVec = rhs.workVec;
148  workRhs = rhs.workRhs;
149  pi_p = rhs.pi_p;
150  setup = rhs.setup;
151  refined = rhs.refined;
152 
153  assert(isConsistent());
154  }
155 
156  return *this;
157  }
158  /// destructor
159  virtual ~SPxSteepPR()
160  {}
161  /// clone function for polymorphism
162  inline virtual SPxPricer* clone() const
163  {
164  return new SPxSteepPR(*this);
165  }
166  //@}
167 
168  //-------------------------------------
169  /**@name Access / modification */
170  //@{
171  /// sets the solver
172  virtual void load(SPxSolver* base);
173  /// clear solver and preferences
174  virtual void clear();
175  /// set entering/leaving algorithm
176  virtual void setType(SPxSolver::Type);
177  /// set row/column representation
178  virtual void setRep(SPxSolver::Representation rep);
179  ///
180  virtual int selectLeave();
181  ///
182  virtual void left4(int n, SPxId id);
183  ///
184  virtual SPxId selectEnter();
185  ///
186  virtual void entered4(SPxId id, int n);
187  /// \p n vectors have been added to loaded LP.
188  virtual void addedVecs(int n);
189  /// \p n covectors have been added to loaded LP.
190  virtual void addedCoVecs(int n);
191  /// \p the i'th vector has been removed from the loaded LP.
192  virtual void removedVec(int i);
193  /// \p the i'th covector has been removed from the loaded LP.
194  virtual void removedCoVec(int i);
195  /// \p n vectors have been removed from loaded LP.
196  virtual void removedVecs(const int perm[]);
197  /// \p n covectors have been removed from loaded LP.
198  virtual void removedCoVecs(const int perm[]);
199  //@}
200 
201  //-------------------------------------
202  /**@name Consistency check */
203  //@{
204  ///
205  virtual bool isConsistent() const;
206  //@}
207 };
208 
209 } // namespace soplex
210 #endif // _SPXSTEEPPR_H_
Random numbers.
virtual SPxId selectEnter()
Definition: spxsteeppr.cpp:631
int selectLeaveX(Real tol)
implementation of full pricing
Definition: spxsteeppr.cpp:314
SPxId selectEnterHyperCoDim(Real &best, Real feastol)
implementation of hyper sparse pricing in the entering Simplex
Definition: spxsteeppr.cpp:788
int buildBestPriceVectorLeave(Real feastol)
prepare data structures for hyper sparse pricing
Definition: spxsteeppr.cpp:223
SPxSteepPR(const SPxSteepPR &old)
copy constructor
Definition: spxsteeppr.h:131
SPxSteepPR(const char *name="Steep", Setup mode=DEFAULT)
Definition: spxsteeppr.h:120
virtual void setType(SPxSolver::Type)
set entering/leaving algorithm
Definition: spxsteeppr.cpp:51
Type
Algorithmic type.
Definition: spxsolver.h:124
DIdxSet bestPrices
array of best pricing candidates
Definition: spxsteeppr.h:76
Abstract pricer base class.
virtual void load(SPxSolver *base)
sets the solver
Definition: spxsteeppr.cpp:38
Representation
LP basis representation.
Definition: spxsolver.h:105
Setup
How to setup the direction multipliers.
Definition: spxsteeppr.h:53
SPxPricer & operator=(const SPxPricer &rhs)
assignment operator
Definition: spxpricer.h:277
DataArray< IdxElement > prices
temporary array of precomputed pricing values
Definition: spxsteeppr.h:72
starting with multipliers set to 1
Definition: spxsteeppr.h:56
virtual int selectLeave()
Definition: spxsteeppr.cpp:270
virtual void addedCoVecs(int n)
n covectors have been added to loaded LP.
SSVector workVec
working vector
Definition: spxsteeppr.h:68
SPxSteepPR & operator=(const SPxSteepPR &rhs)
assignment operator
Definition: spxsteeppr.h:142
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
SPxId selectEnterX(Real tol)
choose the best entering index among columns and rows but prefer sparsity
Definition: spxsteeppr.cpp:662
bool refined
has a refinement step already been tried?
Definition: spxsteeppr.h:84
virtual void setRep(SPxSolver::Representation rep)
set row/column representation
Definition: spxsteeppr.cpp:161
virtual void entered4(SPxId id, int n)
Definition: spxsteeppr.cpp:453
virtual bool isConsistent() const
virtual void left4(int n, SPxId id)
Definition: spxsteeppr.cpp:174
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
Definition: spxsteeppr.cpp:995
Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer ...
Definition: spxpricer.h:46
starting with exactly computed values
Definition: spxsteeppr.h:55
DataArray< IdxElement > pricesCo
temporary array of precomputed pricing values
Definition: spxsteeppr.h:74
Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed ...
Definition: didxset.h:42
virtual ~SPxSteepPR()
destructor
Definition: spxsteeppr.h:159
DIdxSet bestPricesCo
array of best pricing candidates
Definition: spxsteeppr.h:78
SPxId selectEnterSparseCoDim(Real &best, Real tol)
implementation of sparse pricing for the entering Simplex
Definition: spxsteeppr.cpp:906
SPxId selectEnterHyperDim(Real &best, Real feastol)
implementation of hyper sparse pricing in the entering Simplex
Definition: spxsteeppr.cpp:704
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
int selectLeaveHyper(Real tol)
implementation of hyper sparse pricing in the leaving Simplex
Definition: spxsteeppr.cpp:377
Everything should be within this namespace.
void setupWeights(SPxSolver::Type type)
setup steepest edge weights
Definition: spxsteeppr.cpp:72
int selectLeaveSparse(Real tol)
implementation of sparse pricing in the leaving Simplex
Definition: spxsteeppr.cpp:341
SPxId buildBestPriceVectorEnterDim(Real &best, Real feastol)
build up vector of pricing values for later use
Definition: spxsteeppr.cpp:519
virtual void clear()
clear solver and preferences
Definition: spxsteeppr.cpp:33
virtual void removedVec(int i)
the i&#39;th vector has been removed from the loaded LP.
virtual void removedCoVec(int i)
the i&#39;th covector has been removed from the loaded LP.
Setup setup
setup type.
Definition: spxsteeppr.h:82
virtual SPxPricer * clone() const
clone function for polymorphism
Definition: spxsteeppr.h:162
SPxId selectEnterDenseCoDim(Real &best, Real tol)
implementation of selectEnter() in dense case
Definition: spxsteeppr.cpp:967
SSVector workRhs
working vector
Definition: spxsteeppr.h:70
SPxId buildBestPriceVectorEnterCoDim(Real &best, Real feastol)
Definition: spxsteeppr.cpp:575
virtual void removedCoVecs(const int perm[])
n covectors have been removed from loaded LP.
SPxId selectEnterDenseDim(Real &best, Real tol)
implementation of selectEnter() in dense case (slack variables)
Definition: spxsteeppr.cpp:940
Steepest edge pricer.Class SPxSteepPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteeppr.h:41
SPxId selectEnterSparseDim(Real &best, Real tol)
implementation of sparse pricing for the entering Simplex (slack variables)
Definition: spxsteeppr.cpp:872
virtual void removedVecs(const int perm[])
n vectors have been removed from loaded LP.