Ignore:
Timestamp:
Jun 20, 2014 8:44:51 AM (5 years ago)
Author:
forrest
Message:

fixes for odd SOS

File:
1 edited

Legend:

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

    r1900 r2040  
    461461        }
    462462    }
    463     assert (lastNonZero - firstNonZero < sosType_) ;
    464     for (j = 0; j < firstNonZero; j++) {
     463    // Might get here in odd situation if so fix all
     464    if (lastNonZero - firstNonZero < sosType_) {
     465      for (j = 0; j < firstNonZero; j++) {
    465466        int iColumn = members_[j];
    466467        solver->setColUpper(iColumn, 0.0);
    467     }
    468     for (j = lastNonZero + 1; j < numberMembers_; j++) {
     468      }
     469      for (j = lastNonZero + 1; j < numberMembers_; j++) {
    469470        int iColumn = members_[j];
    470471        solver->setColUpper(iColumn, 0.0);
     472      }
     473    } else {
     474      for (j = 0; j < numberMembers_; j++) {
     475        int iColumn = members_[j];
     476        solver->setColUpper(iColumn, 0.0);
     477        solver->setColLower(iColumn, 1.0);
     478      }
    471479    }
    472480}
     
    836844    const double * weights = set_->weights();
    837845    OsiSolverInterface * solver = model_->solver();
    838     //const double * lower = solver->getColLower();
    839     //const double * upper = solver->getColUpper();
     846    const double * lower = solver->getColLower();
     847    const double * upper = solver->getColUpper();
    840848    // *** for way - up means fix all those in down section
    841849    if (way_ < 0) {
     
    861869    }
    862870    computeNonzeroRange();
    863     return 0.0;
     871    double predictedChange=0.0;
     872    for (int i = 0; i < numberMembers; i++) {
     873      int iColumn=which[i];
     874      if (lower[iColumn]>upper[iColumn])
     875        predictedChange=COIN_DBL_MAX;
     876    }
     877    return predictedChange;
    864878}
    865879/* Update bounds in solver as in 'branch' and update given bounds.
Note: See TracChangeset for help on using the changeset viewer.