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-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file spxhybridpr.h
26 * @brief Hybrid pricer.
27 */
28#ifndef _SPXHYBRIDPR_H_
29#define _SPXHYBRIDPR_H_
30
31#include <assert.h>
32
33#include "soplex/spxdefines.h"
34#include "soplex/spxpricer.h"
35#include "soplex/spxdevexpr.h"
36#include "soplex/spxparmultpr.h"
37#include "soplex/spxsteeppr.h"
38
39namespace soplex
40{
41
42/**@brief Hybrid pricer.
43 @ingroup Algo
44
45 The hybrid pricer for SoPlex tries to guess the best pricing strategy to
46 use for pricing the loaded LP with the loaded algorithm type and basis
47 representation. Currently it does so by switching between SPxSteepPR,
48 SPxDevexPR and SPxParMultPR.
49
50 See SPxPricer for a class documentation.
51*/
52template <class R>
53class SPxHybridPR : public SPxPricer<R>
54{
55 //-------------------------------------
56 /**@name Data */
57 ///@{
58 /// steepest edge pricer
60 /// partial multiple pricer
62 /// devex pricer
64 /// the currently used pricer
66 /// factor between dim and coDim of the problem to decide about the pricer
68 ///@}
69
70public:
71
72 //-------------------------------------
73 /**@name Access / modification */
74 ///@{
75 /// sets the epsilon
76 virtual void setPricingTolerance(R tol);
77 /// sets the solver
79 /// clears all pricers and unselects the current pricer
80 virtual void clear();
81 /// sets entering or leaving algorithm
82 virtual void setType(typename SPxSolverBase<R>::Type tp);
83 /// sets row or column representation
84 virtual void setRep(typename SPxSolverBase<R>::Representation rep);
85 /// selects the leaving algorithm
86 virtual int selectLeave();
87 /// selects the entering algorithm
88 virtual SPxId selectEnter();
89 /// calls left4 on the current pricer
90 virtual void left4(int n, SPxId id);
91 /// calls entered4 on the current pricer
92 virtual void entered4(SPxId id, int n);
93 /// calls addedVecs(n) on all pricers
94 virtual void addedVecs(int n);
95 /// calls addedCoVecs(n) on all pricers
96 virtual void addedCoVecs(int n);
97 ///@}
98
99 //-------------------------------------
100 /**@name Consistency check */
101 ///@{
102 /// consistency check
103 virtual bool isConsistent() const;
104 ///@}
105
106 //-------------------------------------
107 /**@name Construction / destruction */
108 ///@{
109 /// default constructor
111 : SPxPricer<R>("Hybrid")
112 , thepricer(0)
113 , hybridFactor(3.0) // we want the ParMult pricer
114 {}
115 /// copy constructor
117 : SPxPricer<R>(old)
118 , steep(old.steep)
119 , parmult(old.parmult)
120 , devex(old.devex)
122 {
123 if(old.thepricer == &old.steep)
124 {
125 thepricer = &steep;
126 }
127 else if(old.thepricer == &old.parmult)
128 {
130 }
131 else if(old.thepricer == &old.devex)
132 {
133 thepricer = &devex;
134 }
135 else // old.thepricer should be 0
136 {
137 thepricer = 0;
138 }
139 }
140 /// assignment operator
142 {
143 if(this != &rhs)
144 {
146 steep = rhs.steep;
147 parmult = rhs.parmult;
148 devex = rhs.devex;
150
151 if(rhs.thepricer == &rhs.steep)
152 {
153 thepricer = &steep;
154 }
155 else if(rhs.thepricer == &rhs.parmult)
156 {
158 }
159 else if(rhs.thepricer == &rhs.devex)
160 {
161 thepricer = &devex;
162 }
163 else // rhs.thepricer should be 0
164 {
165 thepricer = 0;
166 }
167 }
168
169 return *this;
170 }
171 /// destructor
172 virtual ~SPxHybridPR()
173 {}
174 /// clone function for polymorphism
175 inline virtual SPxPricer<R>* clone() const
176 {
177 return new SPxHybridPR(*this);
178 }
179 ///@}
180};
181
182} // namespace soplex
183
184// For general templated functions
185#include "spxhybridpr.hpp"
186#endif // _SPXHYBRIDPR_H_
Devex pricer.
Definition: spxdevexpr.h:54
Hybrid pricer.
Definition: spxhybridpr.h:54
SPxHybridPR(const SPxHybridPR &old)
copy constructor
Definition: spxhybridpr.h:116
SPxHybridPR()
default constructor
Definition: spxhybridpr.h:110
virtual SPxPricer< R > * clone() const
clone function for polymorphism
Definition: spxhybridpr.h:175
virtual void setPricingTolerance(R tol)
sets the epsilon
SPxHybridPR & operator=(const SPxHybridPR &rhs)
assignment operator
Definition: spxhybridpr.h:141
SPxSteepPR< R > steep
steepest edge pricer
Definition: spxhybridpr.h:59
SPxPricer< R > * thepricer
the currently used pricer
Definition: spxhybridpr.h:65
virtual void addedCoVecs(int n)
calls addedCoVecs(n) on all pricers
R hybridFactor
factor between dim and coDim of the problem to decide about the pricer
Definition: spxhybridpr.h:67
virtual ~SPxHybridPR()
destructor
Definition: spxhybridpr.h:172
virtual void load(SPxSolverBase< R > *solver)
sets the solver
virtual void entered4(SPxId id, int n)
calls entered4 on the current pricer
SPxDevexPR< R > devex
devex pricer
Definition: spxhybridpr.h:63
virtual bool isConsistent() const
consistency check
virtual void clear()
clears all pricers and unselects the current pricer
virtual void addedVecs(int n)
calls addedVecs(n) on all pricers
virtual void setRep(typename SPxSolverBase< R >::Representation rep)
sets row or column representation
virtual void setType(typename SPxSolverBase< R >::Type tp)
sets entering or leaving algorithm
virtual void left4(int n, SPxId id)
calls left4 on the current pricer
virtual int selectLeave()
selects the leaving algorithm
virtual SPxId selectEnter()
selects the entering algorithm
SPxParMultPR< R > parmult
partial multiple pricer
Definition: spxhybridpr.h:61
Generic Ids for LP rows or columns.
Definition: spxid.h:95
Partial multiple pricing.
Definition: spxparmultpr.h:58
Abstract pricer base class.
Definition: spxpricer.h:57
virtual SPxSolverBase< R > * solver() const
returns loaded SPxSolverBase object.
Definition: spxpricer.h:139
SPxPricer & operator=(const SPxPricer &rhs)
assignment operator
Definition: spxpricer.h:298
Sequential object-oriented SimPlex.
Definition: spxsolver.h:104
Type
Algorithmic type.
Definition: spxsolver.h:143
Representation
LP basis representation.
Definition: spxsolver.h:124
Steepest edge pricer.
Definition: spxsteeppr.h:52
Everything should be within this namespace.
Debugging, floating point type and parameter definitions.
Devex pricer.
Partial multiple pricing.
Abstract pricer base class.
Steepest edge pricer.