source: branches/sandbox/Cbc/src/CbcBranchDynamic.hpp @ 1347

Last change on this file since 1347 was 1347, checked in by EdwinStraver, 10 years ago

Combined CbcSimpleInteger? and CbcIntegerBranchingObject?
Combined CbcSimpleIntegerDynamicPseudoCost? and CbcIntegerPseudoCostBranchingObject?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: CbcBranchDynamic.hpp 1347 2009-12-03 22:11:02Z EdwinStraver $ */
2// Copyright (C) 2005, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef CbcBranchDynamic_H
5#define CbcBranchDynamic_H
6
7#include "CoinPackedMatrix.hpp"
8#include "CbcSimpleIntegerDynamicPseudoCost.hpp"
9#include "CbcDynamicPseudoCostBranchingObject.hpp"
10#include "CbcBranchActual.hpp"
11
12/** Branching decision dynamic class
13
14  This class implements a simple algorithm
15  (betterBranch()) for choosing a branching variable when dynamic pseudo costs.
16*/
17
18class CbcBranchDynamicDecision : public CbcBranchDecision {
19public:
20    // Default Constructor
21    CbcBranchDynamicDecision ();
22
23    // Copy constructor
24    CbcBranchDynamicDecision ( const CbcBranchDynamicDecision &);
25
26    virtual ~CbcBranchDynamicDecision();
27
28    /// Clone
29    virtual CbcBranchDecision * clone() const;
30
31    /// Initialize, <i>e.g.</i> before the start of branch selection at a node
32    virtual void initialize(CbcModel * model);
33
34    /** \brief Compare two branching objects. Return nonzero if \p thisOne is
35           better than \p bestSoFar.
36
37      The routine compares branches using the values supplied in \p numInfUp and
38      \p numInfDn until a solution is found by search, after which it uses the
39      values supplied in \p changeUp and \p changeDn. The best branching object
40      seen so far and the associated parameter values are remembered in the
41      \c CbcBranchDynamicDecision object. The nonzero return value is +1 if the
42      up branch is preferred, -1 if the down branch is preferred.
43
44      As the names imply, the assumption is that the values supplied for
45      \p numInfUp and \p numInfDn will be the number of infeasibilities reported
46      by the branching object, and \p changeUp and \p changeDn will be the
47      estimated change in objective. Other measures can be used if desired.
48
49      Because an \c CbcBranchDynamicDecision object remembers the current best
50      branching candidate (#bestObject_) as well as the values used in the
51      comparison, the parameter \p bestSoFar is redundant, hence unused.
52    */
53    virtual int betterBranch(CbcBranchingObject * thisOne,
54                             CbcBranchingObject * bestSoFar,
55                             double changeUp, int numInfUp,
56                             double changeDn, int numInfDn);
57    /** Sets or gets best criterion so far */
58    virtual void setBestCriterion(double value);
59    virtual double getBestCriterion() const;
60    /** Says whether this method can handle both methods -
61        1 better, 2 best, 3 both */
62    virtual int whichMethod() {
63        return 3;
64    }
65
66    /** Saves a clone of current branching object.  Can be used to update
67        information on object causing branch - after branch */
68    virtual void saveBranchingObject(OsiBranchingObject * object) ;
69    /** Pass in information on branch just done.
70        assumes object can get information from solver */
71    virtual void updateInformation(OsiSolverInterface * solver,
72                                   const CbcNode * node);
73
74
75private:
76
77    /// Illegal Assignment operator
78    CbcBranchDynamicDecision & operator=(const CbcBranchDynamicDecision& rhs);
79
80    /// data
81
82    /// "best" so far
83    double bestCriterion_;
84
85    /// Change up for best
86    double bestChangeUp_;
87
88    /// Number of infeasibilities for up
89    int bestNumberUp_;
90
91    /// Change down for best
92    double bestChangeDown_;
93
94    /// Number of infeasibilities for down
95    int bestNumberDown_;
96
97    /// Pointer to best branching object
98    CbcBranchingObject * bestObject_;
99};
100#endif
Note: See TracBrowser for help on using the repository browser.