Ignore:
Timestamp:
Aug 15, 2012 12:23:37 PM (8 years ago)
Author:
pbelotti
Message:

fixing not-so-integer variable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

    r898 r900  
    162162          problem_ -> Ub (j) - problem_ -> Lb (j) > .5) {
    163163
     164        // if (fabs (x [j] - floor (x [j] + .5)) >= SCIPfeastol (scip)) {
     165        //   printf ("integer var x%d not really integer: %e\n", j, x [j]);
     166        // }
     167
    164168        assert (fabs (lbs [j] - problem_ -> Lb (j)) < SCIPfeastol (scip));
    165169        assert (fabs (ubs [j] - problem_ -> Ub (j)) < SCIPfeastol (scip));
    166         assert (fabs (x [j] - floor (x [j] + .5))   < SCIPfeastol (scip));
     170        assert (fabs (x [j] - floor (x [j] + .5))   < 1e3 * SCIPfeastol (scip));
    167171
    168172        assert (nEntries <= 2*nvars - 2);
    169173
     174        double x_rounded = floor (x [j] + .5);
     175
    170176        if        (x [j] >= problem_ -> Ub (j) - COUENNE_EPS) {
    171177
    172178          tabuvars       [nEntries]   = vars [j];
    173           tabubounds     [nEntries]   = x  [j] - 1.;
     179          tabubounds     [nEntries]   = x_rounded - 1.;
    174180          tabuboundtypes [nEntries++] = SCIP_BOUNDTYPE_UPPER;
    175181
     
    177183
    178184          tabuvars       [nEntries]   = vars [j];
    179           tabubounds     [nEntries]   = x  [j] + 1.;
     185          tabubounds     [nEntries]   = x_rounded + 1.;
    180186          tabuboundtypes [nEntries++] = SCIP_BOUNDTYPE_LOWER;
    181187
     
    183189
    184190          tabuvars       [nEntries]   = vars [j];
    185           tabubounds     [nEntries]   = x  [j] - 1.;
     191          tabubounds     [nEntries]   = x_rounded - 1.;
    186192          tabuboundtypes [nEntries++] = SCIP_BOUNDTYPE_UPPER;
    187193
    188194          tabuvars       [nEntries]   = vars [j];
    189           tabubounds     [nEntries]   = x  [j] + 1.;
     195          tabubounds     [nEntries]   = x_rounded + 1.;
    190196          tabuboundtypes [nEntries++] = SCIP_BOUNDTYPE_LOWER;
    191197        }
Note: See TracChangeset for help on using the changeset viewer.