Scippy

SoPlex

Sequential object-oriented simPlex

spxautopr.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-2017 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 "spxautopr.h"
20 #include "spxout.h"
21 
22 namespace soplex
23 {
24 
25 void SPxAutoPR::load(SPxSolver* p_solver)
26 {
27  steep.load(p_solver);
28  devex.load(p_solver);
29  thesolver = p_solver;
30  setType(p_solver->type());
31 }
32 
34 {
35  steep.clear();
36  devex.clear();
37  thesolver = 0;
38 }
39 
41 {
42  steep.setEpsilon(eps);
43  devex.setEpsilon(eps);
44  theeps = eps;
45 }
46 
48 {
49  activepricer->setType(tp);
50 }
51 
53 {
54  steep.setRep(rep);
55  devex.setRep(rep);
56 }
57 
59 {
60  // switch to steep as soon as switchIters is reached
62  {
64  activepricer->setType(type);
65  return true;
66  }
67 
68  // use devex for the iterations < switchIters
69  else if( activepricer == &steep && thesolver->iterations() < switchIters )
70  {
72  activepricer->setType(type);
73  return true;
74  }
75 
76  return false;
77 }
78 
80 {
82  MSG_INFO1( (*thesolver->spxout), (*thesolver->spxout) << " --- active pricer: " << activepricer->getName() << std::endl; )
83 
84  return activepricer->selectLeave();
85 }
86 
87 void SPxAutoPR::left4(int n, SPxId id)
88 {
89  activepricer->left4(n, id);
90 }
91 
93 {
95  MSG_INFO1( (*thesolver->spxout), (*thesolver->spxout) << " --- active pricer: " << activepricer->getName() << std::endl; )
96 
97  return activepricer->selectEnter();
98 }
99 
100 void SPxAutoPR::entered4(SPxId id, int n)
101 {
102  activepricer->entered4(id, n);
103 }
104 
105 } // namespace soplex
virtual void entered4(SPxId, int)
performs entering pivot.
Definition: spxpricer.h:213
void clear()
clear the data
Definition: spxautopr.cpp:33
SPxSteepExPR steep
internal Steepest edge pricer
Definition: spxautopr.h:48
int iterations() const
get number of iterations of current solution.
Definition: spxsolver.h:2091
virtual SPxId selectEnter()=0
selects Id to enter basis.
SPxOut * spxout
message handler
Definition: spxsolver.h:436
Type
Algorithmic type.
Definition: spxsolver.h:124
virtual void load(SPxSolver *base)
set the solver
Definition: spxautopr.cpp:25
virtual void load(SPxSolver *base)
sets the solver
Definition: spxsteeppr.cpp:38
virtual void setType(SPxSolver::Type)
set entering/leaving algorithm
Definition: spxautopr.cpp:47
Representation
LP basis representation.
Definition: spxsolver.h:105
int switchIters
number of iterations before switching pricers
Definition: spxautopr.h:45
virtual SPxId selectEnter()
Definition: spxautopr.cpp:92
Wrapper for different output streams and verbosity levels.
virtual void entered4(SPxId id, int n)
Definition: spxautopr.cpp:100
Entering Simplex.
Definition: spxsolver.h:134
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
virtual int selectLeave()
Definition: spxautopr.cpp:79
Leaving Simplex.
Definition: spxsolver.h:143
SPxDevexPR devex
internal Devex pricer
Definition: spxautopr.h:47
double Real
Definition: spxdefines.h:218
virtual void left4(int n, SPxId id)
Definition: spxautopr.cpp:87
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:93
virtual void setRep(SPxSolver::Representation rep)
set row/column representation
Definition: spxsteeppr.cpp:150
void setEpsilon(Real eps)
set epsilon of internal pricers
Definition: spxautopr.cpp:40
Auto pricer.
SPxSolver * thesolver
the solver
Definition: spxpricer.h:56
Debugging, floating point type and parameter definitions.
SPxPricer * activepricer
pointer to currently selected pricer
Definition: spxautopr.h:46
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:84
virtual void setRep(SPxSolver::Representation)
set row/column representation
Definition: spxautopr.cpp:52
Everything should be within this namespace.
virtual void setType(SPxSolver::Type)
sets pricing type.
Definition: spxpricer.h:149
virtual const char * getName() const
get name of pricer.
Definition: spxpricer.h:104
Real theeps
violation bound
Definition: spxpricer.h:58
virtual void clear()
clear solver and preferences
Definition: spxsteeppr.cpp:33
Type type() const
return current Type.
Definition: spxsolver.h:484
bool setActivePricer(SPxSolver::Type type)
switches active pricing method
Definition: spxautopr.cpp:58
#define MSG_INFO1(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO1.
Definition: spxdefines.h:118
virtual int selectLeave()=0
returns selected index to leave basis.
virtual void load(SPxSolver *base)
sets the solver
Definition: spxdevexpr.cpp:24