00001 /* $Id: CouenneBab.hpp 795 2012-01-26 03:19:52Z pbelotti $ 00002 * 00003 * Name: CouenneBab.hpp 00004 * Author: Pietro Belotti 00005 * Purpose: B&B object 00006 * Created: 2012-01-25 00007 * 00008 * This file is licensed under the Eclipse Public License (EPL) 00009 */ 00010 00011 #ifndef COUENNEBAB_H 00012 #define COUENNEBAB_H 00013 00014 #include "BonCbc.hpp" 00015 00016 #include "BonBabSetupBase.hpp" 00017 //#include "CbcModel.hpp" 00018 00019 namespace Couenne { 00020 00021 //class BabSetupBase; 00022 00023 class CouenneProblem; 00024 00025 class CouenneBab: public Bonmin::Bab { 00026 00027 public: 00028 00029 // /** Integer optimization return codes.*/ 00030 // enum MipStatuses {FeasibleOptimal /** Optimum solution has been found and its optimality proved.*/, 00031 // ProvenInfeasible /** Problem has been proven to be infeasible.*/, 00032 // Feasible /** An integer solution to the problem has been found.*/, 00033 // UnboundedOrInfeasible /*Coninuous relaxation is unbounded.*/, 00034 // NoSolutionKnown/** No feasible solution to the problem is known*/, 00035 // NumMipStats}; 00036 00037 CouenneBab (); 00038 00039 virtual ~CouenneBab(); 00040 00041 virtual void branchAndBound (Bonmin::BabSetupBase &s); 00042 00043 // /**operator() performs the branchAndBound*/ 00044 // virtual void operator()(BabSetupBase & s); 00045 00046 // /**operator() performs the branchAndBound*/ 00047 // virtual void operator()(BabSetupBase * s){ 00048 // operator()(*s);} 00049 00052 const double * bestSolution() const 00053 { 00054 return bestSolution_; 00055 } 00056 00057 void setProblem (CouenneProblem *p); 00058 00060 double bestObj() const 00061 { 00062 return bestObj_; 00063 } 00064 00065 // /** return Mip Status */ 00066 // MipStatuses mipStatus() const 00067 // { 00068 // return mipStatus_; 00069 // } 00070 00071 // /** return the best known lower bound on the objective value*/ 00072 // double bestBound(); 00073 00074 // /** return the total number of nodes explored.*/ 00075 // int numNodes() const 00076 // { 00077 // return numNodes_; 00078 // } 00079 00080 // /** return the total number of iterations in the last mip solved.*/ 00081 // int iterationCount() 00082 // { 00083 // return mipIterationCount_; 00084 // } 00085 00086 // /** returns the value of the continuous relaxation. */ 00087 // double continuousRelaxation() 00088 // { 00089 // return continuousRelaxation_; 00090 // } 00091 00092 // /** virtual callback function to eventually modify objects for integer variable 00093 // (replace with user set). This is called after CbcModel::findIntegers */ 00094 // virtual void replaceIntegers(OsiObject ** objects, int numberObjects) 00095 // {} 00096 00097 // /** Get cbc model used to solve. */ 00098 // const CbcModel& model() const 00099 // { 00100 // return model_; 00101 // } 00102 00103 // /** Get cbc model used to solve as non-const, in case we want to 00104 // change options before things happen */ 00105 // CbcModel& model() 00106 // { 00107 // return model_; 00108 // } 00109 00110 // /** Say that algorithm is using Couenne.*/ 00111 // void setUsingCouenne(bool v) 00112 // { 00113 // usingCouenne_ = v; 00114 // } 00115 00116 // /** Get value of usingCouenne variable.*/ 00117 // bool getUsingCouenne() 00118 // { 00119 // return usingCouenne_; 00120 // } 00121 00122 protected: 00123 00124 CouenneProblem *problem_; 00125 00126 // /** Stores the solution of MIP. */ 00127 // double * bestSolution_; 00128 00129 // /** Status of the mip solved*/ 00130 // MipStatuses mipStatus_; 00131 00132 // /** objValue of MIP */ 00133 // double bestObj_; 00134 00135 // /** best known (lower) bound.*/ 00136 // double bestBound_; 00137 00138 // /** Continuous relaxation of the problem */ 00139 // double continuousRelaxation_; 00140 00141 // /** Number of nodes enumerated.*/ 00142 // int numNodes_; 00143 00144 // /** get total number of iterations in last mip solved.*/ 00145 // int mipIterationCount_; 00146 00147 // /** CbcModel used to solve problem.*/ 00148 // CbcModel model_; 00149 00150 // /** Message handler for CbcModel. */ 00151 // CoinMessageHandler * modelHandler_; 00152 00153 // /** \brief OsiObjects of the model. 00154 // * this is not null if and only if there are some non-simple-integer branching objects such as SOS constraints. 00155 // * It is up to CouenneBab to pass them over to appropriate components of the algorithm. */ 00156 // OsiObject** objects_; 00157 00158 // /** number of objects.*/ 00159 // int nObjects_; 00160 00161 // /** Say if current algorithm is Couenne.*/ 00162 // bool usingCouenne_; 00163 }; 00164 } 00165 00166 #endif