Changeset 1055 for trunk


Ignore:
Timestamp:
Jan 31, 2014 1:27:50 PM (6 years ago)
Author:
fmargot
Message:

Fix tiny coefficients in generated cuts creating problem in resolve for Clp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/convex/operators/conv-exprTrilinear-gencuts.cpp

    r1053 r1055  
    12791279  for (int i = (int) cutIndices.size (); i--;) {
    12801280
    1281     int
    1282        size = (int) cutIndices [i].size (),
    1283       *ind  = new int [size];
    1284 
    1285     double *coe = new double [size];
    1286 
    12871281    // Fix right hand sides: all cuts have coefficients of w equal to
    12881282    // one, but they might be inequality-type auxiliaries.
     
    12951289    }
    12961290
    1297     if ((cutLb [i] > - COUENNE_INFINITY) ||
    1298         (cutUb [i] <   COUENNE_INFINITY)) {
    1299 
    1300       std::copy (cutIndices [i].begin (), cutIndices [i].end (), ind);
    1301       std::copy (cutCoeff   [i].begin (), cutCoeff   [i].end (), coe);
    1302 
    1303       OsiRowCut cut (cutLb [i], cutUb [i], 4, 4, ind, coe);
     1291    if ((cutLb [i] > - COUENNE_INFINITY/10) ||
     1292        (cutUb [i] <   COUENNE_INFINITY/10)) {
     1293
     1294      int
     1295        size = (int) cutIndices [i].size (),
     1296        *ind  = new int [size];
     1297     
     1298      double *coe = new double [size];
     1299
     1300      int cardCut = 0;
     1301      for(int fmi=0; fmi<4; fmi++) {
     1302        if(fabs(cutCoeff[i][fmi]) > 1e-8) {
     1303          ind[cardCut] = cutIndices[i][fmi];
     1304          coe[cardCut] = cutCoeff[i][fmi];
     1305          cardCut++;
     1306        }
     1307      }
     1308
     1309      OsiRowCut cut (cutLb [i], cutUb [i], 4, cardCut, ind, coe);
    13041310      //cut.print ();
    1305 
    1306       delete [] ind;
    1307       delete [] coe;
    13081311
    13091312      if (cg -> Problem () -> bestSol ()) {
Note: See TracChangeset for help on using the changeset viewer.