# CbcBranchDecision.hpp

Go to the documentation of this file.

    00001 // $Id$
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 // Edwin 11/12/2009 carved from CbcBranchBase
    00007
    00008 #ifndef CbcBranchDecision_H
    00009 #define CbcBranchDecision_H
    00010
    00011 #include "CbcBranchBase.hpp"
    00012
    00025 class CbcModel;
    00026 class OsiChooseVariable;
    00027
    00028 class CbcBranchDecision {
    00029 public:
    00031     CbcBranchDecision ();
    00032
    00033     // Copy constructor
    00034     CbcBranchDecision ( const CbcBranchDecision &);
    00035
    00037     virtual ~CbcBranchDecision();
    00038
    00040     virtual CbcBranchDecision * clone() const = 0;
    00041
    00043     virtual void initialize(CbcModel * model) = 0;
    00044
    00054     virtual int
    00055     betterBranch (CbcBranchingObject * thisOne,
    00056                   CbcBranchingObject * bestSoFar,
    00057                   double changeUp, int numberInfeasibilitiesUp,
    00058                   double changeDown, int numberInfeasibilitiesDown) = 0 ;
    00059
    00066     virtual int
    00067     bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
    00068                 double * changeUp, int * numberInfeasibilitiesUp,
    00069                 double * changeDown, int * numberInfeasibilitiesDown,
    00070                 double objectiveValue) ;
    00071
    00074     virtual int whichMethod() {
    00075         return 2;
    00076     }
    00077
    00080     virtual void saveBranchingObject(OsiBranchingObject * ) {}
    00083     virtual void updateInformation(OsiSolverInterface * ,
    00084                                    const CbcNode * ) {}
    00086     virtual void setBestCriterion(double ) {}
    00087     virtual double getBestCriterion() const {
    00088         return 0.0;
    00089     }
    00091     virtual void generateCpp( FILE * ) {}
    00093     inline CbcModel * cbcModel() const {
    00094         return model_;
    00095     }
    00096     /* If chooseMethod_ id non-null then the rest is fairly pointless
    00097        as choosemethod_ will be doing all work
    00098      This comment makes more sense if you realise that there's a conversion in
    00099      process from the Cbc branching classes to Osi branching classes. The test
    00100      for use of the Osi branching classes is CbcModel::branchingMethod_
    00101      non-null (i.e., it points to one of these CbcBranchDecision objects) and
    00102      that branch decision object has an OsiChooseVariable method set. In which
    00103      case, we'll use it, rather than the choose[*]Variable methods defined in
    00104      CbcNode.
    00105         */
    00106
    00107     OsiChooseVariable * chooseMethod() const {
    00108         return chooseMethod_;
    00109     }
    00111     void setChooseMethod(const OsiChooseVariable & method);
    00112
    00113 protected:
    00114
    00115     // Clone of branching object
    00116     CbcBranchingObject * object_;
    00118     CbcModel * model_;
    00119     /* If chooseMethod_ id non-null then the rest is fairly pointless
    00120        as choosemethod_ will be doing all work
    00121     */
    00122     OsiChooseVariable * chooseMethod_;
    00123 private:
    00125     CbcBranchDecision & operator=(const CbcBranchDecision& rhs);
    00126
    00127 };
    00128 #endif
    00129

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines