@@ -213,13 +213,13 @@ function shoot!(s, p0, t1, t2, t3, tf)
213213 x3, p3 = fb(t2, x2, p2, t3)
214214 xf, pf = f0(t3, x3, p3, tf)
215215
216- s[1] = xf[3] - mf # final mass constraint
217- s[2:3] = pf[1:2] - [1, 0] # transversality conditions: r(tf) and v(tf) are free
218- # objective is -r(tf) → p_r(tf) = 1, and v(tf) free → p_v(tf) = 0
219- s[4] = H1(x1, p1) # H1 = H01 = 0
220- s[5] = H01(x1, p1) # at the entrance of the singular arc
221- s[6] = g(x2) # g = 0 when entering the boundary arc
222- s[7] = H0(xf, pf) # since tf is free
216+ s[1] = xf[3] - mf # final mass constraint
217+ s[2:3] = pf[1:2] - [1, 0] # transversality conditions: r(tf) and v(tf) are free
218+ # objective is -r(tf) → p_r(tf) = 1, and v(tf) free → p_v(tf) = 0
219+ s[4] = H1(x1, p1) # H1 = H01 = 0
220+ s[5] = H01(x1, p1) # at the entrance of the singular arc
221+ s[6] = g(x2) # g = 0 when entering the boundary arc
222+ s[7] = H0(xf, pf) # since tf is free
223223
224224end
225225nothing # hide
@@ -276,9 +276,9 @@ function fsolve(f, j, x; kwargs...)
276276 println("Error using MINPACK")
277277 println(e)
278278 println("hybrj not supported. Replaced by NonlinearSolve even if it is not visible on the doc.")
279- nle! = (s, ξ, λ ) -> f(s, ξ)
279+ nle! = (s, ξ, _ ) -> f(s, ξ)
280280 prob = NonlinearProblem(nle!, x)
281- sol = solve(prob; abstol=1e-8, reltol=1e-8, show_trace=Val(true))
281+ sol = solve(prob; show_trace=Val(true))
282282 return MYSOL(sol.u)
283283 end
284284end
@@ -462,7 +462,8 @@ plot!(plt, indirect_sol; label="indirect", color=2)
462462 println("┌─ Goddard problem: direct vs indirect")
463463 println("│")
464464 println("├─ Number of Iterations")
465- @printf("│ Direct: %d\\n", i_dir)
465+ @printf("│ Direct: %d\n", i_dir)
466+ println("│")
466467
467468 # States
468469 println("├─ States (L2 Norms)")
@@ -471,8 +472,9 @@ plot!(plt, indirect_sol; label="indirect", color=2)
471472 xi_ind = [x_ind[k][i] for k in eachindex(t_common)]
472473 L2_ae = L2_norm(t_common, xi_dir - xi_ind)
473474 L2_re = L2_ae / (0.5 * (L2_norm(t_common, xi_dir) + L2_norm(t_common, xi_ind)))
474- @printf("│ %-6s Abs: %.3e Rel: %.3e\\ n", x_vars[i], L2_ae, L2_re)
475+ @printf("│ %-6s Abs: %.3e Rel: %.3e\n", x_vars[i], L2_ae, L2_re)
475476 end
477+ println("│")
476478
477479 # Controls
478480 println("├─ Controls (L2 Norms)")
@@ -481,8 +483,9 @@ plot!(plt, indirect_sol; label="indirect", color=2)
481483 ui_ind = [u_ind[k][i] for k in eachindex(t_common)]
482484 L2_ae = L2_norm(t_common, ui_dir - ui_ind)
483485 L2_re = L2_ae / (0.5 * (L2_norm(t_common, ui_dir) + L2_norm(t_common, ui_ind)))
484- @printf("│ %-6s Abs: %.3e Rel: %.3e\\ n", u_vars[i], L2_ae, L2_re)
486+ @printf("│ %-6s Abs: %.3e Rel: %.3e\n", u_vars[i], L2_ae, L2_re)
485487 end
488+ println("│")
486489
487490 # Variables
488491 println("├─ Variables")
@@ -491,14 +494,15 @@ plot!(plt, indirect_sol; label="indirect", color=2)
491494 vi_ind = v_ind[i]
492495 vi_ae = abs(vi_dir - vi_ind)
493496 vi_re = vi_ae / (0.5 * (abs(vi_dir) + abs(vi_ind)))
494- @printf("│ %-6s Abs: %.3e Rel: %.3e\\ n", v_vars[i], vi_ae, vi_re)
497+ @printf("│ %-6s Abs: %.3e Rel: %.3e\n", v_vars[i], vi_ae, vi_re)
495498 end
499+ println("│")
496500
497501 # Objective
502+ println("├─ Objective")
498503 o_ae = abs(o_dir - o_ind)
499504 o_re = o_ae / (0.5 * (abs(o_dir) + abs(o_ind)))
500- println("├─ Objective")
501- @printf("│ Abs: %.3e Rel: %.3e\\n", o_ae, o_re)
505+ @printf("│ Abs: %.3e Rel: %.3e\n", o_ae, o_re)
502506 println("└─")
503507 return nothing
504508 end
0 commit comments