@@ -133,13 +133,13 @@ struct ControllerConstraint{NT<:Real, GCfunc<:Union{Nothing, Function}}
133133 vx̂ :: Matrix{NT}
134134 bx̂ :: Vector{NT}
135135 # matrices for the zero defect constraints (N/A for single shooting transcriptions):
136- Ẽŝ :: Matrix{NT}
137- Fŝ :: Vector{NT}
138- Gŝ :: Matrix{NT}
139- Jŝ :: Matrix{NT}
140- Kŝ :: Matrix{NT}
141- Vŝ :: Matrix{NT}
142- Bŝ :: Vector{NT}
136+ ẼS :: Matrix{NT}
137+ FS :: Vector{NT}
138+ GS :: Matrix{NT}
139+ JS :: Matrix{NT}
140+ KS :: Matrix{NT}
141+ VS :: Matrix{NT}
142+ BS :: Vector{NT}
143143 # custom linear equality constraints:
144144 Ẽw :: Matrix{NT}
145145 Fw :: Vector{NT}
@@ -176,7 +176,6 @@ struct ControllerConstraint{NT<:Real, GCfunc<:Union{Nothing, Function}}
176176 # indices of finite numbers in the b vector (linear inequality constraints):
177177 i_b :: BitVector
178178 # A matrices for the linear equality constraints:
179- A_ŝ :: Matrix{NT}
180179 Aeq :: Matrix{NT}
181180 # b vector for the linear equality constraints:
182181 beq :: Vector{NT}
@@ -518,7 +517,7 @@ function setconstraint!(
518517 con. A_Umin, con. A_Umax, con. A_ΔŨmin, con. A_ΔŨmax,
519518 con. A_Ymin, con. A_Ymax, con. A_Wmin, con. A_Wmax,
520519 con. A_x̂min, con. A_x̂max,
521- con. A_ŝ
520+ con. Aeq
522521 )
523522 A = con. A[con. i_b, :]
524523 b = con. b[con. i_b]
@@ -858,7 +857,7 @@ verify_cond(::TranscriptionMethod,_,_) = nothing
858857 Hp, Hc,
859858 PΔu, Pu, E,
860859 ex̂, gx̂, jx̂, kx̂, vx̂, bx̂,
861- Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ ,
860+ ES, GS, JS, KS, VS, BS ,
862861 Wy, Wu, Wd, Wr,
863862 gc!=nothing, nc=0
864863 ) -> con, nϵ, P̃Δu, P̃u, Ẽ
@@ -874,14 +873,15 @@ function init_defaultcon_mpc(
874873 Hp, Hc,
875874 PΔu, Pu, E,
876875 ex̂, gx̂, jx̂, kx̂, vx̂, bx̂,
877- Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ ,
876+ ES, GS, JS, KS, VS, BS ,
878877 Wy, Wu, Wd, Wr,
879878 gc!:: GCfunc = nothing , nc = 0
880879) where {NT<: Real , GCfunc<: Union{Nothing, Function} }
881880 model = estim. model
882881 nu, ny, nx̂ = model. nu, model. ny, estim. nx̂
883882 nw = size (Wy, 1 )
884883 nW = nw* (Hp+ 1 )
884+ nS = size (ES, 1 )
885885 nϵ = weights. isinf_C ? 0 : 1
886886 u0min, u0max = fill (convert (NT,- Inf ), nu), fill (convert (NT,+ Inf ), nu)
887887 Δumin, Δumax = fill (convert (NT,- Inf ), nu), fill (convert (NT,+ Inf ), nu)
@@ -910,7 +910,7 @@ function init_defaultcon_mpc(
910910 A_Ymin, A_Ymax, Ẽ = relaxŶ (E, C_ymin, C_ymax, nϵ)
911911 A_Wmin, A_Wmax, Ẽw = relaxW (E, Pu, Hp, W̄y, W̄u, C_wmin, C_wmax, nϵ)
912912 A_x̂min, A_x̂max, ẽx̂ = relaxterminal (ex̂, c_x̂min, c_x̂max, nϵ)
913- A_ŝ, Ẽŝ = augmentdefect (Eŝ , nϵ)
913+ Aeq, ẼS = augmentdefect (ES , nϵ)
914914 i_Umin, i_Umax = .! isinf .(U0min), .! isinf .(U0max)
915915 i_ΔŨmin, i_ΔŨmax = .! isinf .(ΔŨmin), .! isinf .(ΔŨmax)
916916 i_Ymin, i_Ymax = .! isinf .(Y0min), .! isinf .(Y0max)
@@ -920,22 +920,21 @@ function init_defaultcon_mpc(
920920 model, transcription, nc,
921921 i_Umin, i_Umax, i_ΔŨmin, i_ΔŨmax, i_Ymin, i_Ymax, i_Wmin, i_Wmax, i_x̂min, i_x̂max,
922922 A_Umin, A_Umax, A_ΔŨmin, A_ΔŨmax, A_Ymin, A_Ymax, A_Wmin, A_Wmax, A_x̂max, A_x̂min,
923- A_ŝ
923+ Aeq
924924 )
925- # dummy fx̂, Fw and Fŝ vectors (updated just before optimization)
926- fx̂, Fw, Fŝ = zeros (NT, nx̂), zeros (NT, nW), zeros (NT, nx̂ * Hp )
925+ # dummy fx̂, Fw and FS vectors (updated just before optimization)
926+ fx̂, Fw, FS = zeros (NT, nx̂), zeros (NT, nW), zeros (NT, nS )
927927 # dummy b and beq vectors (updated just before optimization)
928928 b, beq = zeros (NT, size (A, 1 )), zeros (NT, size (Aeq, 1 ))
929929 con = ControllerConstraint {NT, GCfunc} (
930930 ẽx̂ , fx̂ , gx̂ , jx̂ , kx̂ , vx̂ , bx̂ ,
931- Ẽŝ , Fŝ , Gŝ , Jŝ , Kŝ , Vŝ , Bŝ ,
931+ ẼS , FS , GS , JS , KS , VS , BS ,
932932 Ẽw , Fw , W̄y , W̄u , W̄d , W̄r , nw ,
933933 U0min , U0max , ΔŨmin , ΔŨmax ,
934934 Y0min , Y0max , Wmin , Wmax , x̂0min , x̂0max ,
935935 A_Umin , A_Umax , A_ΔŨmin , A_ΔŨmax ,
936936 A_Ymin , A_Ymax , A_Wmin , A_Wmax , A_x̂min , A_x̂max ,
937937 A , b , i_b ,
938- A_ŝ ,
939938 Aeq , beq ,
940939 neq ,
941940 C_ymin , C_ymax , C_wmin , C_wmax , c_x̂min , c_x̂max ,
@@ -1194,24 +1193,24 @@ function relaxterminal(ex̂::AbstractMatrix{NT}, c_x̂min, c_x̂max, nϵ) where
11941193end
11951194
11961195@doc raw """
1197- augmentdefect(Eŝ , nϵ) -> A_ŝ, Ẽŝ
1196+ augmentdefect(ES , nϵ) -> Aeq, ẼS
11981197
11991198Augment defect equality constraints with slack variable ϵ if `nϵ == 1`.
12001199
1201- It returns the ``\m athbf{Ẽ_ŝ }`` matrix that appears in the defect equation
1202- ``\m athbf{Ŝ = Ẽ_ŝ Z̃ + F_ŝ }`` and the ``\m athbf{A}`` matrix for the equality constraints:
1200+ It returns the ``\m athbf{Ẽ_S }`` matrix that appears in the linear defect equation
1201+ ``\m athbf{Ẽ_S Z̃ + F_S }`` and the ``\m athbf{A}`` matrix for the equality constraints:
12031202```math
1204- \m athbf{A_ŝ Z̃} = - \m athbf{F_ŝ }
1203+ \m athbf{A_{eq} Z̃} = \m athbf{b_{eq}} = - \m athbf{F_S }
12051204```
12061205"""
1207- function augmentdefect (Eŝ :: AbstractMatrix{NT} , nϵ) where NT<: Real
1206+ function augmentdefect (ES :: AbstractMatrix{NT} , nϵ) where NT<: Real
12081207 if nϵ == 1 # Z̃ = [Z; ϵ]
1209- Ẽŝ = [Eŝ zeros (NT, size (Eŝ , 1 ), 1 )]
1208+ ẼS = [ES zeros (NT, size (ES , 1 ), 1 )]
12101209 else # Z̃ = Z (only hard constraints)
1211- Ẽŝ = Eŝ
1210+ ẼS = ES
12121211 end
1213- A_ŝ = Ẽŝ
1214- return A_ŝ, Ẽŝ
1212+ Aeq = ẼS
1213+ return Aeq, ẼS
12151214end
12161215
12171216@doc raw """
0 commit comments