From cea09a9228447bb5ca35edf230b6203a5bef2923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 8 Oct 2023 22:12:58 +0200 Subject: [PATCH] Fix --- src/MOI_wrapper.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index 29d6169d..cfff32c7 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -226,7 +226,7 @@ end function MOI.optimize!(model::Optimizer{T}) where {T} num_variables = length(model.starting_values) backend = MOI.Nonlinear.SparseReverseMode() - vars = MOI.get(model, MOI.ListOfVariableIndices()) + vars = MOI.get(model.variables, MOI.ListOfVariableIndices()) evaluator = MOI.Nonlinear.Evaluator(model.nlp_model, backend, vars) nlp_data = MOI.NLPBlockData(evaluator) @@ -280,7 +280,7 @@ function MOI.optimize!(model::Optimizer{T}) where {T} initial_x = starting_value.(model, eachindex(model.starting_values)) options = copy(model.options) - has_bounds = any(i -> isfinite(model.variables.lower[i]) || isfinite(model.variables.upper[i]), vars) + has_bounds = any(vi -> isfinite(model.variables.lower[vi.value]) || isfinite(model.variables.upper[vi.value]), vars) if has_bounds lower = [model.variables.lower[vi.value] for vi in vars] upper = [model.variables.upper[vi.value] for vi in vars]