Scippy

SoPlex

Sequential object-oriented simPlex

spxhybridpr.cpp
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 #include <iostream>
17 
18 #include "soplex/spxdefines.h"
19 #include "soplex/spxhybridpr.h"
20 #include "soplex/spxout.h"
21 
22 namespace soplex
23 {
24 
26 {
27 #ifdef ENABLE_CONSISTENCY_CHECKS
28 
29  if(thesolver != 0 &&
30  (thesolver != steep.solver() ||
31  thesolver != devex.solver() ||
32  thesolver != parmult.solver()))
33  return MSGinconsistent("SPxHybridPR");
34 
35  return steep.isConsistent()
36  && devex.isConsistent()
37  && parmult.isConsistent();
38 #else
39  return true;
40 #endif
41 }
42 
44 {
45  steep.load(p_solver);
46  devex.load(p_solver);
47  parmult.load(p_solver);
48  thesolver = p_solver;
49  setType(p_solver->type());
50 }
51 
53 {
54  steep.clear();
55  devex.clear();
56  parmult.clear();
57  thesolver = 0;
58 }
59 
61 {
62  steep.setEpsilon(eps);
63  devex.setEpsilon(eps);
64  parmult.setEpsilon(eps);
65 }
66 
68 {
69  if(tp == SPxSolver::LEAVE)
70  {
71  thepricer = &steep;
73  }
74  else
75  {
77  {
78  /**@todo I changed from devex to steepest edge pricing here
79  * because of numerical difficulties, this should be
80  * investigated.
81  */
82  // thepricer = &devex;
83  thepricer = &steep;
85  }
86  else
87  {
88  thepricer = &parmult;
90  }
91  }
92 
93  MSG_INFO1((*thesolver->spxout), (*thesolver->spxout) << "IPRHYB01 switching to "
94  << thepricer->getName() << std::endl;)
95 
96  thepricer->setType(tp);
97 }
98 
100 {
101  steep.setRep(rep);
102  devex.setRep(rep);
103  parmult.setRep(rep);
104 }
105 
107 {
108  return thepricer->selectLeave();
109 }
110 
111 void SPxHybridPR::left4(int n, SPxId id)
112 {
113  thepricer->left4(n, id);
114 }
115 
117 {
118  return thepricer->selectEnter();
119 }
120 
122 {
123  thepricer->entered4(id, n);
124 }
125 
127 {
128  steep.addedVecs(n);
129  devex.addedVecs(n);
130  parmult.addedVecs(n);
131 }
132 
134 {
135  steep.addedCoVecs(n);
136  devex.addedCoVecs(n);
137  parmult.addedCoVecs(n);
138 }
139 
140 } // namespace soplex
virtual void entered4(SPxId, int)
performs entering pivot.
Definition: spxpricer.h:213
SPxSteepPR steep
steepest edge pricer
Definition: spxhybridpr.h:49
virtual SPxId selectEnter()=0
selects Id to enter basis.
SPxOut * spxout
message handler
Definition: spxsolver.h:463
Type
Algorithmic type.
Definition: spxsolver.h:124
virtual bool isConsistent() const
consistency check
Definition: spxdevexpr.cpp:31
virtual void load(SPxSolver *base)
sets the solver
Definition: spxsteeppr.cpp:38
Representation
LP basis representation.
Definition: spxsolver.h:105
virtual void setRep(SPxSolver::Representation)
sets basis representation.
Definition: spxpricer.h:160
virtual bool isConsistent() const
Definition: spxpricer.h:249
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:1075
virtual void entered4(SPxId id, int n)
calls entered4 on the current pricer
SPxDevexPR devex
devex pricer
Definition: spxhybridpr.h:53
virtual void addedCoVecs(int n)
n covectors have been added to loaded LP.
Wrapper for different output streams and verbosity levels.
virtual SPxId selectEnter()
selects the entering algorithm
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
virtual void addedCoVecs(int)
n covectors have been added to loaded LP.
Definition: spxpricer.h:225
Leaving Simplex.
Definition: spxsolver.h:143
double Real
Definition: spxdefines.h:218
virtual void load(SPxSolver *solver)
set the solver
virtual void addedVecs(int)
n vectors have been added to loaded LP.
Definition: spxpricer.h:222
virtual void left4(int, SPxId)
performs leaving pivot.
Definition: spxpricer.h:185
virtual void clear()
unloads LP.
Definition: spxpricer.h:118
virtual void setRep(SPxSolver::Representation)
set row/column representation
Definition: spxdevexpr.cpp:99
virtual void setRep(SPxSolver::Representation rep)
set row/column representation
Definition: spxsteeppr.cpp:161
virtual bool isConsistent() const
virtual int selectLeave()
selects the leaving algorithm
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
Definition: spxsteeppr.cpp:995
virtual void setEpsilon(Real eps)
sets the epsilon
Definition: spxhybridpr.cpp:60
SPxSolver * thesolver
the solver
Definition: spxpricer.h:56
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
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.
virtual void setEpsilon(Real eps)
sets violation bound.
Definition: spxpricer.h:138
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:85
Full pricing.
Definition: spxsolver.h:160
Everything should be within this namespace.
virtual void setType(SPxSolver::Type)
sets pricing type.
Definition: spxpricer.h:149
virtual void addedVecs(int n)
calls addedVecs(n) on all pricers
virtual const char * getName() const
get name of pricer.
Definition: spxpricer.h:104
virtual void clear()
clear solver and preferences
Definition: spxsteeppr.cpp:33
Partial pricing.
Definition: spxsolver.h:174
Type type() const
return current Type.
Definition: spxsolver.h:512
virtual SPxSolver * solver() const
returns loaded SPxSolver object.
Definition: spxpricer.h:124
int coDim() const
codimension.
Definition: spxsolver.h:1080
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
Definition: spxdefines.h:118
virtual void addedCoVecs(int n)
n covectors have been added to loaded LP.
Definition: spxdevexpr.cpp:926
virtual int selectLeave()=0
returns selected index to leave basis.
#define MSGinconsistent(name)
Definition: spxdefines.h:126
Hybrid pricer.
virtual void load(SPxSolver *base)
sets the solver
Definition: spxdevexpr.cpp:24
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 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
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
Definition: spxdevexpr.cpp:915
virtual void addedCoVecs(int n)
calls addedCoVecs(n) on all pricers
void setPricing(Pricing pr)
set FULL or PARTIAL pricing.
Definition: spxsolver.cpp:445