00001 // (C) Copyright International Business Machines (IBM) 2006 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // P. Bonami, International Business Machines 00007 // 00008 // Date : 12/07/2006 00009 00010 00011 // Code separated from BonOaDecBase to try to clarify OAs 00012 #ifndef BonSubMipSolver_HPP 00013 #define BonSubMipSolver_HPP 00014 #include "IpSmartPtr.hpp" 00015 /* forward declarations.*/ 00016 class OsiSolverInterface; 00017 class OsiClpSolverInterface; 00018 class OsiCpxSolverInterface; 00019 class CbcStrategy; 00020 class CbcStrategyDefault; 00021 class CbcModel; 00022 00023 namespace Bonmin { 00024 class RegisteredOptions; 00026 class SubMipSolver 00027 { 00028 public: 00030 SubMipSolver(OsiSolverInterface * lp = 0, 00031 const CbcStrategy * strategy = 0); 00032 00033 ~SubMipSolver(); 00034 00036 void setLpSolver(OsiSolverInterface * lp); 00037 00039 void setStrategy(CbcStrategyDefault * strategy); 00040 00042 const double * getLastSolution() 00043 { 00044 return integerSolution_; 00045 } 00046 00047 double getLowerBound() 00048 { 00049 return lowBound_; 00050 } 00052 void find_good_sol(double cutoff, 00053 int loglevel, 00054 double maxTime); 00055 00057 void optimize(double cutoff, 00058 int loglevel, 00059 double maxTime); 00060 00062 inline double lowBound() 00063 { 00064 return lowBound_; 00065 } 00066 00068 inline bool optimal() 00069 { 00070 return optimal_; 00071 } 00072 00074 inline int nodeCount() 00075 { 00076 return nodeCount_; 00077 } 00078 00080 inline int iterationCount() 00081 { 00082 return iterationCount_; 00083 } 00084 00085 00087 OsiSolverInterface * solver(){ 00088 return lp_; 00089 } 00090 static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); 00091 private: 00093 OsiSolverInterface * lp_; 00095 OsiClpSolverInterface *clp_; 00097 OsiCpxSolverInterface * cpx_; 00099 CbcModel * cbc_; 00101 double lowBound_; 00103 bool optimal_; 00105 double * integerSolution_; 00107 CbcStrategyDefault * strategy_; 00109 int nodeCount_; 00111 int iterationCount_; 00112 }; 00113 00114 } 00115 00116 #endif 00117