Changeset 2420


Ignore:
Timestamp:
Nov 15, 2018 12:50:59 PM (8 months ago)
Author:
forrest
Message:

try and fix problem with tiny values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcSOS.cpp

    r2419 r2420  
    239239            throw CoinError("Weights too close together in SOS", "infeasibility", "CbcSOS");
    240240        double value = CoinMax(lower[iColumn], solution[iColumn]);
     241        value = CoinMin(upper[iColumn],value);
    241242        sum += value;
    242         /*
    243           If we're not making assumptions about integrality, why check integerTolerance
    244           here? Convenient tolerance? Why not just check against the upper bound?
    245 
    246           The calculation of weight looks to be a relic --- in the end, the value isn't
    247           used to calculate either the return value or preferredWay.
    248         */
    249243        if (fabs(value) > integerTolerance && (upper[iColumn] > 0.0 ||
    250244                                               oddValues_)) {
    251             // Possibly due to scaling a fixed variable might slip through
    252             if (value > upper[iColumn]) {
    253                 value = upper[iColumn];
    254                 // Could change to #ifdef CBC_DEBUG
    255 #ifndef NDEBUG
    256                 if (model_->messageHandler()->logLevel() > 2 &&
    257                     value > upper[iColumn] + integerTolerance)
    258                     printf("** Variable %d (%d) has value %g and upper bound of %g\n",
    259                            iColumn, j, value, upper[iColumn]);
    260 #endif
    261             }
    262             if (value < lower[iColumn]) {
    263                 value = lower[iColumn];
    264                 // Could change to #ifdef CBC_DEBUG
    265 #ifndef NDEBUG
    266                 if (model_->messageHandler()->logLevel() > 2 &&
    267                     value < lower[iColumn] - integerTolerance)
    268                     printf("** Variable %d (%d) has value %g and lower bound of %g\n",
    269                            iColumn, j, value, lower[iColumn]);
    270 #endif
    271             }
    272245            weight += weights_[j] * value;
    273246            if (firstNonZero < 0)
     
    505478        int iColumn = members_[j];
    506479        double value = CoinMax(lower[iColumn], solution[iColumn]);
     480        value = CoinMin(upper[iColumn],value);
    507481        sum += value;
    508482        if (fabs(value) > integerTolerance && (upper[iColumn] || oddValues_)) {
Note: See TracChangeset for help on using the changeset viewer.