SoPlex Doxygen Documentation
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
src
spxsimplifier.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-2012 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 spxsimplifier.h
17
* @brief LP simplification base class.
18
*/
19
#ifndef _SPXSIMPLIFIER_H_
20
#define _SPXSIMPLIFIER_H_
21
22
#include <assert.h>
23
24
#include "
spxdefines.h
"
25
#include "
timer.h
"
26
#include "
spxlp.h
"
27
#include "
spxsolver.h
"
28
29
namespace
soplex
30
{
31
/**@brief LP simplification abstract base class.
32
@ingroup Algo
33
34
Instances of classes derived from SPxSimplifier may be loaded to SoPlex in
35
order to simplify LPs before solving them. SoPlex will call #simplify()
36
on itself. Generally any SPxLP can be given to
37
a SPxSimplifier for #simplify()%ing it. The simplification cannot be undone,
38
but given an primal/dual solution for the simplified SPxLP, the simplifier
39
can reconstruct the primal/dual solution of the unsimplified LP.
40
*/
41
class
SPxSimplifier
42
{
43
protected
:
44
45
//-------------------------------------
46
/**@name Protected Data */
47
//@{
48
/// name of the simplifier
49
const
char
*
m_name
;
50
/// user time used for simplification
51
Timer
m_timeUsed
;
52
/// number of removed rows
53
int
m_remRows
;
54
/// number of removed columns
55
int
m_remCols
;
56
/// number of removed nonzero coefficients
57
int
m_remNzos
;
58
/// number of changed bounds
59
int
m_chgBnds
;
60
/// number of change right-hand sides
61
int
m_chgLRhs
;
62
/// objective offset
63
Real
m_objoffset
;
64
//@}
65
66
public
:
67
68
//-------------------------------------
69
/**@name Types */
70
//@{
71
/// Result of the simplification.
72
enum
Result
73
{
74
OKAY
= 0,
///< simplification could be done
75
INFEASIBLE
= 1,
///< primal infeasibility was detected
76
DUAL_INFEASIBLE
= 2,
///< dual infeasibility was detected
77
UNBOUNDED
= 3,
///< primal unboundedness was detected
78
VANISHED
= 4
///< the problem was so much simplified that it vanished
79
};
80
//@}
81
82
//-------------------------------------
83
/**@name Types */
84
//@{
85
/// constructor
86
explicit
SPxSimplifier
(
const
char
* p_name)
87
:
m_name
(p_name)
88
,
m_remRows
(0)
89
,
m_remCols
(0)
90
,
m_remNzos
(0)
91
,
m_chgBnds
(0)
92
,
m_chgLRhs
(0)
93
,
m_objoffset
(0.0)
94
{
95
assert(
isConsistent
());
96
}
97
/// copy constructor
98
SPxSimplifier
(
const
SPxSimplifier
& old)
99
:
m_name
(old.
m_name
)
100
,
m_remRows
(old.
m_remRows
)
101
,
m_remCols
(old.
m_remCols
)
102
,
m_remNzos
(old.
m_remNzos
)
103
,
m_chgBnds
(old.
m_chgBnds
)
104
,
m_chgLRhs
(old.
m_chgLRhs
)
105
,
m_objoffset
(old.
m_objoffset
)
106
{
107
assert(
isConsistent
());
108
}
109
/// assignment operator
110
SPxSimplifier
&
operator=
(
const
SPxSimplifier
& rhs)
111
{
112
if
(
this
!= &rhs)
113
{
114
m_name
= rhs.
m_name
;
115
m_remRows
= rhs.
m_remRows
;
116
m_remCols
= rhs.
m_remCols
;
117
m_remNzos
= rhs.
m_remNzos
;
118
m_chgBnds
= rhs.
m_chgBnds
;
119
m_chgLRhs
= rhs.
m_chgLRhs
;
120
m_objoffset
= rhs.
m_objoffset
;
121
122
assert(
isConsistent
());
123
}
124
125
return
*
this
;
126
}
127
/// destructor.
128
virtual
~SPxSimplifier
()
129
{
130
m_name
= 0;
131
}
132
/// clone function for polymorphism
133
virtual
SPxSimplifier
*
clone
()
const
= 0;
134
//@}
135
136
//-------------------------------------
137
/**@name Access / modfication */
138
//@{
139
/// get name of simplifier.
140
virtual
const
char
*
getName
()
const
141
{
142
return
m_name
;
143
}
144
virtual
Real
timeUsed
()
const
145
{
146
return
m_timeUsed
.
userTime
();
147
}
148
//@}
149
150
//-------------------------------------
151
/**@name Simplifying / unsimplifying */
152
//@{
153
/// simplify SPxLP \p lp with identical primal and dual feasibility tolerance.
154
virtual
Result
simplify
(
SPxLP
& lp,
Real
eps,
Real
delta) = 0;
155
/// simplify SPxLP \p lp with independent primal and dual feasibility tolerance.
156
virtual
Result
simplify
(
SPxLP
& lp,
Real
eps,
Real
feastol,
Real
opttol) = 0;
157
/// reconstructs an optimal solution for the unsimplified LP.
158
virtual
void
unsimplify
(
const
Vector
&,
const
Vector
&,
const
Vector
&,
const
Vector
&,
159
const
SPxSolver::VarStatus
[],
const
SPxSolver::VarStatus
[]) {}
160
/// specifies whether an optimal solution has already been unsimplified.
161
virtual
bool
isUnsimplified
()
const
162
{
163
return
false
;
164
}
165
/// returns a reference to the unsimplified primal solution.
166
virtual
const
Vector
&
unsimplifiedPrimal
() = 0;
167
168
/// returns a reference to the unsimplified dual solution.
169
virtual
const
Vector
&
unsimplifiedDual
() = 0;
170
171
/// returns a reference to the unsimplified slack values.
172
virtual
const
Vector
&
unsimplifiedSlacks
() = 0;
173
174
/// returns a reference to the unsimplified reduced costs.
175
virtual
const
Vector
&
unsimplifiedRedCost
() = 0;
176
177
/// gets basis status for a single row.
178
virtual
SPxSolver::VarStatus
getBasisRowStatus
(
int
)
const
= 0;
179
180
/// gets basis status for a single column.
181
virtual
SPxSolver::VarStatus
getBasisColStatus
(
int
)
const
= 0;
182
183
/// get optimal basis.
184
virtual
void
getBasis
(
SPxSolver::VarStatus
[],
SPxSolver::VarStatus
[])
const
= 0;
185
186
/// get objective offset.
187
virtual
Real
getObjoffset
()
const
188
{
189
return
m_objoffset
;
190
}
191
192
/// add objective offset.
193
virtual
void
addObjoffset
(
const
Real
val)
194
{
195
m_objoffset
+= val;
196
}
197
//@}
198
199
//-------------------------------------
200
/**@name Consistency check */
201
//@{
202
/// consistency check
203
virtual
bool
isConsistent
()
const
204
{
205
return
true
;
206
}
207
//@}
208
209
};
210
}
// namespace soplex
211
#endif // _SPXSIMPLIFIER_H_
212
213
//-----------------------------------------------------------------------------
214
//Emacs Local Variables:
215
//Emacs mode:c++
216
//Emacs c-basic-offset:3
217
//Emacs tab-width:8
218
//Emacs indent-tabs-mode:nil
219
//Emacs End:
220
//-----------------------------------------------------------------------------
221
© 2003-2013 by Zuse Institute Berlin (ZIB),
Imprint
Generated on Wed Jan 9 2013 for SoPlex by
doxygen