Skip to content

Commit e7420db

Browse files
authored
Merge pull request #510 from JuliaControl/type_stability_obj_ob
added: improving type-stability of `NonLinMPC` and `MovingHorizonEstimator` internals
2 parents cfa0cfd + 805a670 commit e7420db

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/controller/nonlinmpc.jl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
882882
J!, ∇J, ∇²J, ∇²J_prep, hess, Z̃_J, J_cache...
883883
)
884884
end
885+
return nothing
885886
end
886887
else
887888
function (J, ∇J, Z̃_J, Z̃_arg)
@@ -892,6 +893,7 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
892893
J!, ∇J, ∇J_prep, grad, Z̃_J, J_cache...
893894
)
894895
end
896+
return nothing
895897
end
896898
end
897899
J_func = if !isnothing(hess)

‎src/estimator/mhe/construct.jl‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,14 +1509,18 @@ function get_nonlinobj_op(
15091509
J!, ∇J, ∇²J, ∇²J_prep, hess, Z̃_J, J_cache...
15101510
)
15111511
end
1512+
return nothing
15121513
end
15131514
else
15141515
function (J, ∇J, Z̃_J, Z̃_arg)
15151516
if isdifferent(Z̃_arg, Z̃_J) || estim.force∇J[]
15161517
estim.force∇J[] = false
15171518
Z̃_J .= Z̃_arg
1518-
J[], _ = value_and_gradient!(J!, ∇J, ∇J_prep, grad, Z̃_J, J_cache...)
1519+
J[], _ = value_and_gradient!(
1520+
J!, ∇J, ∇J_prep, grad, Z̃_J, J_cache...
1521+
)
15191522
end
1523+
return nothing
15201524
end
15211525
end
15221526
J_func = if !isnothing(hess)

0 commit comments

Comments
 (0)