Bonmin  1.8.8
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 
16 namespace 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  {
79  return continuousRelaxation_;
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:
101  double * bestSolution_;
102 
106  double bestObj_;
108  double bestBound_;
116  CbcModel model_;
118  CoinMessageHandler * modelHandler_;
122  OsiObject** objects_;
125  };
126 }
127 #endif
Bab()
Constructor.
int nObjects_
number of objects.
Definition: BonCbc.hpp:124
double bestObj_
objValue of MIP
Definition: BonCbc.hpp:106
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
MipStatuses mipStatus_
Status of the mip solved.
Definition: BonCbc.hpp:104
MipStatuses
Integer optimization return codes.
Definition: BonCbc.hpp:23
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
double continuousRelaxation()
returns the value of the continuous relaxation.
Definition: BonCbc.hpp:77
double * bestSolution_
Stores the solution of MIP.
Definition: BonCbc.hpp:101
CbcModel model_
CbcModel used to solve problem.
Definition: BonCbc.hpp:116
double continuousRelaxation_
Continuous relaxation of the problem.
Definition: BonCbc.hpp:110
int numNodes_
Number of nodes enumerated.
Definition: BonCbc.hpp:112
virtual void operator()(BabSetupBase &s)
operator() performs the branchAndBound
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
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
int iterationCount()
return the total number of iterations in the last mip solved.
Definition: BonCbc.hpp:72
Problem has been proven to be infeasible.
Definition: BonCbc.hpp:24
double bestBound_
best known (lower) bound.
Definition: BonCbc.hpp:108
MipStatuses mipStatus() const
return Mip Status
Definition: BonCbc.hpp:58
const double * bestSolution() const
get the best solution known to the problem (is optimal if MipStatus is FeasibleOptimal).
Definition: BonCbc.hpp:47
An integer solution to the problem has been found.
Definition: BonCbc.hpp:25
No feasible solution to the problem is known.
Definition: BonCbc.hpp:27
Optimum solution has been found and its optimality proved.
Definition: BonCbc.hpp:23
int numNodes() const
return the total number of nodes explored.
Definition: BonCbc.hpp:67
double bestBound()
return the best known lower bound on the objective value
virtual void branchAndBound(BabSetupBase &s)
Perform a branch-and-bound using given setup.
virtual ~Bab()
destructor.
OsiObject ** objects_
OsiObjects of the model.
Definition: BonCbc.hpp:122
const CbcModel & model() const
Get cbc model used to solve.
Definition: BonCbc.hpp:87