00001 // (C) Copyright International Business Machines Corporation 2007 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Pierre Bonami, International Business Machines Corporation 00007 // 00008 // Date : 04/19/2007 00009 00010 #ifndef BonCbc_H 00011 #define BonCbc_H 00012 00013 //#include "BonBabSetupBase.hpp" 00014 #include "CbcModel.hpp" 00015 00016 namespace Bonmin 00017 { 00018 class BabSetupBase; 00019 class Bab 00020 { 00021 public: 00023 enum MipStatuses {FeasibleOptimal , 00024 ProvenInfeasible , 00025 Feasible , 00026 UnboundedOrInfeasible /*Coninuous relaxation is unbounded.*/, 00027 NoSolutionKnown}; 00029 Bab(); 00031 virtual ~Bab(); 00033 virtual void branchAndBound(BabSetupBase & s); 00034 00036 virtual void operator()(BabSetupBase & s); 00037 00039 virtual void operator()(BabSetupBase * s){ 00040 operator()(*s);} 00041 00044 const double * bestSolution() const 00045 { 00046 return bestSolution_; 00047 } 00049 double bestObj() const 00050 { 00051 return bestObj_; 00052 } 00053 00055 MipStatuses mipStatus() const 00056 { 00057 return mipStatus_; 00058 } 00060 double bestBound(); 00062 int numNodes() const 00063 { 00064 return numNodes_; 00065 } 00067 int iterationCount() 00068 { 00069 return mipIterationCount_; 00070 } 00072 double continuousRelaxation() 00073 { 00074 return continuousRelaxation_; 00075 } 00076 00079 virtual void replaceIntegers(OsiObject ** objects, int numberObjects) 00080 {} 00082 const CbcModel& model() const 00083 { 00084 return model_; 00085 } 00086 00089 CbcModel& model() 00090 { 00091 return model_; 00092 } 00094 void setUsingCouenne(bool v) 00095 { 00096 usingCouenne_ = v; 00097 } 00098 00100 bool getUsingCouenne() 00101 { 00102 return usingCouenne_; 00103 } 00104 protected: 00106 double * bestSolution_; 00107 00109 MipStatuses mipStatus_; 00111 double bestObj_; 00113 double bestBound_; 00115 double continuousRelaxation_; 00117 int numNodes_; 00119 int mipIterationCount_; 00121 CbcModel model_; 00123 CoinMessageHandler * modelHandler_; 00127 OsiObject** objects_; 00129 int nObjects_; 00130 00132 bool usingCouenne_; 00133 }; 00134 } 00135 #endif