Ignore:
Timestamp:
May 7, 2007 1:44:28 PM (13 years ago)
Author:
pbelotti
Message:

moved include files to make them doxygenable. Introduced three-way branching, with fixed intervals for now. Added check for small bound interval within all generateCuts()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Couenne/Couenne/src/branch/CouenneBranchingObject.cpp

    r531 r534  
    1010#include <CouenneBranchingObject.hpp>
    1111
    12 
    1312/// make branching point $\alpha$ away from current point:
    1413/// bp = alpha * current + (1-alpha) * midpoint
    1514
    16 CouNumber CouenneBranchingObject::alpha_ = 0.5;
     15CouNumber CouenneBranchingObject::alpha_ = 0.25;
    1716
    1817
     
    3029  int index = reference_ -> Index ();
    3130
     31  if (index < 0)
     32    printf ("Couenne: Warning, CouenneBranchingObject has negative reference's index\n");
     33
    3234  long double
    3335    x = expression::Variable (index),   // current solution
     
    3941  else if (x>u) x = u;
    4042
    41   if ((x > l + COUENNE_EPS) &&
    42       (x < u - COUENNE_EPS))      // x is not at the boundary
     43  // This two-way branching rule is only applied when both lower and
     44  // upper bound are finite. Otherwise, a CouenneThreeWayBranchObj is
     45  // used (see CouenneThreeWayBranchObj.hpp).
     46  //
     47  // The rule is as follows:
     48  //
     49  // - if x is well inside the interval (both bounds are infinite or
     50  // there is a difference of at least COU_NEAR_BOUND), set
     51  // value_ to x;
     52  //
     53  // - otherwise, try to get far from bounds by setting value_ to a
     54  // convex combination of current and midpoint
     55  //
     56  // TODO: consider branching value that maximizes distance from
     57  // current point (how?)
     58
     59  if (fabs (u-l) < COUENNE_EPS)
     60    printf ("Warning, interval is really tiny\n");
     61
     62  if ((x-l < COUENNE_NEAR_BOUND) ||
     63      (u-x < COUENNE_NEAR_BOUND))
     64    value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
     65  else value_ = x;
     66
     67  /*
     68  if ((x > l + COUENNE_NEAR_BOUND) &&
     69      (x < u - COUENNE_NEAR_BOUND))      // x is not at the boundary
    4370    value_ = x;
    44 
    4571  else // current point is at one of the bounds
    46     if ((l > - COUENNE_INFINITY + 1) &&
    47         (u <   COUENNE_INFINITY - 1))
     72    if ((l > - COUENNE_INFINITY) &&
     73        (u <   COUENNE_INFINITY))
    4874      // finite bounds, apply midpoint rule
    4975      value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
     
    5581      if (fabs (x-l) < COUENNE_EPS) value_ = l + (1+fabs (l)) / 2.;
    5682      else                          value_ = u - (1+fabs (u)) / 2.;
     83  */
    5784
    5885  if (0) {
     
    6693  }
    6794}
     95
    6896
    6997/** \brief Execute the actions required to branch, as specified by the
     
    80108  int way = (!branchIndex_) ? firstBranch_ : !firstBranch_,
    81109      ind = reference_ -> Index ();
     110
    82111  CouNumber l = solver -> getColLower () [ind],
    83112            u = solver -> getColUpper () [ind];
Note: See TracChangeset for help on using the changeset viewer.