@@ -58,22 +58,22 @@ const M = ModelingToolkit
5858 jprob = JuMPDynamicOptProblem (lksys, u0map, tspan, parammap; guesses = guess, dt = 0.01 )
5959 @test JuMP. num_constraints (jprob. model) == 2
6060 jsol = solve (jprob, Ipopt. Optimizer, constructTsitouras5, silent = true ) # 12.190 s, 9.68 GiB
61- @test jsol. sol (0.6 )[ 1 ] ≈ 3.5
62- @test jsol. sol (0.3 )[ 1 ] ≈ 7.0
61+ @test jsol. sol (0.6 ; idxs = x) ≈ 3.5
62+ @test jsol. sol (0.3 ; idxs = x) ≈ 7.0
6363
6464 cprob = CasADiDynamicOptProblem (
6565 lksys, u0map, tspan, parammap; guesses = guess, dt = 0.01 )
6666 csol = solve (cprob, " ipopt" , constructTsitouras5, silent = true )
67- @test csol. sol (0.6 )[ 1 ] ≈ 3.5
68- @test csol. sol (0.3 )[ 1 ] ≈ 7.0
67+ @test csol. sol (0.6 ; idxs = x) ≈ 3.5
68+ @test csol. sol (0.3 ; idxs = x) ≈ 7.0
6969
7070 iprob = InfiniteOptDynamicOptProblem (
7171 lksys, u0map, tspan, parammap; guesses = guess, dt = 0.01 )
7272 isol = solve (iprob, Ipopt. Optimizer,
7373 derivative_method = InfiniteOpt. OrthogonalCollocation (3 ), silent = true ) # 48.564 ms, 9.58 MiB
7474 sol = isol. sol
75- @test sol (0.6 )[ 1 ] ≈ 3.5
76- @test sol (0.3 )[ 1 ] ≈ 7.0
75+ @test sol (0.6 ; idxs = x) ≈ 3.5
76+ @test sol (0.3 ; idxs = x) ≈ 7.0
7777
7878 # Test whole-interval constraints
7979 constr = [x (t) ≳ 1 , y (t) ≳ 1 ]
@@ -128,14 +128,14 @@ end
128128 # Linear systems have bang-bang controls
129129 @test is_bangbang (jsol. input_sol, [- 1.0 ], [1.0 ])
130130 # Test reached final position.
131- @test ≈ (jsol. sol. u[ end ][ 2 ], 0.25 , rtol = 1e-5 )
131+ @test ≈ (jsol. sol[x][ end ], 0.25 , rtol = 1e-5 )
132132
133133 cprob = CasADiDynamicOptProblem (block, u0map, tspan, parammap; dt = 0.01 )
134134 csol = solve (cprob, " ipopt" , constructVerner8, silent = true )
135135 # Linear systems have bang-bang controls
136136 @test is_bangbang (csol. input_sol, [- 1.0 ], [1.0 ])
137137 # Test reached final position.
138- @test ≈ (csol. sol. u[ end ][ 2 ], 0.25 , rtol = 1e-5 )
138+ @test ≈ (csol. sol[x][ end ], 0.25 , rtol = 1e-5 )
139139
140140 # Test dynamics
141141 @parameters (u_interp:: ConstantInterpolation )(.. )
149149 iprob = InfiniteOptDynamicOptProblem (block, u0map, tspan, parammap; dt = 0.01 )
150150 isol = solve (iprob, Ipopt. Optimizer; silent = true )
151151 @test is_bangbang (isol. input_sol, [- 1.0 ], [1.0 ])
152- @test ≈ (isol. sol. u[ end ][ 2 ], 0.25 , rtol = 1e-5 )
152+ @test ≈ (isol. sol[x][ end ], 0.25 , rtol = 1e-5 )
153153 osol = solve (oprob, ImplicitEuler (); dt = 0.01 , adaptive = false )
154154 @test ≈ (isol. sol. u, osol. u, rtol = 0.05 )
155155
@@ -220,16 +220,16 @@ end
220220 Tₘ => 3.5 * g₀ * m₀, T (t) => 0.0 , h₀ => 1 , m_c => 0.6 ]
221221 jprob = JuMPDynamicOptProblem (rocket, u0map, (ts, te), pmap; dt = 0.001 , cse = false )
222222 jsol = solve (jprob, Ipopt. Optimizer, constructRadauIIA5, silent = true )
223- @test jsol. sol. u[ end ][ 1 ] > 1.012
223+ @test jsol. sol[h][ end ] > 1.012
224224
225225 cprob = CasADiDynamicOptProblem (rocket, u0map, (ts, te), pmap; dt = 0.001 , cse = false )
226226 csol = solve (cprob, " ipopt" ; silent = true )
227- @test csol. sol. u[ end ][ 1 ] > 1.012
227+ @test csol. sol[h][ end ] > 1.012
228228
229229 iprob = InfiniteOptDynamicOptProblem (
230230 rocket, u0map, (ts, te), pmap; dt = 0.001 )
231231 isol = solve (iprob, Ipopt. Optimizer, silent = true )
232- @test isol. sol. u[ end ][ 1 ] > 1.012
232+ @test isol. sol[h][ end ] > 1.012
233233
234234 # Test solution
235235 @parameters (T_interp:: CubicSpline )(.. )
0 commit comments