Skip to content

Commit febdeb7

Browse files
committed
extref
1 parent d63f56a commit febdeb7

File tree

8 files changed

+51
-13
lines changed

8 files changed

+51
-13
lines changed

docs/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
44
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
55
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
6+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
67
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
@@ -15,13 +16,13 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
1516
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1617
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1718
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
18-
Tutorials = "cb10daa6-a5e5-4c25-a171-ae181b8ea3c9"
1919

2020
[compat]
2121
BenchmarkTools = "1.6"
2222
DataFrames = "1.7"
2323
DifferentiationInterface = "0.7"
2424
Documenter = "1.14"
25+
DocumenterInterLinks = "1.1"
2526
ForwardDiff = "0.10, 1"
2627
LinearAlgebra = "1"
2728
MINPACK = "1.3"

docs/make.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
using Documenter
2+
using DocumenterInterLinks
23
using OptimalControl
34

5+
#
6+
links = InterLinks(
7+
"CTDirect" => (
8+
"https://control-toolbox.org/CTDirect.jl/stable/",
9+
"https://control-toolbox.org/CTDirect.jl/stable/objects.inv",
10+
joinpath(@__DIR__, "inventories", "CTDirect.toml"),
11+
),
12+
)
13+
414
# For reproducibility
515
mkpath(joinpath(@__DIR__, "src", "assets"))
616
cp(
@@ -46,6 +56,7 @@ makedocs(;
4656
"Model Predictive Control" => "tutorial-mpc.md",
4757
],
4858
],
59+
plugins=[links],
4960
)
5061

5162
deploydocs(; repo=repo_url * ".git", devbranch="main")

docs/src/assets/Manifest.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.11.6"
44
manifest_format = "2.0"
5-
project_hash = "df043b4bd81a5c717a539eafd43565c6db99906e"
5+
project_hash = "82d0e8898147399344b23c193fc001d42d758daf"
66

77
[[deps.ADNLPModels]]
88
deps = ["ADTypes", "ForwardDiff", "LinearAlgebra", "NLPModels", "Requires", "ReverseDiff", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"]
@@ -535,6 +535,12 @@ deps = ["Random", "Serialization", "Sockets"]
535535
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
536536
version = "1.11.0"
537537

538+
[[deps.DocInventories]]
539+
deps = ["CodecZlib", "Downloads", "TOML"]
540+
git-tree-sha1 = "e97cfa8680a39396924dcdca4b7ff1014ed5c499"
541+
uuid = "43dc2714-ed3b-44b5-b226-857eda1aa7de"
542+
version = "1.0.0"
543+
538544
[[deps.DocStringExtensions]]
539545
git-tree-sha1 = "7442a5dfe1ebb773c29cc2962a8980f47221d76c"
540546
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
@@ -546,6 +552,12 @@ git-tree-sha1 = "47ffb8f27ffc01e2e57e7ae5365ae5ceef87b03d"
546552
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
547553
version = "1.14.1"
548554

555+
[[deps.DocumenterInterLinks]]
556+
deps = ["CodecZlib", "DocInventories", "Documenter", "Markdown", "MarkdownAST", "TOML"]
557+
git-tree-sha1 = "d8a8cb2d5b0181fbbd41861016b221b0202c9bc5"
558+
uuid = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
559+
version = "1.1.0"
560+
549561
[[deps.Downloads]]
550562
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
551563
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

docs/src/assets/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
44
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
55
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
6+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
67
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
@@ -22,6 +23,7 @@ BenchmarkTools = "1.6"
2223
DataFrames = "1.7"
2324
DifferentiationInterface = "0.7"
2425
Documenter = "1.14"
26+
DocumenterInterLinks = "1.1"
2527
ForwardDiff = "0.10, 1"
2628
LinearAlgebra = "1"
2729
MINPACK = "1.3"

docs/src/tutorial-discretisation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ println(data)
106106
# Plot the results
107107
x_style = (legend=:none,)
108108
p_style = (legend=:none,)
109-
styles = (state_style=x_style, costate_style=p_style)
109+
u_style = (legend=:topright,)
110+
styles = (state_style=x_style, costate_style=p_style, control_style=u_style)
110111
111112
scheme, sol = solutions[1]
112113
plt = plot(sol; label=string(scheme), styles...)

docs/src/tutorial-iss.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ nothing # hide
318318

319319
```@raw html
320320
</details>
321+
</br>
321322
```
322323

323324
```@example main-iss

docs/src/tutorial-lqr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ plot(px1, px2, pu, layout=(1, 3), size=(800, 300), leftmargin=5mm, bottommargin=
9292

9393
We can observe that $x(t_f)$ converges to the origin as $t_f$ increases.
9494

95-
## Limitations: using matrix formulation
95+
## Known issues
9696

97-
The following definition will lead to an error when solving the problem:
97+
The following definition will lead to an error when solving the problem. See [Reverse over forward AD issues with ADNLP](https://github.com/control-toolbox/OptimalControl.jl/issues/481).
9898

9999
```@repl main-lqr
100100

docs/src/tutorial-nlp.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@ nothing # hide
4242

4343
## Discretization and NLP problem
4444

45-
We discretize the problem.
45+
We discretize the problem with [`direct_transcription`](@extref CTDirect.direct_transcription):
4646

4747
```@example main-nlp
4848
docp = direct_transcription(ocp)
49+
nothing # hide
50+
```
51+
52+
and get the NLP model with [`model`](@extref CTDirect.model):
53+
54+
```@example main-nlp
4955
nlp = model(docp)
5056
nothing # hide
5157
```
5258

53-
The DOCP contains information related to the transcription, including a copy of the original OCP, and the NLP is the resulting discretized problem, in our case an `ADNLPModel`.
59+
The DOCP contains information related to the transcription, including a copy of the original OCP, and the NLP is the resulting discretized nonlinear programming problem, in our case an `ADNLPModel`.
5460

5561
We can now use the solver of our choice to solve it.
5662

@@ -64,12 +70,17 @@ nlp_sol = ipopt(nlp; print_level=5, mu_strategy="adaptive", tol=1e-8, sb="yes")
6470
nothing # hide
6571
```
6672

67-
Then we can rebuild and plot an optimal control problem solution (note that the multipliers are optional, but the OCP costate will not be retrieved if the multipliers are not provided).
73+
Then, we can build an optimal control problem solution with [`build_OCP_solution`](@extref CTDirect.build_OCP_solution-Tuple{Any}) (note that the multipliers are optional, but the OCP costate will not be retrieved if the multipliers are not provided) and plot it.
6874

6975
```@example main-nlp
70-
sol = build_OCP_solution(docp; primal=nlp_sol.solution, dual=nlp_sol.multipliers)
76+
sol = build_OCP_solution(docp;
77+
primal=nlp_sol.solution,
78+
dual=nlp_sol.multipliers,
79+
docp_solution=nlp_sol
80+
)
7181
plot(sol)
7282
```
83+
7384
## Change the NLP solver
7485

7586
Alternatively, we can use [MadNLP.jl](https://madnlp.github.io/MadNLP.jl) to solve anew the NLP problem:
@@ -81,17 +92,16 @@ nlp_sol = madnlp(nlp)
8192

8293
## Initial guess
8394

84-
An initial guess, including warm start, can be passed to [`direct_transcription`](https://control-toolbox.org/OptimalControl.jl/stable/dev-ctdirect.html#CTDirect.direct_transcription-Tuple{Model,%20Vararg{Any}}) the same way as for `solve`.
95+
An initial guess, including warm start, can be passed to [`direct_transcription`](@extref CTDirect.direct_transcription) the same way as for `solve`.
8596

8697
```@example main-nlp
8798
docp = direct_transcription(ocp; init=sol)
88-
nlp = model(nlp)
8999
nothing # hide
90100
```
91101

92-
It can also be changed after the transcription is done, with [`set_initial_guess`](https://control-toolbox.org/OptimalControl.jl/stable/dev-ctdirect.html#CTDirect.set_initial_guess-Tuple{CTDirect.DOCP,%20Any,%20Any}).
102+
It can also be changed after the transcription is done, with [`set_initial_guess`](@extref CTDirect.set_initial_guess).
93103

94104
```@example main-nlp
95-
set_initial_guess(docp, nlp, sol)
105+
set_initial_guess(docp, sol)
96106
nothing # hide
97107
```

0 commit comments

Comments
 (0)