Changeset 1234 for trunk


Ignore:
Timestamp:
Dec 10, 2017 12:25:59 PM (2 years ago)
Author:
pbelotti
Message:

fix duplicate index in fixpoint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/bound_tightening/FixPointGenCuts.cpp

    r1232 r1234  
    171171  for (int j=0; j<m; j++) { // for each row
    172172
    173     int nEl = A -> getVectorSize (j); // # elements in each row
     173    const int nEl = A->getVectorLast(j) - A->getVectorFirst(j), // A -> getVectorSize (j); // # elements in each row
     174      *rind = &ind [A->getVectorFirst (j)];
     175    const double *rcoe = &coe [A->getVectorFirst (j)];
    174176
    175177    if (!nEl)
     
    181183
    182184      for (int i=0; i<nEl; i++) {
    183         printf ("%+g x%d ", coe [i], ind [i]);
     185        printf ("%+g x%d ", rcoe [i], rind [i]);
    184186        fflush (stdout);
    185187      }
     
    191193
    192194    if (extendedModel_ || rlb [j] > -COUENNE_INFINITY)
    193       for (int i=0; i<nEl; i++)
    194         createRow (-1, ind [i], n, fplp, ind, coe, rlb [j], nEl, extendedModel_, j, m + nCuts); // downward constraints -- on x_i
     195      for (int i = A->getVectorFirst(j); i < A->getVectorLast(j); i++)
     196        createRow (-1, ind [i], n, fplp, rind, rcoe, rlb [j], nEl, extendedModel_, j, m + nCuts); // downward constraints -- on x_i
    195197
    196198    if (extendedModel_ || rub [j] <  COUENNE_INFINITY)
    197       for (int i=0; i<nEl; i++)
    198         createRow (+1, ind [i], n, fplp, ind, coe, rub [j], nEl, extendedModel_, j, m + nCuts); // downward constraints -- on x_i
     199      for (int i = A->getVectorFirst(j); i < A->getVectorLast(j); i++)
     200        createRow (+1, ind [i], n, fplp, rind, rcoe, rub [j], nEl, extendedModel_, j, m + nCuts); // downward constraints -- on x_i
    199201
    200202    // create (at most 2) cuts for the bL and bU elements //////////////////////
    201203
    202204    if (extendedModel_) {
    203       createRow (-1, 2*n     + j, n, fplp, ind, coe, rlb [j], nEl, extendedModel_, j, m + nCuts); // upward constraints -- on bL_i
    204       createRow (+1, 2*n + m + j, n, fplp, ind, coe, rub [j], nEl, extendedModel_, j, m + nCuts); // upward constraints -- on bU_i
    205     }
    206 
    207     ind += nEl;
    208     coe += nEl;
     205      createRow (-1, 2*n     + j, n, fplp, rind, rcoe, rlb [j], nEl, extendedModel_, j, m + nCuts); // upward constraints -- on bL_i
     206      createRow (+1, 2*n + m + j, n, fplp, rind, rcoe, rub [j], nEl, extendedModel_, j, m + nCuts); // upward constraints -- on bU_i
     207    }
    209208  }
    210209
     
    244243      createRow (+1, 2*n + m + nCuts + j, n, fplp, ind, coe, cut -> ub (), nEl, extendedModel_, m + j, m + nCuts); // upward constraints -- on bU_i
    245244    }
    246 
    247     ind += nEl;
    248     coe += nEl;
    249245  }
    250246
Note: See TracChangeset for help on using the changeset viewer.