Ignore:
Timestamp:
Apr 10, 2008 1:55:10 PM (13 years ago)
Author:
ladanyi
Message:

Incorporated changes from branches/heur

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcBranchCut.cpp

    r904 r912  
    285285  return false;
    286286}
     287
     288/** Compare the original object of \c this with the original object of \c
     289    brObj. Assumes that there is an ordering of the original objects.
     290    This method should be invoked only if \c this and brObj are of the same
     291    type.
     292    Return negative/0/positive depending on whether \c this is
     293    smaller/same/larger than the argument.
     294*/
     295int
     296CbcCutBranchingObject::compareOriginalObject
     297(const CbcBranchingObject* brObj) const
     298{
     299  const CbcCutBranchingObject* br =
     300    dynamic_cast<const CbcCutBranchingObject*>(brObj);
     301  assert(br);
     302  const OsiRowCut& r0 = way_ == -1 ? down_ : up_;
     303  const OsiRowCut& r1 = br->way_ == -1 ? br->down_ : br->up_;
     304  return r0.row().compare(r1.row());
     305}
     306
     307/** Compare the \c this with \c brObj. \c this and \c brObj must be os the
     308    same type and must have the same original object, but they may have
     309    different feasible regions.
     310    Return the appropriate CbcRangeCompare value (first argument being the
     311    sub/superset if that's the case). In case of overlap (and if \c
     312    replaceIfOverlap is true) replace the current branching object with one
     313    whose feasible region is the overlap.
     314*/
     315
     316CbcRangeCompare
     317CbcCutBranchingObject::compareBranchingObject
     318(const CbcBranchingObject* brObj, const bool replaceIfOverlap)
     319{
     320  const CbcCutBranchingObject* br =
     321    dynamic_cast<const CbcCutBranchingObject*>(brObj);
     322  assert(br);
     323  OsiRowCut& r0 = way_ == -1 ? down_ : up_;
     324  const OsiRowCut& r1 = br->way_ == -1 ? br->down_ : br->up_;
     325  double thisBd[2];
     326  thisBd[0] = r0.lb();
     327  thisBd[1] = r0.ub();
     328  double otherBd[2];
     329  otherBd[0] = r1.lb();
     330  otherBd[1] = r1.ub();
     331  CbcRangeCompare comp = CbcCompareRanges(thisBd, otherBd, replaceIfOverlap);
     332  if (comp != CbcRangeOverlap || (comp==CbcRangeOverlap && !replaceIfOverlap)) {
     333    return comp;
     334  }
     335  r0.setLb(thisBd[0]);
     336  r0.setUb(thisBd[1]);
     337  return comp;
     338}
     339
     340//##############################################################################
    287341
    288342/** Default Constructor
Note: See TracChangeset for help on using the changeset viewer.