Cbc  2.10.10
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcBranchDecision.hpp
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 // Edwin 11/12/2009 carved from CbcBranchBase
7 
8 #ifndef CbcBranchDecision_H
9 #define CbcBranchDecision_H
10 
11 #include "CbcBranchBase.hpp"
12 
25 class CbcModel;
26 class OsiChooseVariable;
27 
29 public:
32 
33  // Copy constructor
35 
37  virtual ~CbcBranchDecision();
38 
40  virtual CbcBranchDecision *clone() const = 0;
41 
43  virtual void initialize(CbcModel *model) = 0;
44 
54  virtual int
56  CbcBranchingObject *bestSoFar,
57  double changeUp, int numberInfeasibilitiesUp,
58  double changeDown, int numberInfeasibilitiesDown)
59  = 0;
60 
67  virtual int
68  bestBranch(CbcBranchingObject **objects, int numberObjects, int numberUnsatisfied,
69  double *changeUp, int *numberInfeasibilitiesUp,
70  double *changeDown, int *numberInfeasibilitiesDown,
71  double objectiveValue);
72 
75  virtual int whichMethod()
76  {
77  return 2;
78  }
79 
82  virtual void saveBranchingObject(OsiBranchingObject *) {}
85  virtual void updateInformation(OsiSolverInterface *,
86  const CbcNode *) {}
88  virtual void setBestCriterion(double) {}
89  virtual double getBestCriterion() const
90  {
91  return 0.0;
92  }
94  virtual void generateCpp(FILE *) {}
96  inline CbcModel *cbcModel() const
97  {
98  return model_;
99  }
100  /* If chooseMethod_ id non-null then the rest is fairly pointless
101  as choosemethod_ will be doing all work
102  This comment makes more sense if you realise that there's a conversion in
103  process from the Cbc branching classes to Osi branching classes. The test
104  for use of the Osi branching classes is CbcModel::branchingMethod_
105  non-null (i.e., it points to one of these CbcBranchDecision objects) and
106  that branch decision object has an OsiChooseVariable method set. In which
107  case, we'll use it, rather than the choose[*]Variable methods defined in
108  CbcNode.
109  */
110 
111  OsiChooseVariable *chooseMethod() const
112  {
113  return chooseMethod_;
114  }
116  void setChooseMethod(const OsiChooseVariable &method);
117 
118 protected:
119  // Clone of branching object
123  /* If chooseMethod_ id non-null then the rest is fairly pointless
124  as choosemethod_ will be doing all work
125  */
126  OsiChooseVariable *chooseMethod_;
127 
128 private:
131 };
132 #endif
133 
134 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
135 */
CbcBranchDecision::getBestCriterion
virtual double getBestCriterion() const
Definition: CbcBranchDecision.hpp:89
CbcBranchDecision::operator=
CbcBranchDecision & operator=(const CbcBranchDecision &rhs)
Assignment is illegal.
CbcBranchDecision::bestBranch
virtual int bestBranch(CbcBranchingObject **objects, int numberObjects, int numberUnsatisfied, double *changeUp, int *numberInfeasibilitiesUp, double *changeDown, int *numberInfeasibilitiesDown, double objectiveValue)
Compare N branching objects.
CbcBranchDecision::~CbcBranchDecision
virtual ~CbcBranchDecision()
Destructor.
CbcBranchDecision::betterBranch
virtual int betterBranch(CbcBranchingObject *thisOne, CbcBranchingObject *bestSoFar, double changeUp, int numberInfeasibilitiesUp, double changeDown, int numberInfeasibilitiesDown)=0
Compare two branching objects.
CbcBranchDecision::model_
CbcModel * model_
Pointer to model.
Definition: CbcBranchDecision.hpp:122
CbcBranchDecision::setBestCriterion
virtual void setBestCriterion(double)
Sets or gets best criterion so far.
Definition: CbcBranchDecision.hpp:88
CbcBranchDecision::whichMethod
virtual int whichMethod()
Says whether this method can handle both methods - 1 better, 2 best, 3 both.
Definition: CbcBranchDecision.hpp:75
CbcBranchDecision::chooseMethod
OsiChooseVariable * chooseMethod() const
Definition: CbcBranchDecision.hpp:111
CbcBranchDecision::object_
CbcBranchingObject * object_
Definition: CbcBranchDecision.hpp:120
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcBranchDecision::cbcModel
CbcModel * cbcModel() const
Model.
Definition: CbcBranchDecision.hpp:96
CbcBranchingObject
Abstract branching object base class Now just difference with OsiBranchingObject.
Definition: CbcBranchingObject.hpp:51
CbcBranchDecision::CbcBranchDecision
CbcBranchDecision()
Default Constructor.
CbcBranchBase.hpp
CbcBranchDecision
Definition: CbcBranchDecision.hpp:28
CbcBranchDecision::generateCpp
virtual void generateCpp(FILE *)
Create C++ lines to get to current state.
Definition: CbcBranchDecision.hpp:94
CbcBranchDecision::clone
virtual CbcBranchDecision * clone() const =0
Clone.
CbcNode
Information required while the node is live.
Definition: CbcNode.hpp:49
CbcBranchDecision::setChooseMethod
void setChooseMethod(const OsiChooseVariable &method)
Set (clone) chooseMethod.
CbcBranchDecision::saveBranchingObject
virtual void saveBranchingObject(OsiBranchingObject *)
Saves a clone of current branching object.
Definition: CbcBranchDecision.hpp:82
CbcBranchDecision::initialize
virtual void initialize(CbcModel *model)=0
Initialize e.g. before starting to choose a branch at a node.
CbcBranchDecision::chooseMethod_
OsiChooseVariable * chooseMethod_
Definition: CbcBranchDecision.hpp:126
CbcBranchDecision::updateInformation
virtual void updateInformation(OsiSolverInterface *, const CbcNode *)
Pass in information on branch just done.
Definition: CbcBranchDecision.hpp:85