SoPlex
Toggle main menu visibility
Loading...
Searching...
No Matches
src
soplex
spxautopr.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-2026 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 spxautopr.h
26
* @brief Auto pricer.
27
*/
28
#ifndef _SPXAUTOPR_H_
29
#define _SPXAUTOPR_H_
30
31
#include <assert.h>
32
33
#include "
soplex/spxpricer.h
"
34
#include "
soplex/spxdevexpr.h
"
35
#include "
soplex/spxsteeppr.h
"
36
#include "
soplex/spxsteepexpr.h
"
37
38
39
namespace
soplex
40
{
41
42
/**@brief Auto pricer.
43
@ingroup Algo
44
45
This pricer switches between Devex and Steepest edge pricer based on the difficulty of the problem
46
which is determined by the number of iterations.
47
48
See SPxPricer for a class documentation.
49
*/
50
template
<
class
R>
51
class
SPxAutoPR
:
public
SPxPricer
<R>
52
{
53
private
:
54
55
int
switchIters
;
///< number of iterations before switching pricers
56
SPxPricer<R>
*
activepricer
;
///< pointer to currently selected pricer
57
SPxDevexPR<R>
devex
;
///< internal Devex pricer
58
SPxSteepExPR<R>
steep
;
///< internal Steepest edge pricer
59
60
bool
setActivePricer
(
typename
SPxSolverBase<R>::Type
61
type);
///< switches active pricing method
62
63
public
:
64
65
//-------------------------------------
66
/**@name Constructors / destructors */
67
///@{
68
/// default constructor
69
SPxAutoPR
()
70
:
SPxPricer
<R>(
"Auto"
)
71
,
switchIters
(10000)
72
,
activepricer
(&
devex
)
73
,
devex
()
74
,
steep
()
75
{}
76
/// copy constructor
77
SPxAutoPR
(
const
SPxAutoPR
& old)
78
:
SPxPricer
<R>(old)
79
,
switchIters
(old.
switchIters
)
80
,
devex
(old.
devex
)
81
,
steep
(old.
steep
)
82
{
83
assert(old.
activepricer
== &old.
devex
|| old.
activepricer
== &old.
steep
);
84
85
if
(old.
activepricer
== &old.
devex
)
86
activepricer
= &
devex
;
87
else
88
activepricer
= &
steep
;
89
}
90
/// assignment operator
91
SPxAutoPR
&
operator=
(
const
SPxAutoPR
& rhs)
92
{
93
if
(
this
!= &rhs)
94
{
95
SPxPricer<R>::operator=
(rhs);
96
switchIters
= rhs.
switchIters
;
97
devex
= rhs.
devex
;
98
steep
= rhs.
steep
;
99
100
assert(rhs.
activepricer
== &rhs.
devex
|| rhs.
activepricer
== &rhs.
steep
);
101
102
if
(rhs.
activepricer
== &rhs.
devex
)
103
activepricer
= &
devex
;
104
else
105
activepricer
= &
steep
;
106
}
107
108
return
*
this
;
109
}
110
/// destructor
111
virtual
~SPxAutoPR
()
112
{}
113
/// clone function for polymorphism
114
inline
virtual
SPxPricer<R>
*
clone
()
const
115
{
116
return
new
SPxAutoPR
(*
this
);
117
}
118
///@}
119
120
//-------------------------------------
121
/**@name Access / modification */
122
///@{
123
/// set max number of iterations before switching pricers
124
void
setSwitchIters
(
int
iters);
125
/// clear the data
126
void
clear
();
127
/// set tolerances of internal pricers
128
void
setPricingTolerance
(R tol);
129
/// set the solver
130
virtual
void
load
(
SPxSolverBase<R>
* base);
131
/// set entering/leaving algorithm
132
virtual
void
setType
(
typename
SPxSolverBase<R>::Type
);
133
/// set row/column representation
134
virtual
void
setRep
(
typename
SPxSolverBase<R>::Representation
);
135
///
136
virtual
int
selectLeave
();
137
///
138
virtual
SPxId
selectEnter
();
139
///
140
virtual
void
left4
(
int
n,
SPxId
id
);
141
///
142
virtual
void
entered4
(
SPxId
id
,
int
n);
143
///@}
144
};
145
}
// namespace soplex
146
147
// For general templated functions
148
#include "spxautopr.hpp"
149
150
#endif
// _SPXAUTOPR_H_
soplex::SPxAutoPR::SPxAutoPR
SPxAutoPR(const SPxAutoPR &old)
copy constructor
Definition
spxautopr.h:77
soplex::SPxAutoPR::clone
virtual SPxPricer< R > * clone() const
clone function for polymorphism
Definition
spxautopr.h:114
soplex::SPxAutoPR::switchIters
int switchIters
number of iterations before switching pricers
Definition
spxautopr.h:55
soplex::SPxAutoPR::setSwitchIters
void setSwitchIters(int iters)
set max number of iterations before switching pricers
soplex::SPxAutoPR::operator=
SPxAutoPR & operator=(const SPxAutoPR &rhs)
assignment operator
Definition
spxautopr.h:91
soplex::SPxAutoPR::activepricer
SPxPricer< R > * activepricer
pointer to currently selected pricer
Definition
spxautopr.h:56
soplex::SPxAutoPR::~SPxAutoPR
virtual ~SPxAutoPR()
destructor
Definition
spxautopr.h:111
soplex::SPxAutoPR::entered4
virtual void entered4(SPxId id, int n)
soplex::SPxAutoPR::devex
SPxDevexPR< R > devex
internal Devex pricer
Definition
spxautopr.h:57
soplex::SPxAutoPR::setActivePricer
bool setActivePricer(typename SPxSolverBase< R >::Type type)
switches active pricing method
soplex::SPxAutoPR::load
virtual void load(SPxSolverBase< R > *base)
set the solver
soplex::SPxAutoPR::setPricingTolerance
void setPricingTolerance(R tol)
set tolerances of internal pricers
soplex::SPxAutoPR::SPxAutoPR
SPxAutoPR()
default constructor
Definition
spxautopr.h:69
soplex::SPxAutoPR::setType
virtual void setType(typename SPxSolverBase< R >::Type)
set entering/leaving algorithm
soplex::SPxAutoPR::setRep
virtual void setRep(typename SPxSolverBase< R >::Representation)
set row/column representation
soplex::SPxAutoPR::clear
void clear()
clear the data
soplex::SPxAutoPR::left4
virtual void left4(int n, SPxId id)
soplex::SPxAutoPR::selectLeave
virtual int selectLeave()
soplex::SPxAutoPR::steep
SPxSteepExPR< R > steep
internal Steepest edge pricer
Definition
spxautopr.h:58
soplex::SPxAutoPR::selectEnter
virtual SPxId selectEnter()
soplex::SPxDevexPR
Devex pricer.
Definition
spxdevexpr.h:54
soplex::SPxId
Generic Ids for LP rows or columns.
Definition
spxid.h:95
soplex::SPxPricer::SPxPricer
SPxPricer(const char *p_name)
constructor
Definition
spxpricer.h:284
soplex::SPxPricer::operator=
SPxPricer & operator=(const SPxPricer &rhs)
assignment operator
Definition
spxpricer.h:298
soplex::SPxSolverBase
Sequential object-oriented SimPlex.
Definition
spxsolver.h:104
soplex::SPxSolverBase::Type
Type
Algorithmic type.
Definition
spxsolver.h:143
soplex::SPxSolverBase::Representation
Representation
LP basis representation.
Definition
spxsolver.h:124
soplex::SPxSteepExPR
Steepest edge pricer.
Definition
spxsteepexpr.h:51
soplex
Everything should be within this namespace.
spxdevexpr.h
Devex pricer.
spxpricer.h
Abstract pricer base class.
spxsteepexpr.h
Steepest edge pricer with exact initialization of weights.
spxsteeppr.h
Steepest edge pricer.
Generated by
1.17.0