• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/tmp/buildd/coinor-cbc-2.5.0/debian/tmp/usr/include/coin/CbcBranchBase.hpp

Go to the documentation of this file.
00001 /* $Id: CbcBranchBase.hpp 1400 2009-12-11 14:14:06Z lou $ */
00002 // Copyright (C) 2002, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef CbcBranchBase_H
00005 #define CbcBranchBase_H
00006 
00007 #include <string>
00008 #include <vector>
00009 #include "OsiBranchingObject.hpp"
00010 
00011 enum CbcRangeCompare {
00012     CbcRangeSame,
00013     CbcRangeDisjoint,
00014     CbcRangeSubset,
00015     CbcRangeSuperset,
00016     CbcRangeOverlap
00017 };
00018 
00019 #include "CbcObject.hpp"
00020 #include "CbcBranchingObject.hpp"
00021 #include "CbcBranchDecision.hpp"
00022 #include "CbcConsequence.hpp"
00023 #include "CbcObjectUpdateData.hpp"
00024 
00025 //##############################################################################
00026 
00033 static inline CbcRangeCompare
00034 CbcCompareRanges(double* thisBd, const double* otherBd,
00035                  const bool replaceIfOverlap)
00036 {
00037     const double lbDiff = thisBd[0] - otherBd[0];
00038     if (lbDiff < 0) { // lb of this < lb of other
00039         if (thisBd[1] >= otherBd[1]) { // ub of this >= ub of other
00040             return CbcRangeSuperset;
00041         } else if (thisBd[1] < otherBd[0]) {
00042             return CbcRangeDisjoint;
00043         } else {
00044             // overlap
00045             if (replaceIfOverlap) {
00046                 thisBd[0] = otherBd[0];
00047             }
00048             return CbcRangeOverlap;
00049         }
00050     } else if (lbDiff > 0) { // lb of this > lb of other
00051         if (thisBd[1] <= otherBd[1]) { // ub of this <= ub of other
00052             return CbcRangeSubset;
00053         } else if (thisBd[0] > otherBd[1]) {
00054             return CbcRangeDisjoint;
00055         } else {
00056             // overlap
00057             if (replaceIfOverlap) {
00058                 thisBd[1] = otherBd[1];
00059             }
00060             return CbcRangeOverlap;
00061         }
00062     } else { // lb of this == lb of other
00063         if (thisBd[1] == otherBd[1]) {
00064             return CbcRangeSame;
00065         }
00066         return thisBd[1] < otherBd[1] ? CbcRangeSubset : CbcRangeSuperset;
00067     }
00068 
00069     return CbcRangeSame; // fake return
00070 
00071 }
00072 
00073 //#############################################################################
00074 
00075 #endif
00076 

Generated on Tue Sep 7 2010 20:23:52 by  doxygen 1.7.1