Main Page
Classes
Files
File List
File Members
var
build
temp
tmp.GbsVr1VNv1
4.0-0-0
clp
clp-1.12.0
Clp
src
ClpSolve.hpp
Go to the documentation of this file.
1
/* $Id: ClpSolve.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2
// Copyright (C) 2003, International Business Machines
3
// Corporation and others. All Rights Reserved.
4
5
/*
6
Authors
7
8
John Forrest
9
10
*/
11
#ifndef ClpSolve_H
12
#define ClpSolve_H
13
20
class
ClpSolve
{
21
22
public
:
23
25
enum
SolveType
{
26
useDual
= 0,
27
usePrimal
,
28
usePrimalorSprint
,
29
useBarrier
,
30
useBarrierNoCross
,
31
automatic
,
32
notImplemented
33
};
34
enum
PresolveType
{
35
presolveOn
= 0,
36
presolveOff
,
37
presolveNumber
,
38
presolveNumberCost
39
};
40
43
44
ClpSolve
( );
46
ClpSolve
(
SolveType
method,
PresolveType
presolveType,
47
int
numberPasses,
int
options[6],
48
int
extraInfo[6],
int
independentOptions[3]);
50
void
generateCpp
(FILE * fp);
52
ClpSolve
(
const
ClpSolve
&);
54
ClpSolve
&
operator=
(
const
ClpSolve
& rhs);
56
~ClpSolve
( );
58
103
void
setSpecialOption
(
int
which,
int
value,
int
extraInfo = -1);
104
int
getSpecialOption
(
int
which)
const
;
105
107
void
setSolveType
(
SolveType
method,
int
extraInfo = -1);
108
SolveType
getSolveType
();
109
110
// Presolve types
111
void
setPresolveType
(
PresolveType
amount,
int
extraInfo = -1);
112
PresolveType
getPresolveType
();
113
int
getPresolvePasses
()
const
;
115
int
getExtraInfo
(
int
which)
const
;
118
void
setInfeasibleReturn
(
bool
trueFalse);
119
inline
bool
infeasibleReturn
()
const
{
120
return
independentOptions_
[0] != 0;
121
}
123
inline
bool
doDual
()
const
{
124
return
(
independentOptions_
[1] & 1) == 0;
125
}
126
inline
void
setDoDual
(
bool
doDual_) {
127
if
(doDual_)
independentOptions_
[1] &= ~1;
128
else
independentOptions_
[1] |= 1;
129
}
131
inline
bool
doSingleton
()
const
{
132
return
(
independentOptions_
[1] & 2) == 0;
133
}
134
inline
void
setDoSingleton
(
bool
doSingleton_) {
135
if
(doSingleton_)
independentOptions_
[1] &= ~2;
136
else
independentOptions_
[1] |= 2;
137
}
139
inline
bool
doDoubleton
()
const
{
140
return
(
independentOptions_
[1] & 4) == 0;
141
}
142
inline
void
setDoDoubleton
(
bool
doDoubleton_) {
143
if
(doDoubleton_)
independentOptions_
[1] &= ~4;
144
else
independentOptions_
[1] |= 4;
145
}
147
inline
bool
doTripleton
()
const
{
148
return
(
independentOptions_
[1] & 8) == 0;
149
}
150
inline
void
setDoTripleton
(
bool
doTripleton_) {
151
if
(doTripleton_)
independentOptions_
[1] &= ~8;
152
else
independentOptions_
[1] |= 8;
153
}
155
inline
bool
doTighten
()
const
{
156
return
(
independentOptions_
[1] & 16) == 0;
157
}
158
inline
void
setDoTighten
(
bool
doTighten_) {
159
if
(doTighten_)
independentOptions_
[1] &= ~16;
160
else
independentOptions_
[1] |= 16;
161
}
163
inline
bool
doForcing
()
const
{
164
return
(
independentOptions_
[1] & 32) == 0;
165
}
166
inline
void
setDoForcing
(
bool
doForcing_) {
167
if
(doForcing_)
independentOptions_
[1] &= ~32;
168
else
independentOptions_
[1] |= 32;
169
}
171
inline
bool
doImpliedFree
()
const
{
172
return
(
independentOptions_
[1] & 64) == 0;
173
}
174
inline
void
setDoImpliedFree
(
bool
doImpliedfree) {
175
if
(doImpliedfree)
independentOptions_
[1] &= ~64;
176
else
independentOptions_
[1] |= 64;
177
}
179
inline
bool
doDupcol
()
const
{
180
return
(
independentOptions_
[1] & 128) == 0;
181
}
182
inline
void
setDoDupcol
(
bool
doDupcol_) {
183
if
(doDupcol_)
independentOptions_
[1] &= ~128;
184
else
independentOptions_
[1] |= 128;
185
}
187
inline
bool
doDuprow
()
const
{
188
return
(
independentOptions_
[1] & 256) == 0;
189
}
190
inline
void
setDoDuprow
(
bool
doDuprow_) {
191
if
(doDuprow_)
independentOptions_
[1] &= ~256;
192
else
independentOptions_
[1] |= 256;
193
}
195
inline
bool
doSingletonColumn
()
const
{
196
return
(
independentOptions_
[1] & 512) == 0;
197
}
198
inline
void
setDoSingletonColumn
(
bool
doSingleton_) {
199
if
(doSingleton_)
independentOptions_
[1] &= ~512;
200
else
independentOptions_
[1] |= 512;
201
}
203
inline
int
presolveActions
()
const
{
204
return
independentOptions_
[1] & 0xffff;
205
}
206
inline
void
setPresolveActions
(
int
action) {
207
independentOptions_
[1] = (
independentOptions_
[1] & 0xffff0000) | (action & 0xffff);
208
}
210
inline
int
substitution
()
const
{
211
return
independentOptions_
[2];
212
}
213
inline
void
setSubstitution
(
int
value) {
214
independentOptions_
[2] = value;
215
}
217
219
private
:
220
224
225
SolveType
method_
;
227
PresolveType
presolveType_
;
229
int
numberPasses_
;
231
int
options_
[7];
233
int
extraInfo_
[7];
239
int
independentOptions_
[3];
241
};
242
244
class
ClpSimplexProgress
{
245
246
public
:
247
248
251
252
ClpSimplexProgress
( );
253
255
ClpSimplexProgress
(
ClpSimplex
* model );
256
258
ClpSimplexProgress
(
const
ClpSimplexProgress
&);
259
261
ClpSimplexProgress
&
operator=
(
const
ClpSimplexProgress
& rhs);
263
~ClpSimplexProgress
( );
265
void
reset
();
267
void
fillFromModel
(
ClpSimplex
* model );
268
270
276
int
looping
( );
278
void
startCheck
();
280
int
cycle
(
int
in,
int
out,
int
wayIn,
int
wayOut);
281
283
double
lastObjective
(
int
back = 1)
const
;
285
void
setInfeasibility
(
double
value);
287
double
lastInfeasibility
(
int
back = 1)
const
;
289
void
modifyObjective
(
double
value);
291
int
lastIterationNumber
(
int
back = 1)
const
;
293
void
clearIterationNumbers
();
295
inline
void
newOddState
() {
296
oddState_
= -
oddState_
- 1;
297
}
298
inline
void
endOddState
() {
299
oddState_
= abs(
oddState_
);
300
}
301
inline
void
clearOddState
() {
302
oddState_
= 0;
303
}
304
inline
int
oddState
()
const
{
305
return
oddState_
;
306
}
308
inline
int
badTimes
()
const
{
309
return
numberBadTimes_
;
310
}
311
inline
void
clearBadTimes
() {
312
numberBadTimes_
= 0;
313
}
315
inline
int
reallyBadTimes
()
const
{
316
return
numberReallyBadTimes_
;
317
}
318
inline
void
incrementReallyBadTimes
() {
319
numberReallyBadTimes_
++;
320
}
322
inline
int
timesFlagged
()
const
{
323
return
numberTimesFlagged_
;
324
}
325
inline
void
clearTimesFlagged
() {
326
numberTimesFlagged_
= 0;
327
}
328
inline
void
incrementTimesFlagged
() {
329
numberTimesFlagged_
++;
330
}
331
333
334
#define CLP_PROGRESS 5
335
//#define CLP_PROGRESS_WEIGHT 10
337
338
double
objective_
[
CLP_PROGRESS
];
340
double
infeasibility_
[
CLP_PROGRESS
];
342
double
realInfeasibility_
[
CLP_PROGRESS
];
343
#ifdef CLP_PROGRESS_WEIGHT
344
345
double
objectiveWeight_[CLP_PROGRESS_WEIGHT];
347
double
infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
349
double
realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
351
double
drop_;
353
double
best_;
354
#endif
355
356
double
initialWeight_
;
357
#define CLP_CYCLE 12
358
359
//double obj_[CLP_CYCLE];
360
int
in_
[
CLP_CYCLE
];
361
int
out_
[
CLP_CYCLE
];
362
char
way_
[
CLP_CYCLE
];
364
ClpSimplex
*
model_
;
366
int
numberInfeasibilities_
[
CLP_PROGRESS
];
368
int
iterationNumber_
[
CLP_PROGRESS
];
369
#ifdef CLP_PROGRESS_WEIGHT
370
371
int
numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
373
int
iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
374
#endif
375
376
int
numberTimes_
;
378
int
numberBadTimes_
;
380
int
numberReallyBadTimes_
;
382
int
numberTimesFlagged_
;
384
int
oddState_
;
386
};
387
#endif
Generated on Sat Nov 1 2014 02:18:49 by
1.8.1.2