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/convex/operators/conv-exprDiv.cpp

    r480 r534  
    2828                            OsiCuts &cs, const CouenneCutGenerator *cg) {
    2929
     30
    3031  // TODO: Use method on Tawarmalani-Sahinidis //////////////////////////////
    3132
    32   // get bounds of numerator and denominator
     33  // compute y bounds
    3334
    34   expression *yle, *yue;
    35 
    36   arglist_ [1] -> getBounds (yle, yue);
     35  expression *yle, *yue, *ye = arglist_ [1];
     36  ye -> getBounds (yle, yue);
    3737
    3838  CouNumber yl = (*yle) (),
    39             yu = (*yue) ();
     39            yu = (*yue) (), k;
     40
     41  delete yle; delete yue;
     42
     43  int xi = arglist_ [0] -> Index (),
     44      wi = w  -> Index (),
     45      yi = ye -> Index ();
    4046
    4147  // if the denominator's bound interval has 0 as internal point,
    4248  // there is no convexification
    4349
    44   if ((yl < - COUENNE_EPS) &&
    45       (yu >   COUENNE_EPS))
     50  if ((yl < -0) && (yu >  0))
    4651    return;
    4752
    48   expression *xle, *xue, *wle, *wue;
     53  // special case #1: y is almost constant (nonzero) --> y = k. We
     54  // only need a single plane w = x/k.
    4955
    50   arglist_ [0] -> getBounds (xle, xue);
    51   w            -> getBounds (wle, wue);
     56  if ((fabs (yl-yu) < COUENNE_EPS) && ((k = fabs (yl+yu) / 2) > COUENNE_EPS)) {
     57    cg -> createCut (cs, 0., 0, wi, -1, xi, 1/k);
     58    return;
     59  }
    5260
    53   expression *xe = arglist_ [0];
    54   expression *ye = arglist_ [1];
     61  // compute w bounds
    5562
    56   CouNumber wl = (*wle) (), wu = (*wue) ();
     63  expression *wle, *wue;
     64  w -> getBounds (wle, wue);
    5765
    58   delete yle; delete yue;
     66  CouNumber wl = (*wle) (),
     67            wu = (*wue) ();
     68
    5969  delete wle; delete wue;
    60   delete xle; delete xue;
     70
     71  // special case #2: w is almost constant (nonzero) --> w = x/y = k. We
     72  // only need a single plane x = y*k.
     73
     74  if ((fabs (wl-wu) < COUENNE_EPS) && ((k = fabs (wl+wu) / 2) > COUENNE_EPS)) {
     75    cg -> createCut (cs, 0., 0, yi, k, xi, -1.);
     76    return;
     77  }
    6178
    6279  // Add McCormick convexification cuts. Reduce w = x/y to x = wy and
     
    6986  // 4) x <= yu w + wl y - yu wl
    7087
    71   int xi = xe -> Index (),
    72       wi = w  -> Index (),
    73       yi = ye -> Index ();
    74 
    7588  if (is_boundbox_regular (yl, wl)) cg -> createCut (cs, yl*wl, -1, xi, -1., wi, yl, yi, wl);
    7689  if (is_boundbox_regular (yu, wu)) cg -> createCut (cs, yu*wu, -1, xi, -1., wi, yu, yi, wu);
Note: See TracChangeset for help on using the changeset viewer.