source: trunk/Cbc/src/CbcBranchDefaultDecision.hpp @ 1422

Last change on this file since 1422 was 1357, checked in by coin, 10 years ago

run 'astyle -A4 -p' and dos2unix

File size: 3.2 KB
Line 
1// Edwin 11/10/2009-- carved out of CbcBranchActual
2#ifndef CbcBranchDefaultDecision_H
3#define CbcBranchDefaultDecision_H
4
5#include "CbcBranchBase.hpp"
6/** Branching decision default class
7
8  This class implements a simple default algorithm
9  (betterBranch()) for choosing a branching variable.
10*/
11
12class CbcBranchDefaultDecision : public CbcBranchDecision {
13public:
14    // Default Constructor
15    CbcBranchDefaultDecision ();
16
17    // Copy constructor
18    CbcBranchDefaultDecision ( const CbcBranchDefaultDecision &);
19
20    virtual ~CbcBranchDefaultDecision();
21
22    /// Clone
23    virtual CbcBranchDecision * clone() const;
24
25    /// Initialize, <i>e.g.</i> before the start of branch selection at a node
26    virtual void initialize(CbcModel * model);
27
28    /** \brief Compare two branching objects. Return nonzero if \p thisOne is
29           better than \p bestSoFar.
30
31      The routine compares branches using the values supplied in \p numInfUp and
32      \p numInfDn until a solution is found by search, after which it uses the
33      values supplied in \p changeUp and \p changeDn. The best branching object
34      seen so far and the associated parameter values are remembered in the
35      \c CbcBranchDefaultDecision object. The nonzero return value is +1 if the
36      up branch is preferred, -1 if the down branch is preferred.
37
38      As the names imply, the assumption is that the values supplied for
39      \p numInfUp and \p numInfDn will be the number of infeasibilities reported
40      by the branching object, and \p changeUp and \p changeDn will be the
41      estimated change in objective. Other measures can be used if desired.
42
43      Because an \c CbcBranchDefaultDecision object remembers the current best
44      branching candidate (#bestObject_) as well as the values used in the
45      comparison, the parameter \p bestSoFar is redundant, hence unused.
46    */
47    virtual int betterBranch(CbcBranchingObject * thisOne,
48                             CbcBranchingObject * bestSoFar,
49                             double changeUp, int numInfUp,
50                             double changeDn, int numInfDn);
51    /** Sets or gets best criterion so far */
52    virtual void setBestCriterion(double value);
53    virtual double getBestCriterion() const;
54
55    /** \brief Compare N branching objects. Return index of best
56        and sets way of branching in chosen object.
57
58      This routine is used only after strong branching.
59    */
60
61    virtual int
62    bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
63                double * changeUp, int * numberInfeasibilitiesUp,
64                double * changeDown, int * numberInfeasibilitiesDown,
65                double objectiveValue) ;
66private:
67
68    /// Illegal Assignment operator
69    CbcBranchDefaultDecision & operator=(const CbcBranchDefaultDecision& rhs);
70
71    /// data
72
73    /// "best" so far
74    double bestCriterion_;
75
76    /// Change up for best
77    double bestChangeUp_;
78
79    /// Number of infeasibilities for up
80    int bestNumberUp_;
81
82    /// Change down for best
83    double bestChangeDown_;
84
85    /// Pointer to best branching object
86    CbcBranchingObject * bestObject_;
87
88    /// Number of infeasibilities for down
89    int bestNumberDown_;
90
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.