Changeset 317


Ignore:
Timestamp:
Mar 14, 2010 8:51:00 PM (10 years ago)
Author:
pbelotti
Message:

different treatment of case 5 of bounded bilinear (thanks to Andrew J. Miller).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/convex/operators/exprMul-upperHull.cpp

    r312 r317  
    261261    // Nothing to find. Just separate two inequalities at the same
    262262    // point, just using different support
    263     if (genMulCoeff (xLow, yLow, xUpp, yUpp, 0, cX,  cY,  cW) ||
    264         genMulCoeff (xLow, yLow, xUpp, yUpp, 1, cXp, cYp, cWp))
    265       return;
    266 
    267 #ifdef DEBUG
    268     printf ("coeffs: (%g,%g,%g) [(%g,%g,%g)]\n",
    269             cX,cY,cW, cXp, cYp, cWp);
    270 #endif
    271 
    272     c0X = cX * xLow;    c0Xp = cXp * xUpp;
    273     c0Y = cY * yLow;    c0Yp = cYp * yUpp;
    274     c0W = cW * wl;      c0Wp = cWp * wu; 
    275 
    276     twoIneqs = true;
     263    //if (genMulCoeff (xLow, yLow, xUpp, yUpp, 0, cX,  cY,  cW) ||
     264    //genMulCoeff (xLow, yLow, xUpp, yUpp, 1, cXp, cYp, cWp))
     265    //return;
     266
     267    // A more clever way (courtesy of Andrew J. Miller): find the
     268    // intersect on the lower (upper) curve on the line through xLP
     269    // and the upper (lower) point
     270
     271    CouNumber xLow2, yLow2, xUpp2, yUpp2;
     272
     273    if (findIntersection (xLow, yLow, x0, y0, NULL, &wu, NULL, NULL, &xUpp2, &yUpp2) &&
     274        genMulCoeff (xLow, yLow, xUpp, yUpp, 0, cX, cY, cW))
     275      return;
     276
     277    if (findIntersection (xUpp, yUpp, x0, y0, &wl, NULL, &xLow2, &yLow2, NULL, NULL) &&
     278        genMulCoeff (xLow, yLow, xUpp, yUpp, 1, cX, cY, cW))
     279      return;
     280
     281#ifdef DEBUG
     282    printf ("coeffs: (%g,%g,%g)\n", // [(%g,%g,%g)]\n",
     283            cX,cY,cW);
     284#endif
     285
     286//     c0X = cX * xLow;    c0Xp = cXp * xUpp;
     287//     c0Y = cY * yLow;    c0Yp = cYp * yUpp;
     288//     c0W = cW * wl;      c0Wp = cWp * wu; 
     289
     290//     twoIneqs = true;
    277291
    278292  } else {
Note: See TracChangeset for help on using the changeset viewer.