Skip to content

Commit 71cf027

Browse files
committed
changed: clean-up in NonLinMPC construction
Dynamic dispatch is totally assumed in `get_nonlinobj_op`, so explicit `Vararg` is now uselessly complex.
1 parent 9bb5cfe commit 71cf027

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/controller/nonlinmpc.jl‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
897897
end
898898
end
899899
J_func = if !isnothing(hess)
900-
function (Z̃_arg::Vararg{T, N}) where {N, T<:Real}
900+
function (Z̃_arg...)
901901
update_objective!(J, ∇J, ∇²J, Z̃_J, Z̃_arg)
902-
return J[]::T
902+
return J[]
903903
end
904904
else
905-
function (Z̃_arg::Vararg{T, N}) where {N, T<:Real}
905+
function (Z̃_arg...)
906906
update_objective!(J, ∇J, Z̃_J, Z̃_arg)
907-
return J[]::T
907+
return J[]
908908
end
909909
end
910910
∇J_func! = if nZ̃ == 1 # univariate syntax (see JuMP.@operator doc):
@@ -921,12 +921,12 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
921921
end
922922
else # multivariate syntax (see JuMP.@operator doc):
923923
if !isnothing(hess)
924-
function (∇J_arg::AbstractVector{T}, Z̃_arg::Vararg{T, N}) where {N, T<:Real}
924+
function (∇J_arg::AbstractVector, Z̃_arg...)
925925
update_objective!(J, ∇J, ∇²J, Z̃_J, Z̃_arg)
926926
return ∇J_arg .= ∇J
927927
end
928928
else
929-
function (∇J_arg::AbstractVector{T}, Z̃_arg::Vararg{T, N}) where {N, T<:Real}
929+
function (∇J_arg::AbstractVector, Z̃_arg...)
930930
update_objective!(J, ∇J, Z̃_J, Z̃_arg)
931931
return ∇J_arg .= ∇J
932932
end
@@ -938,7 +938,7 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
938938
return ∇²J[]
939939
end
940940
else # multivariate syntax (see JuMP.@operator doc):
941-
function (∇²J_arg::AbstractMatrix{T}, Z̃_arg::Vararg{T, N}) where {N, T<:Real}
941+
function (∇²J_arg::AbstractMatrix, Z̃_arg...)
942942
update_objective!(J, ∇J, ∇²J, Z̃_J, Z̃_arg)
943943
return fill_diffstructure!(∇²J_arg, ∇²J, ∇²J_structure)
944944
end

0 commit comments

Comments
 (0)