Ignore:
Timestamp:
May 16, 2008 4:24:59 PM (11 years ago)
Author:
jpgoncal
Message:

Added reduced cost fixing.

File:
1 edited

Legend:

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

    r912 r944  
    7171}
    7272
    73 void
     73bool
    7474CbcHeuristicDiveGuided::selectVariableToBranch(OsiSolverInterface* solver,
    75                                                    const double* newSolution,
    76                                                    int& bestColumn,
    77                                                    int& bestRound)
     75                                               const double* newSolution,
     76                                               int& bestColumn,
     77                                               int& bestRound)
    7878{
    7979  double* bestIntegerSolution = model_->bestSolution();
     
    8686  bestRound = -1; // -1 rounds down, +1 rounds up
    8787  double bestFraction = DBL_MAX;
     88  bool allTriviallyRoundableSoFar = true;
    8889  for (int i=0; i<numberIntegers; i++) {
    8990    int iColumn = integerVariable[i];
     
    9293    int round = 0;
    9394    if (fabs(floor(value+0.5)-value)>integerTolerance) {
    94       if(downLocks_[i]>0&&upLocks_[i]>0) {
    95         // the variable cannot be rounded
     95      if(allTriviallyRoundableSoFar||(downLocks_[i]>0&&upLocks_[i]>0)) {
     96
     97        if(allTriviallyRoundableSoFar&&downLocks_[i]>0&&upLocks_[i]>0) {
     98          allTriviallyRoundableSoFar = false;
     99          bestFraction = DBL_MAX;
     100        }
     101
    96102        if(value >= bestIntegerSolution[iColumn])
    97103          round = -1;
     
    113119    }
    114120  }
     121  return allTriviallyRoundableSoFar;
    115122}
Note: See TracChangeset for help on using the changeset viewer.