Changeset 361


Ignore:
Timestamp:
Jun 6, 2010 2:19:02 PM (10 years ago)
Author:
pbelotti
Message:

fixed bug on integer linearization cut

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/convex/addEnvelope.cpp

    r358 r361  
    5858
    5959  if (((!firstcall_) || ((x >= l) && (x <= u)))
     60      && !isnan (opp_slope)
    6061      && (fabs (opp_slope) < COUENNE_INFINITY)) {
    6162
    62     if (problem_ -> Var (x_ind) -> isInteger ()) {
     63    if (!(problem_ -> Var (x_ind) -> isInteger ()))
     64
     65      // normal cut
     66      createCut (cs, ft -> F (x) + opp_slope * x, sign, w_ind, 1.,
     67                 x_ind, opp_slope, -1, 0., is_global);
     68
     69    else {
    6370
    6471      // If the independent variable is integer, the envelope cut can
     
    8592      // Thanks to Sergey for gently encouraging me to do this :-)
    8693
    87 
    8894      CouNumber x1, x2, y1, y2;
    8995
     
    114120
    115121        createCut (cs, rhs, sign, w_ind, 1.,
    116                    x_ind, rhs, -1, 0., is_global);
     122                   x_ind, slope, -1, 0., is_global);
    117123      }
    118124
    119       // TODO: if the DEPENDENT variable is integer only, in principle
     125      // TODO: if the DEPENDENT variable is integer also, in principle
    120126      // the cut can be made tighter, but not as simply.
    121127
    122128    }
    123     else createCut (cs, ft -> F (x) + opp_slope * x, sign, w_ind, 1.,
    124                     x_ind, opp_slope, -1, 0., is_global);
    125129  }
    126130
Note: See TracChangeset for help on using the changeset viewer.