Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
opt
build
coinor-cbc
coinor-cbc-2.5.0
debian
tmp
usr
include
coin
CbcCompareDefault.hpp
Go to the documentation of this file.
1
//Edwin 11/25/09 carved out of CbcCompareActual
2
#ifndef CbcCompareDefault_H
3
#define CbcCompareDefault_H
4
5
6
//#############################################################################
7
/* These are alternative strategies for node traversal.
8
They can take data etc for fine tuning
9
10
At present the node list is stored as a heap and the "test"
11
comparison function returns true if node y is better than node x.
12
13
*/
14
#include "
CbcNode.hpp
"
15
#include "
CbcCompareBase.hpp
"
16
#include "
CbcCompare.hpp
"
17
18
class
CbcModel
;
19
20
/* This is an example of a more complex rule with data
21
It is default after first solution
22
If weight is 0.0 then it is computed to hit first solution
23
less 5%
24
*/
25
class
CbcCompareDefault
:
public
CbcCompareBase
{
26
public
:
28
CbcCompareDefault
() ;
30
CbcCompareDefault
(
double
weight);
31
33
CbcCompareDefault
(
const
CbcCompareDefault
&rhs);
34
36
CbcCompareDefault
&
operator=
(
const
CbcCompareDefault
& rhs);
37
39
virtual
CbcCompareBase
*
clone
()
const
;
41
virtual
void
generateCpp
( FILE * fp);
42
43
~CbcCompareDefault
() ;
44
/* This returns true if weighted value of node y is less than
45
weighted value of node x */
46
virtual
bool
test
(
CbcNode
* x,
CbcNode
* y) ;
47
48
using
CbcCompareBase::newSolution
;
51
virtual
void
newSolution
(
CbcModel
* model,
52
double
objectiveAtContinuous,
53
int
numberInfeasibilitiesAtContinuous) ;
56
virtual
bool
every1000Nodes
(
CbcModel
* model,
int
numberNodes);
57
58
/* if weight == -1.0 then fewest infeasibilities (before solution)
59
if -2.0 then do breadth first just for first 1000 nodes
60
if -3.0 then depth first before solution
61
*/
62
inline
double
getWeight
()
const
{
63
return
weight_
;
64
}
65
inline
void
setWeight
(
double
weight) {
66
weight_
= weight;
67
}
69
inline
double
getCutoff
()
const
{
70
return
cutoff_
;
71
}
72
inline
void
setCutoff
(
double
cutoff) {
73
cutoff_
= cutoff;
74
}
76
inline
double
getBestPossible
()
const
{
77
return
bestPossible_
;
78
}
79
inline
void
setBestPossible
(
double
bestPossible) {
80
bestPossible_
= bestPossible;
81
}
83
inline
void
setBreadthDepth
(
int
value) {
84
breadthDepth_
= value;
85
}
87
void
startDive
(
CbcModel
* model);
89
void
cleanDive
();
90
protected
:
92
double
weight_
;
94
double
saveWeight_
;
96
double
cutoff_
;
98
double
bestPossible_
;
100
int
numberSolutions_
;
102
int
treeSize_
;
104
int
breadthDepth_
;
106
int
startNodeNumber_
;
108
int
afterNodeNumber_
;
109
};
110
111
#endif //CbcCompareDefault_H
112
Generated on Tue Mar 1 2016 22:38:12 by
1.8.4