coin-Cgl
Main Page
Namespaces
Classes
Files
File List
File Members
opt
build
coinor-cgl
coinor-cgl-0.55.0
Cgl
src
CglLandP
CglLandP.hpp
Go to the documentation of this file.
1
// Copyright (C) 2005, Pierre Bonami and others. All Rights Reserved.
2
// Author: Pierre Bonami
3
// Tepper School of Business
4
// Carnegie Mellon University, Pittsburgh, PA 15213
5
// Date: 07/21/05
6
//---------------------------------------------------------------------------
7
#ifndef CglLandP_H
8
#define CglLandP_H
9
10
//Several level of Debug
11
// 1 - A few simple sanity check
12
// 2 - do extra computations on cut quality
13
// 3 - Output cut in initial non-basic space (only if logLevel >= 3 )
14
// 4 - Double check (compute in two different ways) reduced cost and f+ f-
15
//#define LandP_DEBUG 1
16
17
18
#include "
CglLandPValidator.hpp
"
19
#include "
CglCutGenerator.hpp
"
20
#include "
CglParam.hpp
"
21
22
#ifdef DO_STAT
23
#include "CglLandPStats.hpp"
24
#endif
25
#include <iostream>
26
class
CoinWarmStartBasis;
31
namespace
LAP
32
{
33
enum
LapMessagesTypes
{
34
BEGIN_ROUND
,
35
END_ROUND
,
36
DURING_SEP
,
37
CUT_REJECTED
,
38
CUT_FAILED
,
39
LAP_CUT_FAILED_DO_MIG
,
40
LAP_MESSAGES_DUMMY_END
41
};
43
class
LapMessages
:
public
CoinMessages
44
{
45
public
:
47
LapMessages
( );
49
virtual
~LapMessages
(){}
50
};
51
class
CglLandPSimplex;
52
}
53
54
class
CglLandP
:
public
CglCutGenerator
55
{
56
friend
void
CglLandPUnitTest
(OsiSolverInterface *si,
const
std::string & mpsDir);
57
58
friend
class
LAP::CglLandPSimplex
;
59
friend
class
CftCglp
;
60
61
public
:
62
63
enum
SelectionRules
{
64
mostNegativeRc
,
65
bestPivot
,
66
initialReducedCosts
67
};
68
69
enum
ExtraCutsMode
{
70
none
,
71
AtOptimalBasis
,
72
WhenEnteringBasis
,
73
AllViolatedMigs
74
};
75
77
enum
SeparationSpaces
{
78
Fractional
=0 ,
79
Fractional_rc
,
80
Full
81
};
82
84
enum
Normalization
{
85
Unweighted
= 0,
86
WeightRHS
,
87
WeightLHS
,
88
WeightBoth
89
};
90
91
enum
LHSnorm
{
92
L1
= 0,
93
L2
,
94
SupportSize
,
95
Infinity
,
96
Average
,
97
Uniform
98
};
100
enum
RhsWeightType
{
101
Fixed
= 0 ,
102
Dynamic
103
};
106
class
Parameters
:
public
CglParam
107
{
108
public
:
110
Parameters
();
112
Parameters
(
const
Parameters
&other);
114
Parameters
&
operator=
(
const
Parameters
&other);
117
120
int
pivotLimit
;
123
int
pivotLimitInTree
;
125
int
maxCutPerRound
;
127
int
failedPivotLimit
;
130
int
degeneratePivotLimit
;
132
int
extraCutsLimit
;
136
137
double
pivotTol
;
139
double
away
;
141
mutable
double
timeLimit
;
143
double
singleCutTimeLimit
;
145
double
rhsWeight
;
147
150
151
bool
useTableauRow
;
153
bool
modularize
;
155
bool
strengthen
;
157
bool
countMistakenRc
;
159
SeparationSpaces
sepSpace
;
161
bool
perturb
;
163
Normalization
normalization
;
165
RhsWeightType
rhsWeightType
;
167
LHSnorm
lhs_norm
;
169
ExtraCutsMode
generateExtraCuts
;
171
SelectionRules
pivotSelection
;
173
};
174
175
177
CglLandP
(
const
CglLandP::Parameters
¶ms =
CglLandP::Parameters
(),
178
const
LAP::Validator
&
validator
=
LAP::Validator
());
180
~CglLandP
();
182
CglLandP
(
const
CglLandP
&source);
184
CglLandP
&
operator=
(
const
CglLandP
&rhs);
186
CglCutGenerator
*
clone
()
const
;
187
188
#ifdef DO_STAT
189
void
setIdString(
const
std::string &
id
) {
190
roundsStats_.setIdString(
id
);
191
}
192
#endif
193
196
197
virtual
void
generateCuts
(
const
OsiSolverInterface & si, OsiCuts & cs,
198
const
CglTreeInfo
info =
CglTreeInfo
())
const
;
199
201
202
virtual
bool
needsOptimalBasis
()
const
{
203
return
true
;
204
}
205
206
LAP::Validator
&
validator
() {
207
return
validator_
;
208
}
216
void
setLogLevel
(
int
level) {
217
handler_
->setLogLevel(level);
218
}
219
220
class
NoBasisError
:
public
CoinError
221
{
222
public
:
223
NoBasisError
(): CoinError(
"No basis available"
,
"LandP"
,
""
) {}
224
};
225
226
class
SimplexInterfaceError
:
public
CoinError
227
{
228
public
:
229
SimplexInterfaceError
(): CoinError(
"Invalid conversion to simplex interface"
,
"CglLandP"
,
"CglLandP"
) {}
230
};
231
Parameters
&
parameter
() {
232
return
params_
;
233
}
234
private
:
235
236
237
void
scanExtraCuts
(OsiCuts& cs,
const
double
* colsol)
const
;
238
239
Parameters
params_
;
240
242
struct
CachedData
{
243
CachedData
(
int
nBasics = 0 ,
int
nNonBasics = 0);
244
CachedData
(
const
CachedData
& source);
245
246
CachedData
&
operator=
(
const
CachedData
&source);
248
void
getData
(
const
OsiSolverInterface &si);
249
~CachedData
();
251
int
*
basics_
;
253
int
*
nonBasics_
;
255
int
nBasics_
;
257
int
nNonBasics_
;
259
CoinWarmStartBasis *
basis_
;
261
double
*
colsol_
;
263
double
*
slacks_
;
265
bool
*
integers_
;
266
};
269
int
getSortedFractionals
(CoinPackedVector &xFrac,
270
const
CachedData
& data,
271
const
CglLandP::Parameters
& params)
const
;
274
void
getSortedFractionalIndices
(std::vector<int>& indices,
275
const
CachedData
&data,
276
const
CglLandP::Parameters
& params)
const
;
278
mutable
CachedData
cached_
;
280
CoinMessageHandler *
handler_
;
282
CoinMessages
messages_
;
284
LAP::Validator
validator_
;
286
mutable
int
numrows_
;
288
mutable
int
numcols_
;
290
mutable
double
*
originalColLower_
;
292
mutable
double
*
originalColUpper_
;
294
mutable
bool
canLift_
;
296
mutable
OsiCuts
extraCuts_
;
297
#ifdef DO_STAT
298
public
:
300
mutable
roundsStatistics roundsStats_;
301
#endif
302
};
303
void
CglLandPUnitTest
(OsiSolverInterface *si,
const
std::string & mpsDir);
304
305
#endif
306
Generated on Tue Mar 1 2016 22:35:38 for coin-Cgl by
1.8.4