/build/buildd/coinor-cbc-2.5.0/Cbc/src/CbcBranchDecision.hpp
Go to the documentation of this file.
00001 // Edwin 11/12/2009 carved from CbcBranchBase
00002 #ifndef CbcBranchDecision_H
00003 #define CbcBranchDecision_H
00004 
00005 #include "CbcBranchBase.hpp"
00006 
00019 class CbcModel;
00020 class OsiChooseVariable;
00021 
00022 class CbcBranchDecision {
00023 public:
00025     CbcBranchDecision ();
00026 
00027     // Copy constructor
00028     CbcBranchDecision ( const CbcBranchDecision &);
00029 
00031     virtual ~CbcBranchDecision();
00032 
00034     virtual CbcBranchDecision * clone() const = 0;
00035 
00037     virtual void initialize(CbcModel * model) = 0;
00038 
00048     virtual int
00049     betterBranch (CbcBranchingObject * thisOne,
00050                   CbcBranchingObject * bestSoFar,
00051                   double changeUp, int numberInfeasibilitiesUp,
00052                   double changeDown, int numberInfeasibilitiesDown) = 0 ;
00053 
00060     virtual int
00061     bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
00062                 double * changeUp, int * numberInfeasibilitiesUp,
00063                 double * changeDown, int * numberInfeasibilitiesDown,
00064                 double objectiveValue) ;
00065 
00068     virtual int whichMethod() {
00069         return 2;
00070     }
00071 
00074     virtual void saveBranchingObject(OsiBranchingObject * ) {}
00077     virtual void updateInformation(OsiSolverInterface * ,
00078                                    const CbcNode * ) {}
00080     virtual void setBestCriterion(double ) {}
00081     virtual double getBestCriterion() const {
00082         return 0.0;
00083     }
00085     virtual void generateCpp( FILE * ) {}
00087     inline CbcModel * cbcModel() const {
00088         return model_;
00089     }
00090     /* If chooseMethod_ id non-null then the rest is fairly pointless
00091        as choosemethod_ will be doing all work
00092      This comment makes more sense if you realise that there's a conversion in
00093      process from the Cbc branching classes to Osi branching classes. The test
00094      for use of the Osi branching classes is CbcModel::branchingMethod_
00095      non-null (i.e., it points to one of these CbcBranchDecision objects) and
00096      that branch decision object has an OsiChooseVariable method set. In which
00097      case, we'll use it, rather than the choose[*]Variable methods defined in
00098      CbcNode.
00099         */
00100 
00101     OsiChooseVariable * chooseMethod() const {
00102         return chooseMethod_;
00103     }
00105     void setChooseMethod(const OsiChooseVariable & method);
00106 
00107 protected:
00108 
00109     // Clone of branching object
00110     CbcBranchingObject * object_;
00112     CbcModel * model_;
00113     /* If chooseMethod_ id non-null then the rest is fairly pointless
00114        as choosemethod_ will be doing all work
00115     */
00116     OsiChooseVariable * chooseMethod_;
00117 private:
00119     CbcBranchDecision & operator=(const CbcBranchDecision& rhs);
00120 
00121 };
00122 #endif
00123