@@ -641,23 +641,23 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
641641 return obj_nonlinprog! (Ŷ0, U0, mpc, model, Ue, Ŷe, ΔŨ)
642642 end
643643 Z̃_J = fill (myNaN, nZ̃) # NaN to force update at first call
644- J_context = (
644+ J_cache = (
645645 Cache (ΔŨ), Cache (x̂0end), Cache (Ue), Cache (Ŷe), Cache (U0), Cache (Ŷ0),
646646 Cache (Û0), Cache (K0), Cache (X̂0),
647647 Cache (gc), Cache (g), Cache (geq),
648648 )
649- ∇J_prep = prepare_gradient (J!, grad, Z̃_J, J_context ... ; strict)
649+ ∇J_prep = prepare_gradient (J!, grad, Z̃_J, J_cache ... ; strict)
650650 ∇J = Vector {JNT} (undef, nZ̃)
651651 if ! isnothing (hess)
652- ∇²J_prep = prepare_hessian (J!, hess, Z̃_J, J_context ... ; strict)
652+ ∇²J_prep = prepare_hessian (J!, hess, Z̃_J, J_cache ... ; strict)
653653 ∇²J = init_diffmat (JNT, hess, ∇²J_prep, nZ̃, nZ̃)
654654 end
655655 update_objective! = if ! isnothing (hess)
656656 function (J, ∇J, ∇²J, Z̃_J, Z̃_arg)
657657 if isdifferent (Z̃_arg, Z̃_J)
658658 Z̃_J .= Z̃_arg
659659 J[], _ = value_gradient_and_hessian! (
660- J!, ∇J, ∇²J, ∇²J_prep, hess, Z̃_J, J_context ...
660+ J!, ∇J, ∇²J, ∇²J_prep, hess, Z̃_J, J_cache ...
661661 )
662662 end
663663 end
@@ -666,7 +666,7 @@ function get_nonlinobj_op(mpc::NonLinMPC, optim::JuMP.GenericModel{JNT}) where J
666666 if isdifferent (Z̃_arg, Z̃_∇J)
667667 Z̃_∇J .= Z̃_arg
668668 J[], _ = value_and_gradient! (
669- J!, ∇J, ∇J_prep, grad, Z̃_∇J, J_context ...
669+ J!, ∇J, ∇J_prep, grad, Z̃_∇J, J_cache ...
670670 )
671671 end
672672 end
@@ -774,30 +774,30 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN
774774 return dot (λi, gi)
775775 end
776776 Z̃_∇gi = fill (myNaN, nZ̃) # NaN to force update at first call
777- ∇gi_context = (
777+ ∇gi_cache = (
778778 Cache (ΔŨ), Cache (x̂0end), Cache (Ue), Cache (Ŷe), Cache (U0), Cache (Ŷ0),
779779 Cache (Û0), Cache (K0), Cache (X̂0),
780780 Cache (gc), Cache (geq), Cache (g)
781781 )
782- ∇gi_prep = prepare_jacobian (gi!, gi, jac, Z̃_∇gi, ∇gi_context ... ; strict)
782+ ∇gi_prep = prepare_jacobian (gi!, gi, jac, Z̃_∇gi, ∇gi_cache ... ; strict)
783783 ∇gi = init_diffmat (JNT, jac, ∇gi_prep, nZ̃, ngi)
784784 ∇gi_structure = init_diffstructure (∇gi)
785785 if ! isnothing (hess)
786- ∇²gi_context = (
786+ ∇²gi_cache = (
787787 Cache (ΔŨ), Cache (x̂0end), Cache (Ue), Cache (Ŷe), Cache (U0), Cache (Ŷ0),
788788 Cache (Û0), Cache (K0), Cache (X̂0),
789789 Cache (gc), Cache (geq), Cache (g), Cache (gi)
790790 )
791791 ∇²gi_prep = prepare_hessian (
792- ℓ_gi, hess, Z̃_∇gi, Constant (λi), ∇²gi_context ... ; strict
792+ ℓ_gi, hess, Z̃_∇gi, Constant (λi), ∇²gi_cache ... ; strict
793793 )
794794 ∇²ℓ_gi = init_diffmat (JNT, hess, ∇²gi_prep, nZ̃, nZ̃)
795795 ∇²gi_structure = lowertriangle_indices (init_diffstructure (∇²ℓ_gi))
796796 end
797797 function update_con! (gi, ∇gi, Z̃_∇gi, Z̃_arg)
798798 if isdifferent (Z̃_arg, Z̃_∇gi)
799799 Z̃_∇gi .= Z̃_arg
800- value_and_jacobian! (gi!, gi, ∇gi, ∇gi_prep, jac, Z̃_∇gi, ∇gi_context ... )
800+ value_and_jacobian! (gi!, gi, ∇gi, ∇gi_prep, jac, Z̃_∇gi, ∇gi_cache ... )
801801 end
802802 return nothing
803803 end
@@ -812,7 +812,7 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN
812812 function ∇²gi_func! (∇²ℓ_arg, Z̃_arg, λ_arg)
813813 Z̃_∇gi .= Z̃_arg
814814 λi .= λ_arg
815- hessian! (ℓ_gi, ∇²ℓ_gi, ∇²gi_prep, hess, Z̃_∇gi, Constant (λi), ∇²gi_context ... )
815+ hessian! (ℓ_gi, ∇²ℓ_gi, ∇²gi_prep, hess, Z̃_∇gi, Constant (λi), ∇²gi_cache ... )
816816 return diffmat2vec! (∇²ℓ_arg, ∇²ℓ_gi, ∇²gi_structure)
817817 end
818818 gi_min = fill (- myInf, ngi)
@@ -837,30 +837,30 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN
837837 return dot (λeq, geq)
838838 end
839839 Z̃_∇geq = fill (myNaN, nZ̃) # NaN to force update at first call
840- ∇geq_context = (
840+ ∇geq_cache = (
841841 Cache (ΔŨ), Cache (x̂0end), Cache (Ue), Cache (Ŷe), Cache (U0), Cache (Ŷ0),
842842 Cache (Û0), Cache (K0), Cache (X̂0),
843843 Cache (gc), Cache (g)
844844 )
845- ∇geq_prep = prepare_jacobian (geq!, geq, jac, Z̃_∇geq, ∇geq_context ... ; strict)
845+ ∇geq_prep = prepare_jacobian (geq!, geq, jac, Z̃_∇geq, ∇geq_cache ... ; strict)
846846 ∇geq = init_diffmat (JNT, jac, ∇geq_prep, nZ̃, neq)
847847 ∇geq_structure = init_diffstructure (∇geq)
848848 if ! isnothing (hess)
849- ∇²geq_context = (
849+ ∇²geq_cache = (
850850 Cache (ΔŨ), Cache (x̂0end), Cache (Ue), Cache (Ŷe), Cache (U0), Cache (Ŷ0),
851851 Cache (Û0), Cache (K0), Cache (X̂0),
852852 Cache (gc), Cache (geq), Cache (g)
853853 )
854854 ∇²geq_prep = prepare_hessian (
855- ℓ_geq, hess, Z̃_∇geq, Constant (λeq), ∇²geq_context ... ; strict
855+ ℓ_geq, hess, Z̃_∇geq, Constant (λeq), ∇²geq_cache ... ; strict
856856 )
857857 ∇²ℓ_geq = init_diffmat (JNT, hess, ∇²geq_prep, nZ̃, nZ̃)
858858 ∇²geq_structure = lowertriangle_indices (init_diffstructure (∇²ℓ_geq))
859859 end
860860 function update_con_eq! (geq, ∇geq, Z̃_∇geq, Z̃_arg)
861861 if isdifferent (Z̃_arg, Z̃_∇geq)
862862 Z̃_∇geq .= Z̃_arg
863- value_and_jacobian! (geq!, geq, ∇geq, ∇geq_prep, jac, Z̃_∇geq, ∇geq_context ... )
863+ value_and_jacobian! (geq!, geq, ∇geq, ∇geq_prep, jac, Z̃_∇geq, ∇geq_cache ... )
864864 end
865865 return nothing
866866 end
@@ -875,7 +875,7 @@ function get_nonlincon_oracle(mpc::NonLinMPC, ::JuMP.GenericModel{JNT}) where JN
875875 function ∇²geq_func! (∇²ℓ_arg, Z̃_arg, λ_arg)
876876 Z̃_∇geq .= Z̃_arg
877877 λeq .= λ_arg
878- hessian! (ℓ_geq, ∇²ℓ_geq, ∇²geq_prep, hess, Z̃_∇geq, Constant (λeq), ∇²geq_context ... )
878+ hessian! (ℓ_geq, ∇²ℓ_geq, ∇²geq_prep, hess, Z̃_∇geq, Constant (λeq), ∇²geq_cache ... )
879879 return diffmat2vec! (∇²ℓ_arg, ∇²ℓ_geq, ∇²geq_structure)
880880 end
881881 geq_min = geq_max = zeros (JNT, neq)
0 commit comments