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-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 #include <iostream>
17 
18 #include "spxdefines.h"
19 #include "spxhybridpr.h"
20 #include "spxout.h"
21 
22 namespace soplex
23 {
24 
26 {
27 #ifdef ENABLE_CONSISTENCY_CHECKS
28  if (thesolver != 0 &&
29  (thesolver != steep.solver() ||
30  thesolver != devex.solver() ||
31  thesolver != parmult.solver()))
32  return MSGinconsistent("SPxHybridPR");
33 
34  return steep.isConsistent()
35  && devex.isConsistent()
36  && parmult.isConsistent();
37 #else
38  return true;
39 #endif
40 }
41 
43 {
44  steep.load(p_solver);
45  devex.load(p_solver);
46  parmult.load(p_solver);
47  thesolver = p_solver;
48  setType(p_solver->type());
49 }
50 
52 {
53  steep.clear();
54  devex.clear();
55  parmult.clear();
56  thesolver = 0;
57 }
58 
60 {
61  steep.setEpsilon(eps);
62  devex.setEpsilon(eps);
63  parmult.setEpsilon(eps);
64 }
65 
67 {
68  if (tp == SPxSolver::LEAVE)
69  {
70  thepricer = &steep;
72  }
73  else
74  {
76  {
77  /**@todo I changed from devex to steepest edge pricing here
78  * because of numerical difficulties, this should be
79  * investigated.
80  */
81  // thepricer = &devex;
82  thepricer = &steep;
84  }
85  else
86  {
87  thepricer = &parmult;
89  }
90  }
91 
92  MSG_INFO1( (*thesolver->spxout), (*thesolver->spxout) << "IPRHYB01 switching to "
93  << thepricer->getName() << std::endl; )
94 
95  thepricer->setType(tp);
96 }
97 
99 {
100  steep.setRep(rep);
101  devex.setRep(rep);
102  parmult.setRep(rep);
103 }
104 
106 {
107  return thepricer->selectLeave();
108 }
109 
110 void SPxHybridPR::left4(int n, SPxId id)
111 {
112  thepricer->left4(n, id);
113 }
114 
116 {
117  return thepricer->selectEnter();
118 }
119 
121 {
122  thepricer->entered4(id, n);
123 }
124 
126 {
127  steep.addedVecs(n);
128  devex.addedVecs(n);
129  parmult.addedVecs(n);
130 }
131 
133 {
134  steep.addedCoVecs(n);
135  devex.addedCoVecs(n);
136  parmult.addedCoVecs(n);
137 }
138 
139 } // namespace soplex
virtual void entered4(SPxId, int)
performs entering pivot.
Definition: spxpricer.h:214
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:936
int coDim() const
codimension.
Definition: spxsolver.h:941
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:384
Type
Algorithmic type.
Definition: spxsolver.h:124
virtual const char * getName() const
get name of pricer.
Definition: spxpricer.h:109
virtual void load(SPxSolver *base)
sets the solver
Definition: spxsteeppr.cpp:40
Representation
LP basis representation.
Definition: spxsolver.h:105
virtual bool isConsistent() const
Definition: spxpricer.h:348
virtual void setRep(SPxSolver::Representation)
sets basis representation.
Definition: spxpricer.h:161
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:226
Leaving Simplex.
Definition: spxsolver.h:143
double Real
SOPLEX_DEBUG.
Definition: spxdefines.h:200
virtual void load(SPxSolver *solver)
set the solver
virtual void addedVecs(int)
n vectors have been added to loaded LP.
Definition: spxpricer.h:223
virtual void left4(int, SPxId)
performs leaving pivot.
Definition: spxpricer.h:186
virtual void clear()
unloads LP.
Definition: spxpricer.h:123
virtual void setRep(SPxSolver::Representation)
set row/column representation
Definition: spxdevexpr.cpp:92
virtual void setRep(SPxSolver::Representation rep)
set row/column representation
Definition: spxsteeppr.cpp:248
virtual int selectLeave()
selects the leaving algorithm
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
virtual void setEpsilon(Real eps)
sets the epsilon
Definition: spxhybridpr.cpp:59
SPxSolver * thesolver
the solver
Definition: spxpricer.h:56
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
SPxPricer * thepricer
the currently used pricer
Definition: spxhybridpr.h:55
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
Definition: spxdefines.h:113
Type type() const
return current Type.
Definition: spxsolver.h:412
SPxParMultPR parmult
partial multiple pricer
Definition: spxhybridpr.h:51
virtual bool isConsistent() const
Debugging, floating point type and parameter definitions.
virtual void setEpsilon(Real eps)
sets violation bound.
Definition: spxpricer.h:143
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
Full pricing.
Definition: spxsolver.h:160
Everything should be within this namespace.
virtual void setType(SPxSolver::Type)
sets pricing type.
Definition: spxpricer.h:154
virtual void addedVecs(int n)
calls addedVecs(n) on all pricers
virtual bool isConsistent() const
consistency check
Definition: spxhybridpr.cpp:25
virtual void clear()
clear solver and preferences
Definition: spxsteeppr.cpp:33
Partial pricing.
Definition: spxsolver.h:174
virtual void addedCoVecs(int n)
n covectors have been added to loaded LP.
Definition: spxdevexpr.cpp:861
virtual int selectLeave()=0
returns selected index to leave basis.
#define MSGinconsistent(name)
Definition: spxdefines.h:121
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 void load(SPxSolver *solver)
sets the solver
Definition: spxhybridpr.cpp:42
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
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
Definition: spxdevexpr.cpp:852
virtual bool isConsistent() const
consistency check
Definition: spxdevexpr.cpp:31
virtual void addedCoVecs(int n)
calls addedCoVecs(n) on all pricers
void setPricing(Pricing pr)
set FULL or PARTIAL pricing.
Definition: spxsolver.cpp:431