Bonmin 1.8.9
Loading...
Searching...
No Matches
BonSubMipSolver.hpp
Go to the documentation of this file.
1// (C) Copyright International Business Machines (IBM) 2006
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors :
6// P. Bonami, International Business Machines
7//
8// Date : 12/07/2006
9
10
11// Code separated from BonOaDecBase to try to clarify OAs
12#ifndef BonSubMipSolver_HPP
13#define BonSubMipSolver_HPP
14#include "IpSmartPtr.hpp"
15#include <string>
16/* forward declarations.*/
20class CbcStrategy;
21class CbcStrategyDefault;
22
23#include "OsiCuts.hpp"
24
25namespace Bonmin {
26 class RegisteredOptions;
27 class BabSetupBase;
30 {
31 public:
36 SubMipSolver(BabSetupBase &b, const std::string &prefix);
37
40
42
45
47 void setStrategy(CbcStrategyDefault * strategy);
48
50 const double * getLastSolution()
51 {
52 return integerSolution_;
53 }
54
56 {
57 return lowBound_;
58 }
59
60 void solve(double cutoff,
61 int loglevel,
62 double maxTime){
63 if(milp_strat_ == FindGoodSolution){
64 find_good_sol(cutoff, loglevel, maxTime);
65 }
66 else
67 optimize(cutoff, loglevel, maxTime);
68 }
69
70
72 void find_good_sol(double cutoff,
73 int loglevel,
74 double maxTime);
75
77 void optimize(double cutoff,
78 int loglevel,
79 double maxTime);
80
83 int loglevel,
84 double maxTime, const OsiCuts & cs);
85
87 inline double lowBound()
88 {
89 return lowBound_;
90 }
91
93 inline bool optimal()
94 {
95 return optimal_;
96 }
97
99 inline int nodeCount()
100 {
101 return nodeCount_;
102 }
103
105 inline int iterationCount()
106 {
107 return iterationCount_;
108 }
109
110
112
115 private:
121 double lowBound_;
123 bool optimal_;
125 double * integerSolution_;
127 CbcStrategyDefault * strategy_;
129 int nodeCount_;
131 int iterationCount_;
133 MILP_solve_strategy milp_strat_;
135 double gap_tol_;
137 bool ownClp_;
138 };
139
140}
141
142#endif
143
A class to have all elements necessary to setup a branch-and-bound.
A very simple class to provide a common interface for solving MIPs with Cplex and Cbc.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register options for that Oa based cut generation method.
int nodeCount()
Returns number of nodes in last solve.
const double * getLastSolution()
get the solution found in last local search (return NULL if no solution).
SubMipSolver(BabSetupBase &b, const std::string &prefix)
Constructor.
void solve(double cutoff, int loglevel, double maxTime)
void optimize(double cutoff, int loglevel, double maxTime)
update cutoff and optimize MIP.
void find_good_sol(double cutoff, int loglevel, double maxTime)
update cutoff and perform a local search to a good solution.
SubMipSolver(const SubMipSolver &copy)
Copy Constructor.
void setLpSolver(OsiSolverInterface *lp)
Assign lp solver.
OsiSolverInterface * solver()
void optimize_with_lazy_constraints(double cutoff, int loglevel, double maxTime, const OsiCuts &cs)
update cutoff, put OA constraints in cs as lazy constraints and optimize MIP.
double lowBound()
Returns lower bound.
bool optimal()
returns optimality status.
int iterationCount()
Returns number of simplex iterations in last solve.
void setStrategy(CbcStrategyDefault *strategy)
Assign a strategy.
(C) Copyright International Business Machines Corporation 2007