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
slufactor.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 slufactor.h
17
* @brief Implementation of Sparse Linear Solver.
18
*/
19
#ifndef _SLUFACTOR_H_
20
#define _SLUFACTOR_H_
21
22
#include <assert.h>
23
24
#include "
spxdefines.h
"
25
#include "
dvector.h
"
26
#include "
slinsolver.h
"
27
#include "
clufactor.h
"
28
29
namespace
soplex
30
{
31
/// maximum nr. of factorization updates allowed before refactorization.
32
#define MAXUPDATES 1000
33
34
/**@brief Implementation of Sparse Linear Solver.
35
* @ingroup Algo
36
*
37
* This class implements a #SLinSolver interface by using the sparse LU
38
* factorization implementet in #CLUFactor.
39
*/
40
class
SLUFactor
:
public
SLinSolver
,
protected
CLUFactor
41
{
42
public
:
43
44
//--------------------------------
45
/**@name Types */
46
//@{
47
/// Specifies how to perform \ref soplex::SLUFactor::change "change" method.
48
enum
UpdateType
49
{
50
ETA
= 0,
///<
51
FOREST_TOMLIN
///<
52
};
53
/// for convenience
54
typedef
SLinSolver::Status
Status
;
55
//@}
56
57
private
:
58
59
//--------------------------------
60
/**@name Private data */
61
//@{
62
DVector
vec
;
///< Temporary vector
63
SSVector
ssvec
;
///< Temporary semi-sparse vector
64
//@}
65
66
protected
:
67
68
//--------------------------------
69
/**@name Protected data */
70
//@{
71
bool
usetup
;
///< TRUE iff update vector has been setup
72
UpdateType
uptype
;
///< the current \ref soplex::SLUFactor::UpdateType "UpdateType".
73
SSVector
eta
;
///<
74
SSVector
forest
;
///< ? Update vector set up by solveRight4update() and solve2right4update()
75
Real
lastThreshold
;
///< pivoting threshold of last factorization
76
//@}
77
78
//--------------------------------
79
/**@name Control Parameters */
80
//@{
81
/// minimum threshold to use.
82
Real
minThreshold
;
83
/// minimum stability to achieve by setting threshold.
84
Real
minStability
;
85
/// |x| < epsililon is considered to be 0.
86
Real
epsilon
;
87
/// Time spent in solves
88
Timer
solveTime
;
89
/// Number of solves
90
int
solveCount
;
91
//@}
92
93
protected
:
94
95
//--------------------------------
96
/**@name Protected helpers */
97
//@{
98
///
99
void
freeAll
();
100
///
101
void
changeEta
(
int
idx,
SSVector
&
eta
);
102
//@}
103
104
105
public
:
106
107
//--------------------------------
108
/**@name Update type */
109
//@{
110
/// returns the current update type uptype.
111
UpdateType
utype
()
const
112
{
113
return
uptype
;
114
}
115
116
/// sets update type.
117
/** The new UpdateType becomes valid only after the next call to
118
method load().
119
*/
120
void
setUtype
(
UpdateType
tp)
121
{
122
uptype
= tp;
123
}
124
//@}
125
126
//--------------------------------
127
/**@name Derived from SLinSolver
128
See documentation of \ref soplex::SLinSolver "SLinSolver" for a
129
documentation of these methods.
130
*/
131
//@{
132
///
133
void
clear
();
134
///
135
int
dim
()
const
136
{
137
return
thedim
;
138
}
139
///
140
int
memory
()
const
141
{
142
return
nzCnt
+
l
.
start
[
l
.
firstUnused
];
143
}
144
///
145
const
char
*
getName
()
const
146
{
147
return
(
uptype
==
SLUFactor::ETA
) ?
"SLU-Eta"
:
"SLU-Forest-Tomlin"
;
148
}
149
///
150
Status
status
()
const
151
{
152
return
Status
(
stat
);
153
}
154
///
155
Real
stability
()
const
;
156
///
157
std::string
statistics
()
const
;
158
///
159
Status
load
(
const
SVector
*
vec
[],
int
dim
);
160
//@}
161
162
public
:
163
164
//--------------------------------
165
/**@name Solve */
166
//@{
167
/// Solves \f$Ax=b\f$.
168
void
solveRight
(
Vector
& x,
const
Vector
& b);
169
/// Solves \f$Ax=b\f$.
170
void
solveRight
(
SSVector
& x,
const
SVector
& b);
171
/// Solves \f$Ax=b\f$.
172
void
solveRight4update
(
SSVector
& x,
const
SVector
& b);
173
/// Solves \f$Ax=b\f$ and \f$Ay=d\f$.
174
void
solve2right4update
(
SSVector
& x,
Vector
& y,
const
SVector
& b,
SSVector
& d);
175
/// Solves \f$Ax=b\f$, \f$Ay=d\f$ and \f$Az=e\f$.
176
void
solve3right4update
(
SSVector
& x,
Vector
& y,
Vector
& z,
177
const
SVector
& b,
SSVector
& d,
SSVector
& e);
178
/// Solves \f$Ax=b\f$.
179
void
solveLeft
(
Vector
& x,
const
Vector
& b);
180
/// Solves \f$Ax=b\f$.
181
void
solveLeft
(
SSVector
& x,
const
SVector
& b);
182
/// Solves \f$Ax=b\f$ and \f$Ay=d\f$.
183
void
solveLeft
(
SSVector
& x,
Vector
& y,
const
SVector
& b,
SSVector
& d);
184
///
185
Status
change
(
int
idx,
const
SVector
& subst,
const
SSVector
*
eta
= 0);
186
//@}
187
188
//--------------------------------
189
/**@name Miscellaneous */
190
//@{
191
/// time spent in factorizations
192
Real
getFactorTime
()
const
193
{
194
return
factorTime
.
userTime
();
195
}
196
/// number of factorizations performed
197
int
getFactorCount
()
const
198
{
199
return
factorCount
;
200
}
201
/// time spent in solves
202
Real
getSolveTime
()
const
203
{
204
return
solveTime
.
userTime
();
205
}
206
/// number of solves performed
207
int
getSolveCount
()
const
208
{
209
return
solveCount
;
210
}
211
/// prints the LU factorization to stdout.
212
void
dump
()
const
;
213
214
/// consistency check.
215
bool
isConsistent
()
const
;
216
//@}
217
218
//------------------------------------
219
/**@name Constructors / Destructors */
220
//@{
221
/// default constructor.
222
SLUFactor
();
223
/// assignment operator.
224
SLUFactor
&
operator=
(
const
SLUFactor
& old);
225
/// copy constructor.
226
SLUFactor
(
const
SLUFactor
& old);
227
/// destructor.
228
virtual
~SLUFactor
();
229
/// clone function for polymorphism
230
inline
virtual
SLinSolver
*
clone
()
const
231
{
232
return
new
SLUFactor
(*
this
);
233
}
234
//@}
235
236
private
:
237
238
//------------------------------------
239
/**@name Private helpers */
240
//@{
241
/// used to implement the assignment operator
242
void
assign
(
const
SLUFactor
& old);
243
//@}
244
};
245
246
}
// namespace soplex
247
#endif // _SLUFACTOR_H_
248
249
//-----------------------------------------------------------------------------
250
//Emacs Local Variables:
251
//Emacs mode:c++
252
//Emacs c-basic-offset:3
253
//Emacs tab-width:8
254
//Emacs indent-tabs-mode:nil
255
//Emacs End:
256
//-----------------------------------------------------------------------------
© 2003-2013 by Zuse Institute Berlin (ZIB),
Imprint
Generated on Wed Jan 9 2013 for SoPlex by
doxygen