CbcBranchBase.hpp
Go to the documentation of this file.
1 /* $Id: CbcBranchBase.hpp 1400 2009-12-11 14:14:06Z lou $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcBranchBase_H
5 #define CbcBranchBase_H
6 
7 #include <string>
8 #include <vector>
9 #include "OsiBranchingObject.hpp"
10 
17 };
18 
19 #include "CbcObject.hpp"
20 #include "CbcBranchingObject.hpp"
21 #include "CbcBranchDecision.hpp"
22 #include "CbcConsequence.hpp"
23 #include "CbcObjectUpdateData.hpp"
24 
25 //##############################################################################
26 
33 static inline CbcRangeCompare
34 CbcCompareRanges(double* thisBd, const double* otherBd,
35  const bool replaceIfOverlap)
36 {
37  const double lbDiff = thisBd[0] - otherBd[0];
38  if (lbDiff < 0) { // lb of this < lb of other
39  if (thisBd[1] >= otherBd[1]) { // ub of this >= ub of other
40  return CbcRangeSuperset;
41  } else if (thisBd[1] < otherBd[0]) {
42  return CbcRangeDisjoint;
43  } else {
44  // overlap
45  if (replaceIfOverlap) {
46  thisBd[0] = otherBd[0];
47  }
48  return CbcRangeOverlap;
49  }
50  } else if (lbDiff > 0) { // lb of this > lb of other
51  if (thisBd[1] <= otherBd[1]) { // ub of this <= ub of other
52  return CbcRangeSubset;
53  } else if (thisBd[0] > otherBd[1]) {
54  return CbcRangeDisjoint;
55  } else {
56  // overlap
57  if (replaceIfOverlap) {
58  thisBd[1] = otherBd[1];
59  }
60  return CbcRangeOverlap;
61  }
62  } else { // lb of this == lb of other
63  if (thisBd[1] == otherBd[1]) {
64  return CbcRangeSame;
65  }
66  return thisBd[1] < otherBd[1] ? CbcRangeSubset : CbcRangeSuperset;
67  }
68 
69  return CbcRangeSame; // fake return
70 
71 }
72 
73 //#############################################################################
74 
75 #endif
76