@@ -3,7 +3,6 @@ Cd = 310.
3
3
Tmax = 3.5
4
4
β = 500.
5
5
b = 2.
6
- N = 100
7
6
t0 = 0.
8
7
r0 = 1.
9
8
v0 = 0.
@@ -28,17 +27,9 @@ objective!(ocp, :mayer, (t0, x0, tf, xf) -> xf[1], :max)
28
27
D (x) = Cd * x[2 ]^ 2 * exp (- β* (x[1 ]- 1 ))
29
28
F0 (x) = [ x[2 ], - D (x)/ x[3 ]- 1 / x[1 ]^ 2 , 0 ]
30
29
F1 (x) = [ 0 , Tmax/ x[3 ], - b* Tmax ]
31
- # f!(dx, x, u) = (dx[:] = F0(x) + u*F1(x))
32
- # constraint!(ocp, :dynamics!, f!) # dynamics can be in place
33
30
f (x, u) = F0 (x) + u[1 ]* F1 (x)
34
31
constraint! (ocp, :dynamics , f)
35
32
36
- @test constraint (ocp, :state_con1 , :lower )(x0, 0. ) ≈ 0. atol= 1e-8
37
- @test ocp. state_dimension == 3
38
- @test ocp. control_dimension == 1
39
- @test typeof (ocp) == OptimalControlModel{:autonomous }
40
- @test ocp. initial_time == t0
41
-
42
33
# --------------------------------------------------------
43
34
# Indirect
44
35
@@ -105,7 +96,6 @@ s_guess_sol = [-0.02456074767656735, -0.05699760226157302, 0.0018629693253921868
105
96
# jfoo(ξ) = ForwardDiff.jacobian(foo, ξ)
106
97
# foo!(s, ξ) = ( s[:] = foo(ξ); nothing )
107
98
# jfoo!(js, ξ) = ( js[:] = jfoo(ξ); nothing )
108
-
109
99
foo! (s, ξ) = shoot! (s, ξ[1 : 3 ], ξ[4 ], ξ[5 ], ξ[6 ], ξ[7 ])
110
100
sol = fsolve (foo!, ξ0, show_trace= true ); println (sol)
111
101
0 commit comments