Cbc
2.10.13
Toggle main menu visibility
Loading...
Searching...
No Matches
Cbc
src
CbcBranchBase.hpp
Go to the documentation of this file.
1
/* $Id$ */
2
// Copyright (C) 2002, International Business Machines
3
// Corporation and others. All Rights Reserved.
4
// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6
#ifndef CbcBranchBase_H
7
#define CbcBranchBase_H
8
9
#include <string>
10
#include <vector>
11
#include "OsiBranchingObject.hpp"
12
13
enum
CbcRangeCompare
{
14
CbcRangeSame
,
15
CbcRangeDisjoint
,
16
CbcRangeSubset
,
17
CbcRangeSuperset
,
18
CbcRangeOverlap
19
};
20
21
#include "
CbcObject.hpp
"
22
#include "
CbcBranchingObject.hpp
"
23
#include "
CbcBranchDecision.hpp
"
24
#include "
CbcConsequence.hpp
"
25
#include "
CbcObjectUpdateData.hpp
"
26
27
//##############################################################################
28
35
static
inline
CbcRangeCompare
36
CbcCompareRanges
(
double
*thisBd,
const
double
*otherBd,
37
const
bool
replaceIfOverlap)
38
{
39
const
double
lbDiff = thisBd[0] - otherBd[0];
40
if
(lbDiff < 0) {
// lb of this < lb of other
41
if
(thisBd[1] >= otherBd[1]) {
// ub of this >= ub of other
42
return
CbcRangeSuperset
;
43
}
else
if
(thisBd[1] < otherBd[0]) {
44
return
CbcRangeDisjoint
;
45
}
else
{
46
// overlap
47
if
(replaceIfOverlap) {
48
thisBd[0] = otherBd[0];
49
}
50
return
CbcRangeOverlap
;
51
}
52
}
else
if
(lbDiff > 0) {
// lb of this > lb of other
53
if
(thisBd[1] <= otherBd[1]) {
// ub of this <= ub of other
54
return
CbcRangeSubset
;
55
}
else
if
(thisBd[0] > otherBd[1]) {
56
return
CbcRangeDisjoint
;
57
}
else
{
58
// overlap
59
if
(replaceIfOverlap) {
60
thisBd[1] = otherBd[1];
61
}
62
return
CbcRangeOverlap
;
63
}
64
}
else
{
// lb of this == lb of other
65
if
(thisBd[1] == otherBd[1]) {
66
return
CbcRangeSame
;
67
}
68
return
thisBd[1] < otherBd[1] ?
CbcRangeSubset
:
CbcRangeSuperset
;
69
}
70
71
return
CbcRangeSame
;
// fake return
72
}
73
74
//#############################################################################
75
76
#endif
77
78
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
79
*/
CbcRangeCompare
CbcRangeCompare
Definition
CbcBranchBase.hpp:13
CbcRangeSubset
@ CbcRangeSubset
Definition
CbcBranchBase.hpp:16
CbcRangeSame
@ CbcRangeSame
Definition
CbcBranchBase.hpp:14
CbcRangeDisjoint
@ CbcRangeDisjoint
Definition
CbcBranchBase.hpp:15
CbcRangeOverlap
@ CbcRangeOverlap
Definition
CbcBranchBase.hpp:18
CbcRangeSuperset
@ CbcRangeSuperset
Definition
CbcBranchBase.hpp:17
CbcCompareRanges
static CbcRangeCompare CbcCompareRanges(double *thisBd, const double *otherBd, const bool replaceIfOverlap)
Compare two ranges.
Definition
CbcBranchBase.hpp:36
CbcBranchDecision.hpp
CbcBranchingObject.hpp
CbcConsequence.hpp
CbcObjectUpdateData.hpp
CbcObject.hpp
Generated by
1.17.0