diff --git a/src/CbcHeuristicDive.cpp b/src/CbcHeuristicDive.cpp index 135a6e6a2..d0a69d65c 100644 --- a/src/CbcHeuristicDive.cpp +++ b/src/CbcHeuristicDive.cpp @@ -389,6 +389,15 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, back[iColumn] = i; double value = newSolution[iColumn]; // clean + if (valuesetColUpper(iColumn,value); + } else if (value>upper[iColumn]) { + value = upper[iColumn]; + newSolution[iColumn] = value; + solver->setColLower(iColumn,value); + } value = CoinMin(value, upperBefore[iColumn]); value = CoinMax(value, lowerBefore[iColumn]); newSolution[iColumn] = value; @@ -434,6 +443,9 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, if (!isHeuristicInteger(solver, iColumn)) continue; double value = newSolution[iColumn]; + // deal with tolerance problems + if (valueupper[iColumn]) + continue; if (fabs(floor(value + 0.5) - value) > integerTolerance) { assert(downLocks_[i] == 0 || upLocks_[i] == 0); double obj = objective[iColumn]; @@ -459,6 +471,16 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, if (!isHeuristicInteger(solver, iColumn)) continue; double value = newSolution[iColumn]; + // clean + if (valuesetColUpper(iColumn,value); + } else if (value>upper[iColumn]) { + value = upper[iColumn]; + newSolution[iColumn] = value; + solver->setColLower(iColumn,value); + } if (fabs(floor(value + 0.5) - value) > integerTolerance) { assert(downLocks_[i] == 0 || upLocks_[i] == 0); if (downLocks_[i] == 0 && upLocks_[i] == 0) { diff --git a/src/CbcHeuristicDiveCoefficient.cpp b/src/CbcHeuristicDiveCoefficient.cpp index 0a8a472fe..4404683b6 100644 --- a/src/CbcHeuristicDiveCoefficient.cpp +++ b/src/CbcHeuristicDiveCoefficient.cpp @@ -72,6 +72,8 @@ bool CbcHeuristicDiveCoefficient::selectVariableToBranch(OsiSolverInterface *sol int numberIntegers = model_->numberIntegers(); const int *integerVariable = model_->integerVariable(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); + const double * lower = solver->getColLower(); + const double * upper = solver->getColUpper(); bestColumn = -1; bestRound = -1; // -1 rounds down, +1 rounds up @@ -84,6 +86,9 @@ bool CbcHeuristicDiveCoefficient::selectVariableToBranch(OsiSolverInterface *sol if (!isHeuristicInteger(solver, iColumn)) continue; double value = newSolution[iColumn]; + // deal with tolerance problems + if (valueupper[iColumn]) + continue; double fraction = value - floor(value); int round = 0; if (fabs(floor(value + 0.5) - value) > integerTolerance) {