Skip to content

Commit

Permalink
Fix type stability of MOI nonlinear callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Feb 12, 2025
1 parent 1412187 commit 1fd99a6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1fd99a6

Please sign in to comment.