Main Page
Classes
Files
File List
File Members
opt
build
clp
clp-1.12.0
Clp
src
Idiot.hpp
Go to the documentation of this file.
1
/* $Id: Idiot.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2
// Copyright (C) 2002, International Business Machines
3
// Corporation and others. All Rights Reserved.
4
// "Idiot" as the name of this algorithm is copylefted. If you want to change
5
// the name then it should be something equally stupid (but not "Stupid") or
6
// even better something witty.
7
8
#ifndef Idiot_H
9
#define Idiot_H
10
#ifndef OSI_IDIOT
11
#include "
ClpSimplex.hpp
"
12
#define OsiSolverInterface ClpSimplex
13
#else
14
#include "OsiSolverInterface.hpp"
15
typedef
int
CoinBigIndex;
16
#endif
17
class
CoinMessageHandler;
18
class
CoinMessages;
20
typedef
struct
{
21
double
infeas
;
22
double
objval
;
23
double
dropThis
;
24
double
weighted
;
25
double
sumSquared
;
26
double
djAtBeginning
;
27
double
djAtEnd
;
28
int
iteration
;
29
}
IdiotResult
;
46
class
Idiot
{
47
48
public
:
49
54
Idiot
( );
57
Idiot
(
OsiSolverInterface
& model );
58
60
Idiot
(
const
Idiot
&);
62
Idiot
&
operator=
(
const
Idiot
& rhs);
64
~Idiot
( );
66
67
71
void
solve
();
74
void
crash
(
int
numberPass, CoinMessageHandler * handler,
75
const
CoinMessages * messages,
bool
doCrossover =
true
);
85
void
crossOver
(
int
mode);
87
88
94
inline
double
getStartingWeight
()
const
{
95
return
mu_
;
96
}
97
inline
void
setStartingWeight
(
double
value) {
98
mu_
= value;
99
}
102
inline
double
getWeightFactor
()
const
{
103
return
muFactor_
;
104
}
105
inline
void
setWeightFactor
(
double
value) {
106
muFactor_
= value;
107
}
111
inline
double
getFeasibilityTolerance
()
const
{
112
return
smallInfeas_
;
113
}
114
inline
void
setFeasibilityTolerance
(
double
value) {
115
smallInfeas_
= value;
116
}
120
inline
double
getReasonablyFeasible
()
const
{
121
return
reasonableInfeas_
;
122
}
123
inline
void
setReasonablyFeasible
(
double
value) {
124
reasonableInfeas_
= value;
125
}
128
inline
double
getExitInfeasibility
()
const
{
129
return
exitFeasibility_
;
130
}
131
inline
void
setExitInfeasibility
(
double
value) {
132
exitFeasibility_
= value;
133
}
136
inline
int
getMajorIterations
()
const
{
137
return
majorIterations_
;
138
}
139
inline
void
setMajorIterations
(
int
value) {
140
majorIterations_
= value;
141
}
148
inline
int
getMinorIterations
()
const
{
149
return
maxIts2_
;
150
}
151
inline
void
setMinorIterations
(
int
value) {
152
maxIts2_
= value;
153
}
154
// minor iterations for first time
155
inline
int
getMinorIterations0
()
const
{
156
return
maxIts_
;
157
}
158
inline
void
setMinorIterations0
(
int
value) {
159
maxIts_
= value;
160
}
164
inline
int
getReduceIterations
()
const
{
165
return
maxBigIts_
;
166
}
167
inline
void
setReduceIterations
(
int
value) {
168
maxBigIts_
= value;
169
}
171
inline
int
getLogLevel
()
const
{
172
return
logLevel_
;
173
}
174
inline
void
setLogLevel
(
int
value) {
175
logLevel_
= value;
176
}
178
inline
int
getLightweight
()
const
{
179
return
lightWeight_
;
180
}
181
inline
void
setLightweight
(
int
value) {
182
lightWeight_
= value;
183
}
185
inline
int
getStrategy
()
const
{
186
return
strategy_
;
187
}
188
inline
void
setStrategy
(
int
value) {
189
strategy_
= value;
190
}
192
inline
double
getDropEnoughFeasibility
()
const
{
193
return
dropEnoughFeasibility_
;
194
}
195
inline
void
setDropEnoughFeasibility
(
double
value) {
196
dropEnoughFeasibility_
= value;
197
}
199
inline
double
getDropEnoughWeighted
()
const
{
200
return
dropEnoughWeighted_
;
201
}
202
inline
void
setDropEnoughWeighted
(
double
value) {
203
dropEnoughWeighted_
= value;
204
}
206
207
209
private
:
210
212
// allow public!
213
public
:
214
void
solve2
(CoinMessageHandler * handler,
const
CoinMessages *messages);
215
private
:
216
IdiotResult
IdiSolve
(
217
int
nrows,
int
ncols,
double
* rowsol ,
double
* colsol,
218
double
* pi,
double
* djs,
const
double
* origcost ,
219
double
* rowlower,
220
double
* rowupper,
const
double
* lower,
221
const
double
* upper,
const
double
* element,
222
const
int
* row,
const
CoinBigIndex * colcc,
223
const
int
* length,
double
* lambda,
224
int
maxIts,
double
mu,
double
drop,
225
double
maxmin,
double
offset,
226
int
strategy,
double
djTol,
double
djExit,
double
djFlag,
227
CoinThreadRandom * randomNumberGenerator);
228
int
dropping
(
IdiotResult
result,
229
double
tolerance,
230
double
small,
231
int
*nbad);
232
IdiotResult
objval
(
int
nrows,
int
ncols,
double
* rowsol ,
double
* colsol,
233
double
* pi,
double
* djs,
const
double
* cost ,
234
const
double
* rowlower,
235
const
double
* rowupper,
const
double
* lower,
236
const
double
* upper,
const
double
* elemnt,
237
const
int
* row,
const
CoinBigIndex * columnStart,
238
const
int
* length,
int
extraBlock,
int
* rowExtra,
239
double
* solExtra,
double
* elemExtra,
double
* upperExtra,
240
double
* costExtra,
double
weight);
241
// Deals with whenUsed and slacks
242
int
cleanIteration
(
int
iteration,
int
ordinaryStart,
int
ordinaryEnd,
243
double
* colsol,
const
double
* lower,
const
double
* upper,
244
const
double
* rowLower,
const
double
* rowUpper,
245
const
double
* cost,
const
double
* element,
double
fixTolerance,
double
& objChange,
246
double
& infChange);
247
private
:
249
OsiSolverInterface
*
model_
;
250
251
double
djTolerance_
;
252
double
mu_
;
/* starting mu */
253
double
drop_
;
/* exit if drop over 5 checks less than this */
254
double
muFactor_
;
/* reduce mu by this */
255
double
stopMu_
;
/* exit if mu gets smaller than this */
256
double
smallInfeas_
;
/* feasibility tolerance */
257
double
reasonableInfeas_
;
/* use lambdas if feasibility less than this */
258
double
exitDrop_
;
/* candidate for stopping after a major iteration */
259
double
muAtExit_
;
/* mu on exit */
260
double
exitFeasibility_
;
/* exit if infeasibility less than this */
261
double
dropEnoughFeasibility_
;
/* okay if feasibility drop this factor */
262
double
dropEnoughWeighted_
;
/* okay if weighted obj drop this factor */
263
int
*
whenUsed_
;
/* array to say what was used */
264
int
maxBigIts_
;
/* always reduce mu after this */
265
int
maxIts_
;
/* do this many iterations on first go */
266
int
majorIterations_
;
267
int
logLevel_
;
268
int
logFreq_
;
269
int
checkFrequency_
;
/* can exit after 5 * this iterations (on drop) */
270
int
lambdaIterations_
;
/* do at least this many lambda iterations */
271
int
maxIts2_
;
/* do this many iterations on subsequent goes */
272
int
strategy_
;
/* 0 - default strategy
273
1 - do accelerator step but be cautious
274
2 - do not do accelerator step
275
4 - drop, exitDrop and djTolerance all relative
276
8 - keep accelerator step to theta=10.0
277
278
32 - Scale
279
512 - crossover
280
2048 - keep lambda across mu change
281
4096 - return best solution (not last found)
282
8192 - always do a presolve in crossover
283
16384 - costed slacks found - so whenUsed_ longer */
284
int
lightWeight_
;
// 0 - normal, 1 lightweight
285
};
286
#endif
Generated on Tue Mar 1 2016 22:38:52 by
1.8.4