source: branches/sandbox/Cbc/src/CbcNWayBranchingObject.hpp @ 1293

Last change on this file since 1293 was 1293, checked in by EdwinStraver, 10 years ago
File size: 3.2 KB
Line 
1// Edwin 11/10/2009-- carved out of CbcBranchActual
2#ifndef CbcNWayBranchingObject_H
3#define CbcNWayBranchingObject_H
4
5#include "CbcBranchBase.hpp"
6#include "CbcNWay.hpp"
7/** N way branching Object class.
8    Variable is number of set.
9 */
10class CbcNWayBranchingObject : public CbcBranchingObject {
11
12public:
13
14    // Default Constructor
15    CbcNWayBranchingObject ();
16
17    /** Useful constructor - order had matrix indices
18        way_ -1 corresponds to setting first, +1 to second, +3 etc.
19        this is so -1 and +1 have similarity to normal
20    */
21    CbcNWayBranchingObject (CbcModel * model,  const CbcNWay * nway,
22                            int numberBranches, const int * order);
23
24    // Copy constructor
25    CbcNWayBranchingObject ( const CbcNWayBranchingObject &);
26
27    // Assignment operator
28    CbcNWayBranchingObject & operator=( const CbcNWayBranchingObject& rhs);
29
30    /// Clone
31    virtual CbcBranchingObject * clone() const;
32
33    // Destructor
34    virtual ~CbcNWayBranchingObject ();
35
36    using CbcBranchingObject::branch ;
37    /// Does next branch and updates state
38    virtual double branch();
39
40#if 0
41    // FIXME: what do we need to do here?
42    /** Reset every information so that the branching object appears to point to
43        the previous child. This method does not need to modify anything in any
44        solver. */
45    virtual void previousBranch();
46#endif
47
48    using CbcBranchingObject::print ;
49    /** \brief Print something about branch - only if log level high
50    */
51    virtual void print();
52    /** The number of branch arms created for this branching object
53    */
54    virtual int numberBranches() const {
55        return numberInSet_;
56    }
57    /// Is this a two way object (-1 down, +1 up)
58    virtual bool twoWay() const {
59        return false;
60    }
61
62    /** Return the type (an integer identifier) of \c this */
63    virtual int type() const {
64        return 105;
65    }
66
67    /** Compare the original object of \c this with the original object of \c
68        brObj. Assumes that there is an ordering of the original objects.
69        This method should be invoked only if \c this and brObj are of the same
70        type.
71        Return negative/0/positive depending on whether \c this is
72        smaller/same/larger than the argument.
73    */
74    virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
75
76    /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
77        same type and must have the same original object, but they may have
78        different feasible regions.
79        Return the appropriate CbcRangeCompare value (first argument being the
80        sub/superset if that's the case). In case of overlap (and if \c
81        replaceIfOverlap is true) replace the current branching object with one
82        whose feasible region is the overlap.
83     */
84    virtual CbcRangeCompare compareBranchingObject
85    (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
86
87private:
88    /// order of branching - points back to CbcNWay
89    int * order_;
90    /// Points back to object
91    const CbcNWay * object_;
92    /// Number in set
93    int numberInSet_;
94};
95
96#endif
Note: See TracBrowser for help on using the repository browser.