Changeset 2388


Ignore:
Timestamp:
Oct 7, 2018 2:32:43 PM (9 months ago)
Author:
forrest
Message:

fixes for odd SOS

Location:
trunk/Cbc/src
Files:
2 edited

Legend:

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

    r2385 r2388  
    160160            continue;
    161161#endif
    162          if (v<1e-8)
     162         if (fabs(v)<1e-8)
    163163            v = 0.0;
    164164         if (lp->isInteger(idx))  // just to avoid small
  • trunk/Cbc/src/CbcSOS.cpp

    r2373 r2388  
    483483    double integerTolerance = ZERO_SOS_TOLERANCE;
    484484#endif
     485    double integerTolerance2 =
     486        model_->getDblParam(CbcModel::CbcIntegerTolerance);
     487    int firstNonZero2 = -1;
     488    int lastNonZero2 = -1;
    485489    double weight = 0.0;
    486490    double sum = 0.0;
     
    496500            lastNonZero = j;
    497501        }
     502        if (fabs(value) > integerTolerance2 && (upper[iColumn] || oddValues_)) {
     503            if (firstNonZero2 < 0)
     504                firstNonZero2 = j;
     505            lastNonZero2 = j;
     506        }
    498507    }
    499508    // Might get here in odd situation if so fix all
    500     if (lastNonZero - firstNonZero < sosType_) {
     509    if (lastNonZero - firstNonZero < sosType_||
     510        lastNonZero2 - firstNonZero2 < sosType_) {
     511      if (lastNonZero - firstNonZero >= sosType_) {
     512        // try with more forgiving tolerance
     513        firstNonZero=firstNonZero2;
     514        lastNonZero=lastNonZero2;
     515      }
    501516      for (j = 0; j < firstNonZero; j++) {
    502517        int iColumn = members_[j];
Note: See TracChangeset for help on using the changeset viewer.