From bc74ac627b0fb35361f26bc29ed65d90dd3796ad Mon Sep 17 00:00:00 2001 From: John Forrest Date: Fri, 13 Sep 2024 11:31:19 +0100 Subject: [PATCH] fix for mipstart ans maximization --- Cbc/src/CbcSolver.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cbc/src/CbcSolver.cpp b/Cbc/src/CbcSolver.cpp index e0a067409..e42a3ffa8 100644 --- a/Cbc/src/CbcSolver.cpp +++ b/Cbc/src/CbcSolver.cpp @@ -5840,6 +5840,14 @@ int CbcMain1(int argc, const char *argv[], babModel_->createContinuousSolver(); babModel_->setBestSolution(CBC_ROUNDING, obj, &x[0], 1); + /* But this is outside branchAndBound so needs to know + about direction */ + if (babModel_->getObjSense()==-1.0) { + babModel_->setCutoff(-obj); + babModel_->setMinimizationObjValue(-obj); + // and solver (solver will flip) + babModel_->solver()->setDblParam(OsiDualObjectiveLimit,obj); + } babModel_->clearContinuousSolver(); babModel_->passInSolverCharacteristics(NULL); if (useSolution == 0)