Skip to content

Commit

Permalink
Correct bounds for shot internal dual objective variable in max. prob…
Browse files Browse the repository at this point in the history
…lems
  • Loading branch information
andreaslundell committed Sep 15, 2023
1 parent 4136f52 commit bf1c961
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Tasks/TaskCreateDualProblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ bool TaskCreateDualProblem::createProblem(MIPSolverPtr destination, ProblemPtr s
for(auto& V : sourceProblem->allVariables)
{
variablesInitialized = variablesInitialized
&& destination->addVariable(V->name.c_str(), V->properties.type, V->lowerBound, V->upperBound, V->semiBound);
&& destination->addVariable(
V->name.c_str(), V->properties.type, V->lowerBound, V->upperBound, V->semiBound);
}

if(!variablesInitialized)
Expand All @@ -106,11 +107,11 @@ bool TaskCreateDualProblem::createProblem(MIPSolverPtr destination, ProblemPtr s

destination->setDualAuxiliaryObjectiveVariableIndex(sourceProblem->properties.numberOfVariables);

if(sourceProblem->objectiveFunction->properties.isMinimize)
destination->addVariable("shot_dual_objvar", E_VariableType::Real, objectiveBound.l(), objectiveBound.u(), 0.0);
else
destination->addVariable(
"shot_dual_objvar", E_VariableType::Real, -objectiveBound.u(), -objectiveBound.l(), 0.0);
destination->addVariable("shot_dual_objvar", E_VariableType::Real, objectiveBound.l(), objectiveBound.u(), 0.0);

env->output->outputDebug(fmt::format(
" SHOT internal dual objective variable created with index {} and bounds [{},{}] created.",
sourceProblem->properties.numberOfVariables, objectiveBound.l(), objectiveBound.u()));
}

// Now creating the objective function
Expand Down

0 comments on commit bf1c961

Please sign in to comment.