From b8b3746fa366aa2b07305e326c1f70f3d8cfd657 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 14 Aug 2024 16:03:18 +1200 Subject: [PATCH] Fix empty summation (#253) --- src/presolve.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/presolve.jl b/src/presolve.jl index 0aadde8c..5f4b213c 100644 --- a/src/presolve.jl +++ b/src/presolve.jl @@ -305,10 +305,13 @@ end function relaxation_model_obbt(m::Optimizer, discretization, bound::Number) create_obbt_model(m, discretization, bound) - obj_expr = sum( - m.bounding_obj_mip[:coefs][j] * - _index_to_variable_ref(m.model_mip, m.bounding_obj_mip[:vars][j].args[2]) for - j in 1:m.bounding_obj_mip[:cnt] + obj_expr = JuMP.@expression( + m.model_mip, + sum( + m.bounding_obj_mip[:coefs][j] * + _index_to_variable_ref(m.model_mip, m.bounding_obj_mip[:vars][j].args[2]) for + j in 1:m.bounding_obj_mip[:cnt] + ), ) if is_min_sense(m)