Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SoPlex 6.0.3
SoPlex 5.0.2
SoPlex 4.0.2
SoPlex 3.1.0
SoPlex 3.0.1
SoPlex 2.2.1
SoPlex
Sequential object-oriented simPlex
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
soplex-repo
src
spxweightpr.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-2015 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
/**@file spxweightpr.h
17
* @brief Weighted pricing.
18
*/
19
#ifndef _SPXWEIGHTPR_H_
20
#define _SPXWEIGHTPR_H_
21
22
#include "
spxdefines.h
"
23
#include "
spxpricer.h
"
24
25
namespace
soplex
26
{
27
28
/**@brief Weighted pricing.
29
@ingroup Algo
30
31
Class SPxWeightPR is an implemantation class of SPxPricer that uses
32
weights for columns and rows for selecting the Simplex pivots. The weights
33
are computed by methods #computeCP() and #computeRP() which may be
34
overridden by derived classes.
35
36
The weights are interpreted as follows: The higher a value is, the more
37
likely the corresponding row or column is set on one of its bounds.
38
39
See SPxPricer for a class documentation.
40
*/
41
class
SPxWeightPR
:
public
SPxPricer
42
{
43
private
:
44
45
//-------------------------------------
46
/**@name Data */
47
//@{
48
/// column penalties
49
DVector
cPenalty
;
50
/// row penalties
51
DVector
rPenalty
;
52
/// penalties for leaving alg
53
DVector
leavePenalty
;
54
///
55
const
Real
*
penalty
;
56
///
57
const
Real
*
coPenalty
;
58
/// length of objective vector.
59
Real
objlength
;
60
//@}
61
62
//-------------------------------------
63
/**@name Private helpers */
64
//@{
65
/// compute leave penalties.
66
void
computeLeavePenalty
(
int
start,
int
end);
67
/// compute weights for columns.
68
void
computeCP
(
int
start,
int
end);
69
/// compute weights for rows.
70
void
computeRP
(
int
start,
int
end);
71
//@}
72
73
public
:
74
75
//-------------------------------------
76
/**@name Construction / destruction */
77
//@{
78
/// default constructor
79
SPxWeightPR
()
80
:
SPxPricer
(
"Weight"
)
81
,
penalty
(0)
82
,
coPenalty
(0)
83
,
objlength
(0)
84
{}
85
/// copy constructor
86
SPxWeightPR
(
const
SPxWeightPR
& old)
87
:
SPxPricer
(old)
88
,
cPenalty
(old.
cPenalty
)
89
,
rPenalty
(old.
rPenalty
)
90
,
leavePenalty
(old.
leavePenalty
)
91
,
objlength
(old.
objlength
)
92
{
93
if
(old.
penalty
== old.
rPenalty
.
get_const_ptr
())
94
{
95
penalty
=
rPenalty
.
get_const_ptr
();
96
coPenalty
=
cPenalty
.
get_const_ptr
();
97
}
98
else
if
(old.
penalty
== old.
cPenalty
.
get_const_ptr
())
99
{
100
penalty
=
cPenalty
.
get_const_ptr
();
101
coPenalty
=
rPenalty
.
get_const_ptr
();
102
}
103
// otherwise, old.penalty and old.coPenalty are not set and do not have to be copied
104
}
105
/// assignment operator
106
SPxWeightPR
&
operator=
(
const
SPxWeightPR
& rhs)
107
{
108
if
(
this
!= &rhs)
109
{
110
SPxPricer::operator=
(rhs);
111
cPenalty
= rhs.
cPenalty
;
112
rPenalty
= rhs.
rPenalty
;
113
leavePenalty
= rhs.
leavePenalty
;
114
objlength
= rhs.
objlength
;
115
if
(rhs.
penalty
== rhs.
rPenalty
.
get_const_ptr
())
116
{
117
penalty
=
rPenalty
.
get_const_ptr
();
118
coPenalty
=
cPenalty
.
get_const_ptr
();
119
}
120
else
if
(rhs.
penalty
== rhs.
cPenalty
.
get_const_ptr
())
121
{
122
penalty
=
cPenalty
.
get_const_ptr
();
123
coPenalty
=
rPenalty
.
get_const_ptr
();
124
}
125
// otherwise, old.penalty and old.coPenalty are not set and do not have to be copied
126
}
127
128
return
*
this
;
129
}
130
/// destructor
131
virtual
~SPxWeightPR
()
132
{}
133
/// clone function for polymorphism
134
inline
virtual
SPxPricer
*
clone
()
const
135
{
136
return
new
SPxWeightPR
(*
this
);
137
}
138
//@}
139
140
//-------------------------------------
141
/**@name Access / modification */
142
//@{
143
/// sets the solver
144
virtual
void
load
(
SPxSolver
* base);
145
/// set entering/leaving algorithm
146
void
setType
(
SPxSolver::Type
tp);
147
/// set row/column representation
148
void
setRep
(
SPxSolver::Representation
rep);
149
///
150
virtual
int
selectLeave
();
151
///
152
virtual
SPxId
selectEnter
();
153
/// \p n vectors have been added to the loaded LP.
154
virtual
void
addedVecs
(
int
n);
155
/// \p n covectors have been added to the loaded LP.
156
virtual
void
addedCoVecs
(
int
n);
157
/// \p the i'th vector has been removed from the loaded LP.
158
virtual
void
removedVec
(
int
i);
159
/// \p the i'th covector has been removed from the loaded LP.
160
virtual
void
removedCoVec
(
int
i);
161
/// \p n vectors have been removed from the loaded LP.
162
virtual
void
removedVecs
(
const
int
perm[]);
163
/// \p n covectors have been removed from the loaded LP.
164
virtual
void
removedCoVecs
(
const
int
perm[]);
165
//@}
166
167
//-------------------------------------
168
/**@name Consistency check */
169
//@{
170
/// checks for consistency
171
virtual
bool
isConsistent
()
const
;
172
//@}
173
};
174
}
// namespace soplex
175
#endif // _SPXWEIGHTPR_H_