From 1fd99a64c9f5a9df8904ab6a1476299cd50b14b8 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 13 Feb 2025 09:02:56 +1300 Subject: [PATCH] Fix type stability of MOI nonlinear callbacks --- src/MOI_wrapper.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index e5a5c95..1b0bd1c 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -858,7 +858,7 @@ function MOI.eval_objective(model::Optimizer, x) if model.sense == MOI.FEASIBILITY_SENSE return 0.0 elseif model.nlp_data.has_objective - return MOI.eval_objective(model.nlp_data.evaluator, x) + return MOI.eval_objective(model.nlp_data.evaluator, x)::Float64 end return MOI.eval_objective(model.qp_data, x) end @@ -891,7 +891,10 @@ function MOI.jacobian_structure(model::Optimizer) J = MOI.jacobian_structure(model.qp_data) offset = length(model.qp_data) if length(model.nlp_data.constraint_bounds) > 0 - for (row, col) in MOI.jacobian_structure(model.nlp_data.evaluator) + J_nlp = MOI.jacobian_structure( + model.nlp_data.evaluator, + )::Vector{Tuple{Int,Int}} + for (row, col) in J_nlp push!(J, (row + offset, col)) end end