Ignore:
Timestamp:
Dec 4, 2009 10:01:00 AM (10 years ago)
Author:
EdwinStraver
Message:

Combined CbcSOS with CbcSOSBranchingObject
Combined CbcNWay with CbcNWayBranchingObject
Combined CbcFollowOn? with CbcFixingBranchingObject?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcSOS.hpp

    r1293 r1350  
    147147    bool integerValued_;
    148148};
     149
     150/** Branching object for Special ordered sets
     151
     152    Variable_ is the set id number (redundant, as the object also holds a
     153    pointer to the set.
     154 */
     155class CbcSOSBranchingObject : public CbcBranchingObject {
     156
     157public:
     158
     159    // Default Constructor
     160    CbcSOSBranchingObject ();
     161
     162    // Useful constructor
     163    CbcSOSBranchingObject (CbcModel * model,  const CbcSOS * clique,
     164                           int way,
     165                           double separator);
     166
     167    // Copy constructor
     168    CbcSOSBranchingObject ( const CbcSOSBranchingObject &);
     169
     170    // Assignment operator
     171    CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs);
     172
     173    /// Clone
     174    virtual CbcBranchingObject * clone() const;
     175
     176    // Destructor
     177    virtual ~CbcSOSBranchingObject ();
     178
     179    using CbcBranchingObject::branch ;
     180    /// Does next branch and updates state
     181    virtual double branch();
     182    /** Update bounds in solver as in 'branch' and update given bounds.
     183        branchState is -1 for 'down' +1 for 'up' */
     184    virtual void fix(OsiSolverInterface * solver,
     185                     double * lower, double * upper,
     186                     int branchState) const ;
     187
     188    /** Reset every information so that the branching object appears to point to
     189        the previous child. This method does not need to modify anything in any
     190        solver. */
     191    virtual void previousBranch() {
     192        CbcBranchingObject::previousBranch();
     193        computeNonzeroRange();
     194    }
     195
     196    using CbcBranchingObject::print ;
     197    /** \brief Print something about branch - only if log level high
     198    */
     199    virtual void print();
     200
     201    /** Return the type (an integer identifier) of \c this */
     202    virtual int type() const {
     203        return 104;
     204    }
     205
     206    /** Compare the original object of \c this with the original object of \c
     207        brObj. Assumes that there is an ordering of the original objects.
     208        This method should be invoked only if \c this and brObj are of the same
     209        type.
     210        Return negative/0/positive depending on whether \c this is
     211        smaller/same/larger than the argument.
     212    */
     213    virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
     214
     215    /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
     216        same type and must have the same original object, but they may have
     217        different feasible regions.
     218        Return the appropriate CbcRangeCompare value (first argument being the
     219        sub/superset if that's the case). In case of overlap (and if \c
     220        replaceIfOverlap is true) replace the current branching object with one
     221        whose feasible region is the overlap.
     222     */
     223    virtual CbcRangeCompare compareBranchingObject
     224    (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
     225
     226    /** Fill out the \c firstNonzero_ and \c lastNonzero_ data members */
     227    void computeNonzeroRange();
     228
     229private:
     230    /// data
     231    const CbcSOS * set_;
     232    /// separator
     233    double separator_;
     234    /** The following two members describe the range in the members_ of the
     235        original object that whose upper bound is not fixed to 0. This is not
     236        necessary for Cbc to function correctly, this is there for heuristics so
     237        that separate branching decisions on the same object can be pooled into
     238        one branching object. */
     239    int firstNonzero_;
     240    int lastNonzero_;
     241};
    149242#endif
Note: See TracChangeset for help on using the changeset viewer.