You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9c6a596
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/controller/nonlinmpc.jl
+23-42Lines changed: 23 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -825,12 +825,14 @@ Return the nonlinear operator for the objective of `mpc` [`NonLinMPC`](@ref).
825
825
826
826
It is based on the splatting syntax. This method is really intricate and that's because of:
827
827
828
-
- These functions are used inside the nonlinear optimization, so they must be type-stable
829
-
and as efficient as possible. All the function outputs and derivatives are cached and
830
-
updated in-place if required to use the efficient [`value_and_gradient!`](@extref DifferentiationInterface DifferentiationInterface.value_and_jacobian!).
831
-
- The splatting syntax for objective functions implies the use of `Vararg{T,N}` (see the [performance tip](@extref Julia Be-aware-of-when-Julia-avoids-specializing))
832
-
and memoization to avoid redundant computations. This is already complex, but it's even
833
-
worse knowing that the automatic differentiation tools do not support splatting.
828
+
- These functions are used inside the nonlinear optimization, so as efficient as possible.
829
+
All the function outputs and derivatives are cached and updated in-place if required to
830
+
use the efficient [`value_and_gradient!`](@extref DifferentiationInterface DifferentiationInterface.value_and_jacobian!).
831
+
- The splatting syntax is required for [`add_nonlinear_operator`](@extref JuMP JuMP.add_nonlinear_operator)
832
+
but automatic differentiation tools do not support splatting.
833
+
- The internal of `MOI.jl` calls the 3 functions of `add_nonlinear_operator` with a runtime
834
+
dispatch. It is thus a waste of time and resources to compile (a.k.a specialize) these 3
835
+
closures. The `NoTypeFunction` wrapper hide their concrete type to disable compilation.
834
836
- The signature of gradient and hessian functions is not the same for univariate (`nZ̃ == 1`)
835
837
and multivariate (`nZ̃ > 1`) operators in `JuMP`. Both must be defined.
836
838
"""
@@ -897,51 +899,30 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
897
899
end
898
900
end
899
901
J_func =if!isnothing(hess)
900
-
function (Z̃_arg::Vararg{T, N}) where {N, T<:Real}
Copy file name to clipboardExpand all lines: src/estimator/mhe/construct.jl
+15-25Lines changed: 15 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1445,9 +1445,11 @@ It is based on the splatting syntax. This method is really intricate and that's
1445
1445
- These functions are used inside the nonlinear optimization, so they must be type-stable
1446
1446
and as efficient as possible. All the function outputs and derivatives are cached and
1447
1447
updated in-place if required to use the efficient [`value_and_gradient!`](@extref DifferentiationInterface DifferentiationInterface.value_and_jacobian!).
1448
-
- The splatting syntax for objective functions implies the use of `Vararg{T,N}` (see the [performance tip](@extref Julia Be-aware-of-when-Julia-avoids-specializing))
1449
-
and memoization to avoid redundant computations. This is already complex, but it's even
1450
-
worse knowing that the automatic differentiation tools do not support splatting.
1448
+
- The splatting syntax is required for [`add_nonlinear_operator`](@extref JuMP JuMP.add_nonlinear_operator)
1449
+
but automatic differentiation tools do not support splatting.
1450
+
- The internal of `MOI.jl` calls the 3 functions of `add_nonlinear_operator` with a runtime
1451
+
dispatch. It is thus a waste of time and resources to compile (a.k.a specialize) these 3
1452
+
closures. The `NoTypeFunction` wrapper hide their concrete type to disable compilation.
0 commit comments