CbcBranchDecision.hpp
Go to the documentation of this file.
1 // Edwin 11/12/2009 carved from CbcBranchBase
2 #ifndef CbcBranchDecision_H
3 #define CbcBranchDecision_H
4 
5 #include "CbcBranchBase.hpp"
6 
19 class CbcModel;
20 class OsiChooseVariable;
21 
23 public:
26 
27  // Copy constructor
29 
31  virtual ~CbcBranchDecision();
32 
34  virtual CbcBranchDecision * clone() const = 0;
35 
37  virtual void initialize(CbcModel * model) = 0;
38 
48  virtual int
50  CbcBranchingObject * bestSoFar,
51  double changeUp, int numberInfeasibilitiesUp,
52  double changeDown, int numberInfeasibilitiesDown) = 0 ;
53 
60  virtual int
61  bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
62  double * changeUp, int * numberInfeasibilitiesUp,
63  double * changeDown, int * numberInfeasibilitiesDown,
64  double objectiveValue) ;
65 
68  virtual int whichMethod() {
69  return 2;
70  }
71 
74  virtual void saveBranchingObject(OsiBranchingObject * ) {}
77  virtual void updateInformation(OsiSolverInterface * ,
78  const CbcNode * ) {}
80  virtual void setBestCriterion(double ) {}
81  virtual double getBestCriterion() const {
82  return 0.0;
83  }
85  virtual void generateCpp( FILE * ) {}
87  inline CbcModel * cbcModel() const {
88  return model_;
89  }
90  /* If chooseMethod_ id non-null then the rest is fairly pointless
91  as choosemethod_ will be doing all work
92  This comment makes more sense if you realise that there's a conversion in
93  process from the Cbc branching classes to Osi branching classes. The test
94  for use of the Osi branching classes is CbcModel::branchingMethod_
95  non-null (i.e., it points to one of these CbcBranchDecision objects) and
96  that branch decision object has an OsiChooseVariable method set. In which
97  case, we'll use it, rather than the choose[*]Variable methods defined in
98  CbcNode.
99  */
100 
101  OsiChooseVariable * chooseMethod() const {
102  return chooseMethod_;
103  }
105  void setChooseMethod(const OsiChooseVariable & method);
106 
107 protected:
108 
109  // Clone of branching object
113  /* If chooseMethod_ id non-null then the rest is fairly pointless
114  as choosemethod_ will be doing all work
115  */
116  OsiChooseVariable * chooseMethod_;
117 private:
120 
121 };
122 #endif
123