Skip to content

Commit

Permalink
Correct sign in cutoff in Cbc
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaslundell committed Jul 12, 2021
1 parent 2757238 commit 7270bcd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/MIPSolver/MIPSolverCbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,13 +1173,13 @@ void MIPSolverCbc::setCutOff(double cutOff)
{
this->cutOff = cutOff + cutOffTol;

env->output->outputInfo(fmt::format(" Setting cutoff value to {} for minimization.", this->cutOff));
env->output->outputDebug(fmt::format(" Setting cutoff value to {} for minimization.", this->cutOff));
}
else
{
this->cutOff = -1 * (cutOff + cutOffTol);

env->output->outputInfo(fmt::format(" Setting cutoff value to {} for maximization.", this->cutOff));
env->output->outputDebug(fmt::format(" Setting cutoff value to {} for maximization.", this->cutOff));
}
}

Expand All @@ -1195,15 +1195,15 @@ void MIPSolverCbc::setCutOffAsConstraint([[maybe_unused]] double cutOff)
if(isMinimizationProblem)
{
osiInterface->addRow(objectiveLinearExpression, -osiInterface->getInfinity(),
(cutOff + this->objectiveConstant), "CUTOFF_C");
(cutOff - this->objectiveConstant), "CUTOFF_C");

env->output->outputDebug(
" Setting cutoff constraint to " + Utilities::toString(cutOff) + " for minimization.");
}
else
{
osiInterface->addRow(objectiveLinearExpression, -osiInterface->getInfinity(),
-1.0 * (cutOff + this->objectiveConstant), "CUTOFF_C");
-1.0 * (cutOff - this->objectiveConstant), "CUTOFF_C");

env->output->outputDebug(
" Setting cutoff constraint value to " + Utilities::toString(cutOff) + " for maximization.");
Expand All @@ -1220,14 +1220,14 @@ void MIPSolverCbc::setCutOffAsConstraint([[maybe_unused]] double cutOff)
{
if(isMinimizationProblem)
{
osiInterface->setRowUpper(cutOffConstraintIndex, cutOff + this->objectiveConstant);
osiInterface->setRowUpper(cutOffConstraintIndex, cutOff - this->objectiveConstant);

env->output->outputDebug(
" Setting cutoff constraint value to " + Utilities::toString(cutOff) + " for minimization.");
}
else
{
osiInterface->setRowUpper(cutOffConstraintIndex, -(cutOff + this->objectiveConstant));
osiInterface->setRowUpper(cutOffConstraintIndex, -(cutOff - this->objectiveConstant));

env->output->outputDebug(
" Setting cutoff constraint value to " + Utilities::toString(cutOff) + " for maximization.");
Expand Down

0 comments on commit 7270bcd

Please sign in to comment.