source: branches/sandbox/Cbc/src/CbcDynamicPseudoCostBranchingObject.hpp @ 1308

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

Broke up CbcBranchDynamic? and CbcBranchLotsize?.cpp.
Updated spreadsheets.

File size: 3.9 KB
Line 
1// Edwin 11/17/2009-- carved out of CbcBranchDynamic
2#ifndef CbcDynamicPseudoCostBranchingObject_H
3#define CbcDynamicPseudoCostBranchingObject_H
4
5#include "CbcBranchDynamic.hpp"
6
7/** Simple branching object for an integer variable with pseudo costs
8
9  This object can specify a two-way branch on an integer variable. For each
10  arm of the branch, the upper and lower bounds on the variable can be
11  independently specified.
12
13  Variable_ holds the index of the integer variable in the integerVariable_
14  array of the model.
15*/
16
17class CbcDynamicPseudoCostBranchingObject : public CbcIntegerBranchingObject {
18
19public:
20
21    /// Default constructor
22    CbcDynamicPseudoCostBranchingObject ();
23
24    /** Create a standard floor/ceiling branch object
25
26      Specifies a simple two-way branch. Let \p value = x*. One arm of the
27      branch will be is lb <= x <= floor(x*), the other ceil(x*) <= x <= ub.
28      Specify way = -1 to set the object state to perform the down arm first,
29      way = 1 for the up arm.
30    */
31    CbcDynamicPseudoCostBranchingObject (CbcModel *model, int variable,
32                                         int way , double value,
33                                         CbcSimpleIntegerDynamicPseudoCost * object) ;
34
35    /** Create a degenerate branch object
36
37      Specifies a `one-way branch'. Calling branch() for this object will
38      always result in lowerValue <= x <= upperValue. Used to fix a variable
39      when lowerValue = upperValue.
40    */
41
42    CbcDynamicPseudoCostBranchingObject (CbcModel *model, int variable, int way,
43                                         double lowerValue, double upperValue) ;
44
45    /// Copy constructor
46    CbcDynamicPseudoCostBranchingObject ( const CbcDynamicPseudoCostBranchingObject &);
47
48    /// Assignment operator
49    CbcDynamicPseudoCostBranchingObject & operator= (const CbcDynamicPseudoCostBranchingObject& rhs);
50
51    /// Clone
52    virtual CbcBranchingObject * clone() const;
53
54    /// Destructor
55    virtual ~CbcDynamicPseudoCostBranchingObject ();
56
57    /// Does part of constructor
58    void fillPart (int variable,
59                   int way , double value,
60                   CbcSimpleIntegerDynamicPseudoCost * object) ;
61
62    using CbcBranchingObject::branch ;
63    /** \brief Sets the bounds for the variable according to the current arm
64           of the branch and advances the object state to the next arm.
65           This version also changes guessed objective value
66    */
67    virtual double branch();
68
69    /** Some branchingObjects may claim to be able to skip
70        strong branching.  If so they have to fill in CbcStrongInfo.
71        The object mention in incoming CbcStrongInfo must match.
72        Returns nonzero if skip is wanted */
73    virtual int fillStrongInfo( CbcStrongInfo & info);
74
75    /// Change in guessed
76    inline double changeInGuessed() const {
77        return changeInGuessed_;
78    }
79    /// Set change in guessed
80    inline void setChangeInGuessed(double value) {
81        changeInGuessed_ = value;
82    }
83    /// Return object
84    inline CbcSimpleIntegerDynamicPseudoCost * object() const {
85        return object_;
86    }
87    /// Set object
88    inline void setObject(CbcSimpleIntegerDynamicPseudoCost * object) {
89        object_ = object;
90    }
91
92    /** Return the type (an integer identifier) of \c this */
93    virtual int type() const {
94        return 400;
95    }
96
97    // LL: compareOriginalObject and compareBranchingObject are inherited from
98    // CbcIntegerBranchingObject thus need not be declared/defined here. After
99    // all, this kind of branching object is simply using pseudocosts to make
100    // decisions, but once the decisions are made they are the same kind as in
101    // the underlying class.
102
103protected:
104    /// Change in guessed objective value for next branch
105    double changeInGuessed_;
106    /// Pointer back to object
107    CbcSimpleIntegerDynamicPseudoCost * object_;
108
109};
110
111#endif
Note: See TracBrowser for help on using the repository browser.