@@ -56,11 +56,11 @@ function build_solution(
5656 control_constraints_ub_dual:: Matrix{Float64} = zeros (0 , 0 ),
5757 variable_constraints_lb_dual:: Vector{Float64} = zeros (0 ),
5858 variable_constraints_ub_dual:: Vector{Float64} = zeros (0 ),
59- ) where {
60- TX <: Union{Matrix{Float64}, Function} ,
61- TU <: Union{Matrix{Float64}, Function} ,
62- TP <: Union{Matrix{Float64}, Function} ,
63- }
59+ ) where {
60+ TX<: Union{Matrix{Float64},Function} ,
61+ TU<: Union{Matrix{Float64},Function} ,
62+ TP<: Union{Matrix{Float64},Function} ,
63+ }
6464
6565 # get dimensions
6666 dim_x = state_dimension (ocp)
@@ -80,8 +80,13 @@ function build_solution(
8080
8181 # variables: remove additional state for lagrange objective
8282 x = TX <: Function ? X : ctinterpolate (T, matrix2vec (X[:, 1 : dim_x], 1 ))
83- p = TU <: Function ? P :
84- length (T) == 2 ? t -> P[1 , 1 : dim_x] : ctinterpolate (T[1 : (end - 1 )], matrix2vec (P[:, 1 : dim_x], 1 ))
83+ p = if TU <: Function
84+ P
85+ elseif length (T) == 2
86+ t -> P[1 , 1 : dim_x]
87+ else
88+ ctinterpolate (T[1 : (end - 1 )], matrix2vec (P[:, 1 : dim_x], 1 ))
89+ end
8590 u = TP <: Function ? U : ctinterpolate (T, matrix2vec (U[:, 1 : dim_u], 1 ))
8691
8792 # force scalar output when dimension is 1
0 commit comments