00001 /* $Id: CouenneBab.hpp 853 2012-06-07 17:46:34Z stefan $ 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 void setProblem (CouenneProblem *p); 00042 00043 virtual void branchAndBound (Bonmin::BabSetupBase &s); 00044 00045 // /**operator() performs the branchAndBound*/ 00046 // virtual void operator()(BabSetupBase & s); 00047 00048 // /**operator() performs the branchAndBound*/ 00049 // virtual void operator()(BabSetupBase * s){ 00050 // operator()(*s);} 00051 00054 const double * bestSolution() const; 00055 00057 double bestObj() const; 00058 00059 // /** return Mip Status */ 00060 // MipStatuses mipStatus() const 00061 // { 00062 // return mipStatus_; 00063 // } 00064 00065 // /** return the best known lower bound on the objective value*/ 00066 // double bestBound(); 00067 00068 // /** return the total number of nodes explored.*/ 00069 // int numNodes() const 00070 // { 00071 // return numNodes_; 00072 // } 00073 00074 // /** return the total number of iterations in the last mip solved.*/ 00075 // int iterationCount() 00076 // { 00077 // return mipIterationCount_; 00078 // } 00079 00080 // /** returns the value of the continuous relaxation. */ 00081 // double continuousRelaxation() 00082 // { 00083 // return continuousRelaxation_; 00084 // } 00085 00086 // /** virtual callback function to eventually modify objects for integer variable 00087 // (replace with user set). This is called after CbcModel::findIntegers */ 00088 // virtual void replaceIntegers(OsiObject ** objects, int numberObjects) 00089 // {} 00090 00091 // /** Get cbc model used to solve. */ 00092 // const CbcModel& model() const 00093 // { 00094 // return model_; 00095 // } 00096 00097 // /** Get cbc model used to solve as non-const, in case we want to 00098 // change options before things happen */ 00099 // CbcModel& model() 00100 // { 00101 // return model_; 00102 // } 00103 00104 // /** Say that algorithm is using Couenne.*/ 00105 // void setUsingCouenne(bool v) 00106 // { 00107 // usingCouenne_ = v; 00108 // } 00109 00110 // /** Get value of usingCouenne variable.*/ 00111 // bool getUsingCouenne() 00112 // { 00113 // return usingCouenne_; 00114 // } 00115 00116 protected: 00117 00118 CouenneProblem *problem_; 00119 00120 // /** Stores the solution of MIP. */ 00121 // double * bestSolution_; 00122 00123 // /** Status of the mip solved*/ 00124 // MipStatuses mipStatus_; 00125 00126 // /** objValue of MIP */ 00127 // double bestObj_; 00128 00129 // /** best known (lower) bound.*/ 00130 // double bestBound_; 00131 00132 // /** Continuous relaxation of the problem */ 00133 // double continuousRelaxation_; 00134 00135 // /** Number of nodes enumerated.*/ 00136 // int numNodes_; 00137 00138 // /** get total number of iterations in last mip solved.*/ 00139 // int mipIterationCount_; 00140 00141 // /** CbcModel used to solve problem.*/ 00142 // CbcModel model_; 00143 00144 // /** Message handler for CbcModel. */ 00145 // CoinMessageHandler * modelHandler_; 00146 00147 // /** \brief OsiObjects of the model. 00148 // * this is not null if and only if there are some non-simple-integer branching objects such as SOS constraints. 00149 // * It is up to CouenneBab to pass them over to appropriate components of the algorithm. */ 00150 // OsiObject** objects_; 00151 00152 // /** number of objects.*/ 00153 // int nObjects_; 00154 00155 // /** Say if current algorithm is Couenne.*/ 00156 // bool usingCouenne_; 00157 }; 00158 } 00159 00160 #endif