Changeset 558


Ignore:
Timestamp:
May 31, 2007 4:11:46 PM (12 years ago)
Author:
pbelotti
Message:

fixed bug in setting branching point

Location:
branches/Couenne/Couenne/src
Files:
6 edited

Legend:

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

    r557 r558  
    7272    if (u < COUENNE_INFINITY)
    7373      if (l > - COUENNE_INFINITY)    value_ = alpha * x + (1. - alpha) * (l + u) / 2.;
    74       else                           value_ = (u<0) ? -(1+u) : u/2;
    75     else if (l > - COUENNE_INFINITY) value_ = (l>0) ?  (1+l) : l/2;
     74      else                           value_ = (u<0) ? (u-1) : u/2;
     75    else if (l > - COUENNE_INFINITY) value_ = (l>0) ? (l+1) : l/2;
    7676    else                             value_ = 0;
    7777  else value_ = x;
    7878
    7979  if (0) {
    80     printf ("=== x%d branches on %g (at %g) [%g,%g]\n",
     80    printf ("=== x%d will branch on %g (at %g) [%g,%g]\n",
    8181            index_,
    8282            value_,
  • branches/Couenne/Couenne/src/branch/CouenneObject.cpp

    r557 r558  
    6363  CouNumber delta = fabs (var - expr);
    6464
    65   //  CouNumber l  = info -> lower_ [index],
    66   //            u  = info -> upper_ [index];
    67   /*  if (0)
    68     if ((delta > COUENNE_EPS) &&
    69         ((fabs (u-l) < COUENNE_EPS) ||
    70         ((mymin (fabs (l), fabs (u)) > COUENNE_EPS) &&
    71          (fabs (u-l) / mymax (fabs (l), fabs (u)) < COUENNE_EPS)))) {
    72       //      ((mymin (fabs (lr), fabs (ur)) > COUENNE_EPS) &&
    73       //       (fabs (ur-lr) / mymax (fabs (lr), fabs (ur)) < COUENNE_EPS)))
    74 
    75       printf (". Inf: = |%.4f - %.4f| = %.4e. w [%.3f,%.3f], x [%.3f,%.3f] = %.4e ",  ////[%.2f,%.2f]
    76               var, expr, fabs (var - expr),
    77               info -> lower_ [reference_ -> Index ()],
    78               info -> upper_ [reference_ -> Index ()],
    79               l, u, u-l);
    80       reference_             -> print (std::cout); std::cout << " = ";
    81       reference_ -> Image () -> print (std::cout);
    82       printf ("\n");
    83     }
    84   */
    85   //printf (" delta=%.9f,l=%.9f,u=%.9f ", delta, l, u);
    86 
    8765  /// avoid branching on (relatively) small deltas
    8866  if (delta < COUENNE_EPS)
    89     /*||
    90       (fabs (u-l) < COUENNE_EPS) ||
    91       ((mymin (fabs (l), fabs (u)) > COUENNE_EPS) &&
    92       (fabs (u-l) / mymax (fabs (l), fabs (u)) < COUENNE_EPS)))*/
    93     //      ((mymin (fabs (lr), fabs (ur)) > COUENNE_EPS) &&
    94     //       (fabs (ur-lr) / mymax (fabs (lr), fabs (ur)) < COUENNE_EPS)))
    9567    delta = 0.;
    9668
     
    131103
    132104  if (0) {
    133 
    134     printf ("Inf |%+.4e - %+.4e| = %+.4e  %+.4e way %d, ind %d",  ////[%.2f,%.2f]
     105    printf ("Inf |%+g - %+g| = %+g  (delta=%+g) way %d, ind %d. ",  ////[%.2f,%.2f]
    135106            var, expr,
    136107            //      expression::Lbound (reference_ -> Index ()),
     
    214185                                                 int way) const {
    215186
    216   // way has suggestion from CouenneObject::infeasibility()
    217   // Well, not exactly... it seems
    218 
    219187  bool isint = reference_ -> isInteger ();
     188
     189  // way has suggestion from CouenneObject::infeasibility(), but not
     190  // as set in infeasibility, so we use the one stored in member
     191  // whichWay_
    220192
    221193  way = whichWay_;
     
    268240  int index;
    269241
    270   // Create a two- or three-way branching object according to
    271   // finiteness of the intervals. For now only check if argument
    272   // bounds are finite.
    273 
    274   // TODO: check if function is finite within the interval (if so,
    275   // two-way, if not, three-way). Could be operator-dependent, that
    276   // is,
    277   //
    278   // return reference_ -> BranchObject (brVar_);
     242  // Create a two-way branching object according to finiteness of the
     243  // intervals. For now only check if argument bounds are finite.
    279244
    280245  int ref_ind = reference_ -> Index ();
  • branches/Couenne/Couenne/src/branch/CouenneThreeWayBranchObj.cpp

    r557 r558  
    6666
    6767  if (0) {
    68     printf ("=3= x%d branches on %g and %g (at %g) [%g,%g]\n",
     68    printf ("=3= x%d will branch on %g ][ %g (now at %g) [%g,%g]\n",
    6969            index_,
    7070            lcrop_,
  • branches/Couenne/Couenne/src/branch/operators/branchExprMul.cpp

    r557 r558  
    1616
    1717#define LARGE_BOUND 9.9e12
    18 #define BOUND_WING 100
     18#define BOUND_WING 1
    1919
    2020/// set up branching object by evaluating many branching points for
  • branches/Couenne/Couenne/src/convex/createCuts.cpp

    r553 r558  
    4242  // cut has large coefficients/rhs, bail out
    4343  if (numerics || (fabs (rhs) > COU_MAX_COEFF)) {
    44     printf ("Warning, too large coefficients/rhs: %g (%d), %g (%d), %g (%d); %g\n",
     44    printf ("### Discarding cut, large coeff/rhs: %g (%d), %g (%d), %g (%d); %g\n",
    4545            c1, i1, c2, i2, c3, i3, rhs);
    4646    return 0;
  • branches/Couenne/Couenne/src/expression/CouennePrecisions.h

    r551 r558  
    2323#define COUENNE_INFINITY_SET  1.0e+60
    2424
    25 #define COU_MAX_COEFF     1e12
     25#define COU_MAX_COEFF     1e8
    2626
    2727#define COUENNE_round(x) ((int) (floor ((x) + 0.5)))
Note: See TracChangeset for help on using the changeset viewer.