BonSubMipSolver.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef BonSubMipSolver_HPP
00013 #define BonSubMipSolver_HPP
00014 #include "IpSmartPtr.hpp"
00015 #include <string>
00016
00017 class OsiSolverInterface;
00018 class OsiClpSolverInterface;
00019 class OsiCpxSolverInterface;
00020 class CbcStrategy;
00021 class CbcStrategyDefault;
00022
00023 namespace Bonmin {
00024 class RegisteredOptions;
00025 class BabSetupBase;
00027 class SubMipSolver
00028 {
00029 public:
00030 enum MILP_solve_strategy{
00031 FindGoodSolution,
00032 GetOptimum};
00034 SubMipSolver(BabSetupBase &b, const std::string &prefix);
00035
00037 SubMipSolver(const SubMipSolver ©);
00038
00039 ~SubMipSolver();
00040
00042 void setLpSolver(OsiSolverInterface * lp);
00043
00045 void setStrategy(CbcStrategyDefault * strategy);
00046
00048 const double * getLastSolution()
00049 {
00050 return integerSolution_;
00051 }
00052
00053 double getLowerBound()
00054 {
00055 return lowBound_;
00056 }
00057
00058 void solve(double cutoff,
00059 int loglevel,
00060 double maxTime){
00061 if(milp_strat_ == FindGoodSolution){
00062 find_good_sol(cutoff, loglevel, maxTime);
00063 }
00064 else
00065 optimize(cutoff, loglevel, maxTime);
00066 }
00067
00068
00070 void find_good_sol(double cutoff,
00071 int loglevel,
00072 double maxTime);
00073
00075 void optimize(double cutoff,
00076 int loglevel,
00077 double maxTime);
00078
00080 inline double lowBound()
00081 {
00082 return lowBound_;
00083 }
00084
00086 inline bool optimal()
00087 {
00088 return optimal_;
00089 }
00090
00092 inline int nodeCount()
00093 {
00094 return nodeCount_;
00095 }
00096
00098 inline int iterationCount()
00099 {
00100 return iterationCount_;
00101 }
00102
00103
00104 OsiSolverInterface * solver();
00105
00107 static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions);
00108 private:
00110 OsiClpSolverInterface *clp_;
00112 OsiCpxSolverInterface * cpx_;
00114 double lowBound_;
00116 bool optimal_;
00118 double * integerSolution_;
00120 CbcStrategyDefault * strategy_;
00122 int nodeCount_;
00124 int iterationCount_;
00126 MILP_solve_strategy milp_strat_;
00128 double gap_tol_;
00130 bool ownClp_;
00131 };
00132
00133 }
00134
00135 #endif
00136