Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using JLD2

# plotting
using Plots
import CairoMakie # `import`, not `using`: keeps Makie's `plot`/`plot!` out of Main,
using CairoMakie: CairoMakie # `import`, not `using`: keeps Makie's `plot`/`plot!` out of Main,
# which would collide with Plots' in the `@docs` block on results/plot.md

# DocumenterVitepress picks the highest-priority MIME type a plot object responds to
Expand Down
20 changes: 4 additions & 16 deletions docs/src-literate/guided-tour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ function boundary_energy!(b, x0_, xf_, v)
b[4] = xf_[2] - xf[2]
return nothing
end
constraint!(
pre, :boundary;
f=boundary_energy!, lb=zeros(4), ub=zeros(4), label=:endpoint,
)
constraint!(pre, :boundary; f=boundary_energy!, lb=zeros(4), ub=zeros(4), label=:endpoint)

lagrange_energy(t, x, u, v) = 0.5 * u^2
objective!(pre, :min; lagrange=lagrange_energy)
Expand Down Expand Up @@ -277,14 +274,8 @@ using MadNLP
sol_ipopt = solve(goddard; grid_size=250, display=false)
sol_madnlp = solve(goddard, :madnlp; grid_size=250, display=false)

println(
"Ipopt : r(tf) = ", objective(sol_ipopt),
", ", iterations(sol_ipopt), " iters",
)
println(
"MadNLP : r(tf) = ", objective(sol_madnlp),
", ", iterations(sol_madnlp), " iters",
)
println("Ipopt : r(tf) = ", objective(sol_ipopt), ", ", iterations(sol_ipopt), " iters")
println("MadNLP : r(tf) = ", objective(sol_madnlp), ", ", iterations(sol_madnlp), " iters")

# The available methods and their options can be inspected with `methods()` and `describe(:collocation)`; we will not dwell on them here.

Expand Down Expand Up @@ -365,10 +356,7 @@ t_bang = [sol_bang1.t; sol_bang2.t]
r_bang = [sol_bang1[1, :]; sol_bang2[1, :]]

plt_bang = plot(sol_cold; label="optimal", linewidth=2, color=1)
plot!(
plt_bang[1], t_bang, r_bang;
label="bang-bang", linestyle=:dash, linewidth=2, color=2,
)
plot!(plt_bang[1], t_bang, r_bang; label="bang-bang", linestyle=:dash, linewidth=2, color=2)
plot(plt_bang[1]; legend=:bottomright, xlabel="time", ylabel="altitude")

#src ============================================================================
Expand Down