Bonmin 1.8.9
Loading...
Searching...
No Matches
BonCbc.hpp
Go to the documentation of this file.
1// (C) Copyright International Business Machines Corporation 2007
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors :
6// Pierre Bonami, International Business Machines Corporation
7//
8// Date : 04/19/2007
9
10#ifndef BonCbc_H
11#define BonCbc_H
12
13//#include "BonBabSetupBase.hpp"
14#include "CbcModel.hpp"
15
16namespace Bonmin
17{
18 class BabSetupBase;
19 class Bab
20 {
21 public:
26 UnboundedOrInfeasible /*Coninuous relaxation is unbounded.*/,
29
30
32 Bab();
34 virtual ~Bab();
36 virtual void branchAndBound(BabSetupBase & s);
37
39 virtual void operator()(BabSetupBase & s);
40
42 virtual void operator()(BabSetupBase * s){
43 operator()(*s);}
44
47 const double * bestSolution() const
48 {
49 return bestSolution_;
50 }
52 double bestObj() const
53 {
54 return bestObj_;
55 }
56
59 {
60 return mipStatus_;
61 }
62
64 double bestBound();
65
67 int numNodes() const
68 {
69 return numNodes_;
70 }
73 {
74 return mipIterationCount_;
75 }
78 {
80 }
81
84 virtual void replaceIntegers(OsiObject ** objects, int numberObjects)
85 {}
87 const CbcModel& model() const
88 {
89 return model_;
90 }
91
94 CbcModel& model()
95 {
96 return model_;
97 }
98
99 protected:
102
106 double bestObj_;
116 CbcModel model_;
125 };
126}
127#endif
A class to have all elements necessary to setup a branch-and-bound.
double bestObj() const
return objective value of the bestSolution
Definition BonCbc.hpp:52
double bestBound()
return the best known lower bound on the objective value
int numNodes_
Number of nodes enumerated.
Definition BonCbc.hpp:112
CbcModel & model()
Get cbc model used to solve as non-const, in case we want to change options before things happen.
Definition BonCbc.hpp:94
const CbcModel & model() const
Get cbc model used to solve.
Definition BonCbc.hpp:87
double bestObj_
objValue of MIP
Definition BonCbc.hpp:106
int numNodes() const
return the total number of nodes explored.
Definition BonCbc.hpp:67
virtual ~Bab()
destructor.
MipStatuses mipStatus() const
return Mip Status
Definition BonCbc.hpp:58
MipStatuses
Integer optimization return codes.
Definition BonCbc.hpp:23
@ Feasible
An integer solution to the problem has been found.
Definition BonCbc.hpp:25
@ UnboundedOrInfeasible
Definition BonCbc.hpp:26
@ FeasibleOptimal
Optimum solution has been found and its optimality proved.
Definition BonCbc.hpp:23
@ ProvenInfeasible
Problem has been proven to be infeasible.
Definition BonCbc.hpp:24
@ NoSolutionKnown
No feasible solution to the problem is known.
Definition BonCbc.hpp:27
OsiObject ** objects_
OsiObjects of the model.
Definition BonCbc.hpp:122
int nObjects_
number of objects.
Definition BonCbc.hpp:124
virtual void replaceIntegers(OsiObject **objects, int numberObjects)
virtual callback function to eventually modify objects for integer variable (replace with user set).
Definition BonCbc.hpp:84
virtual void operator()(BabSetupBase &s)
operator() performs the branchAndBound
int iterationCount()
return the total number of iterations in the last mip solved.
Definition BonCbc.hpp:72
virtual void branchAndBound(BabSetupBase &s)
Perform a branch-and-bound using given setup.
double bestBound_
best known (lower) bound.
Definition BonCbc.hpp:108
MipStatuses mipStatus_
Status of the mip solved.
Definition BonCbc.hpp:104
const double * bestSolution() const
get the best solution known to the problem (is optimal if MipStatus is FeasibleOptimal).
Definition BonCbc.hpp:47
double continuousRelaxation_
Continuous relaxation of the problem.
Definition BonCbc.hpp:110
Bab()
Constructor.
CbcModel model_
CbcModel used to solve problem.
Definition BonCbc.hpp:116
int mipIterationCount_
get total number of iterations in last mip solved.
Definition BonCbc.hpp:114
virtual void operator()(BabSetupBase *s)
operator() performs the branchAndBound
Definition BonCbc.hpp:42
CoinMessageHandler * modelHandler_
Message handler for CbcModel.
Definition BonCbc.hpp:118
double * bestSolution_
Stores the solution of MIP.
Definition BonCbc.hpp:101
double continuousRelaxation()
returns the value of the continuous relaxation.
Definition BonCbc.hpp:77
(C) Copyright International Business Machines Corporation 2007