File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
lib/ModelingToolkitBase/test Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 324324 _t = tspan[2 ]
325325 @test costfn(sol, prob. p, _t) ≈ (sol(0.6 ; idxs = x(t)) + 3 )^ 2 + sol(0.3 ; idxs = x(t))^ 2
326326
327+ bvp = SciMLBase. BVProblem{true , SciMLBase. AutoSpecialize}(lksys, [u0map; parammap], tspan)
328+ sol = solve(bvp, MIRK4(), dt = 0.05 )
329+ @test SciMLBase. successful_retcode(sol)
330+
331+ costfn = ModelingToolkitBase. generate_bvp_cost(
332+ lksys; expression = Val{false }, wrap_gfw = Val{true }
333+ )
334+ @test costfn(sol, bvp. p) ≈ (sol(0.6 ; idxs = x(t)) + 3 )^ 2 + sol(0.3 ; idxs = x(t))^ 2
335+
327336 # ## With a parameter
328337 @parameters t_c
329338 costs = [y(t_c) + x(0.0 ), x(0.4 )^ 2 ]
338347 )
339348 @test costfn(sol, prob. p, _t) ≈
340349 log(sol(0.56 ; idxs = y(t)) + sol(0.0 ; idxs = x(t))) - sol(0.4 ; idxs = x(t))^ 2
350+
351+ bvp = SciMLBase. BVProblem{true , SciMLBase. AutoSpecialize}(lksys, [u0map; parammap], tspan)
352+ sol = solve(bvp, MIRK4(), dt = 0.05 )
353+ @test SciMLBase. successful_retcode(sol)
354+
355+ costfn = ModelingToolkitBase. generate_bvp_cost(
356+ lksys; expression = Val{false }, wrap_gfw = Val{true }
357+ )
358+ @test costfn(sol, bvp. p) ≈ log(sol(0.56 ; idxs = y(t)) + sol(0.0 ; idxs = x(t))) - sol(0.4 ; idxs = x(t))^ 2
341359end
You can’t perform that action at this time.
0 commit comments