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

Last change on this file since 1293 was 1293, checked in by EdwinStraver, 10 years ago
File size: 3.5 KB
Line 
1// Edwin 11/10/2009-- carved out of CbcBranchActual
2#ifndef CbcSOSBranchingObject_H
3#define CbcSOSBranchingObject_H
4
5#include "CbcBranchBase.hpp"
6#include "CbcSOS.hpp"
7
8/** Branching object for Special ordered sets
9
10    Variable_ is the set id number (redundant, as the object also holds a
11    pointer to the set.
12 */
13class CbcSOSBranchingObject : public CbcBranchingObject {
14
15public:
16
17    // Default Constructor
18    CbcSOSBranchingObject ();
19
20    // Useful constructor
21    CbcSOSBranchingObject (CbcModel * model,  const CbcSOS * clique,
22                           int way,
23                           double separator);
24
25    // Copy constructor
26    CbcSOSBranchingObject ( const CbcSOSBranchingObject &);
27
28    // Assignment operator
29    CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs);
30
31    /// Clone
32    virtual CbcBranchingObject * clone() const;
33
34    // Destructor
35    virtual ~CbcSOSBranchingObject ();
36
37    using CbcBranchingObject::branch ;
38    /// Does next branch and updates state
39    virtual double branch();
40    /** Update bounds in solver as in 'branch' and update given bounds.
41        branchState is -1 for 'down' +1 for 'up' */
42    virtual void fix(OsiSolverInterface * solver,
43                     double * lower, double * upper,
44                     int branchState) const ;
45
46    /** Reset every information so that the branching object appears to point to
47        the previous child. This method does not need to modify anything in any
48        solver. */
49    virtual void previousBranch() {
50        CbcBranchingObject::previousBranch();
51        computeNonzeroRange();
52    }
53
54    using CbcBranchingObject::print ;
55    /** \brief Print something about branch - only if log level high
56    */
57    virtual void print();
58
59    /** Return the type (an integer identifier) of \c this */
60    virtual int type() const {
61        return 104;
62    }
63
64    /** Compare the original object of \c this with the original object of \c
65        brObj. Assumes that there is an ordering of the original objects.
66        This method should be invoked only if \c this and brObj are of the same
67        type.
68        Return negative/0/positive depending on whether \c this is
69        smaller/same/larger than the argument.
70    */
71    virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
72
73    /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
74        same type and must have the same original object, but they may have
75        different feasible regions.
76        Return the appropriate CbcRangeCompare value (first argument being the
77        sub/superset if that's the case). In case of overlap (and if \c
78        replaceIfOverlap is true) replace the current branching object with one
79        whose feasible region is the overlap.
80     */
81    virtual CbcRangeCompare compareBranchingObject
82    (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
83
84    /** Fill out the \c firstNonzero_ and \c lastNonzero_ data members */
85    void computeNonzeroRange();
86
87private:
88    /// data
89    const CbcSOS * set_;
90    /// separator
91    double separator_;
92    /** The following two members describe the range in the members_ of the
93        original object that whose upper bound is not fixed to 0. This is not
94        necessary for Cbc to function correctly, this is there for heuristics so
95        that separate branching decisions on the same object can be pooled into
96        one branching object. */
97    int firstNonzero_;
98    int lastNonzero_;
99};
100
101#endif
Note: See TracBrowser for help on using the repository browser.