|
| 1 | +using Documenter |
| 2 | +using DocumenterMermaid |
| 3 | +using OptimalControl |
| 4 | +using CTBase |
| 5 | +using CTDirect |
| 6 | +using CTFlows |
| 7 | +using CTModels |
| 8 | +using CTParser |
| 9 | +using Plots |
| 10 | +using CommonSolve |
| 11 | +using OrdinaryDiffEq |
| 12 | +using DocumenterInterLinks |
| 13 | +using ADNLPModels |
| 14 | +using ExaModels |
| 15 | +using NLPModelsIpopt |
| 16 | +using MadNLP |
| 17 | +using MadNLPMumps |
| 18 | +using JSON3 |
| 19 | +using JLD2 |
| 20 | +using NLPModelsKnitro |
| 21 | + |
| 22 | +# |
| 23 | +links = InterLinks( |
| 24 | + "CTBase" => ( |
| 25 | + "https://control-toolbox.org/CTBase.jl/stable/", |
| 26 | + "https://control-toolbox.org/CTBase.jl/stable/objects.inv", |
| 27 | + joinpath(@__DIR__, "inventories", "CTBase.toml"), |
| 28 | + ), |
| 29 | + "CTDirect" => ( |
| 30 | + "https://control-toolbox.org/CTDirect.jl/stable/", |
| 31 | + "https://control-toolbox.org/CTDirect.jl/stable/objects.inv", |
| 32 | + joinpath(@__DIR__, "inventories", "CTDirect.toml"), |
| 33 | + ), |
| 34 | + "CTFlows" => ( |
| 35 | + "https://control-toolbox.org/CTFlows.jl/stable/", |
| 36 | + "https://control-toolbox.org/CTFlows.jl/stable/objects.inv", |
| 37 | + joinpath(@__DIR__, "inventories", "CTFlows.toml"), |
| 38 | + ), |
| 39 | + "CTModels" => ( |
| 40 | + "https://control-toolbox.org/CTModels.jl/stable/", |
| 41 | + "https://control-toolbox.org/CTModels.jl/stable/objects.inv", |
| 42 | + joinpath(@__DIR__, "inventories", "CTModels.toml"), |
| 43 | + ), |
| 44 | + "CTParser" => ( |
| 45 | + "https://control-toolbox.org/CTParser.jl/stable/", |
| 46 | + "https://control-toolbox.org/CTParser.jl/stable/objects.inv", |
| 47 | + joinpath(@__DIR__, "inventories", "CTParser.toml"), |
| 48 | + ), |
| 49 | + "ADNLPModels" => ( |
| 50 | + "https://jso.dev/ADNLPModels.jl/stable/", |
| 51 | + "https://jso.dev/ADNLPModels.jl/stable/objects.inv", |
| 52 | + joinpath(@__DIR__, "inventories", "ADNLPModels.toml"), |
| 53 | + ), |
| 54 | + "NLPModelsIpopt" => ( |
| 55 | + "https://jso.dev/NLPModelsIpopt.jl/stable/", |
| 56 | + "https://jso.dev/NLPModelsIpopt.jl/stable/objects.inv", |
| 57 | + joinpath(@__DIR__, "inventories", "NLPModelsIpopt.toml"), |
| 58 | + ), |
| 59 | + "ExaModels" => ( |
| 60 | + "https://exanauts.github.io/ExaModels.jl/stable/", |
| 61 | + "https://exanauts.github.io/ExaModels.jl/stable/objects.inv", |
| 62 | + joinpath(@__DIR__, "inventories", "ExaModels.toml"), |
| 63 | + ), |
| 64 | + "MadNLP" => ( |
| 65 | + "https://madnlp.github.io/MadNLP.jl/stable/", |
| 66 | + "https://madnlp.github.io/MadNLP.jl/stable/objects.inv", |
| 67 | + joinpath(@__DIR__, "inventories", "MadNLP.toml"), |
| 68 | + ), |
| 69 | + "Tutorials" => ( |
| 70 | + "https://control-toolbox.org/Tutorials.jl/stable/", |
| 71 | + "https://control-toolbox.org/Tutorials.jl/stable/objects.inv", |
| 72 | + joinpath(@__DIR__, "inventories", "Tutorials.toml"), |
| 73 | + ), |
| 74 | +) |
| 75 | + |
| 76 | +# to add docstrings from external packages |
| 77 | +const CTFlowsODE = Base.get_extension(CTFlows, :CTFlowsODE) |
| 78 | +const CTModelsPlots = Base.get_extension(CTModels, :CTModelsPlots) |
| 79 | +const CTModelsJSON = Base.get_extension(CTModels, :CTModelsJSON) |
| 80 | +const CTModelsJLD = Base.get_extension(CTModels, :CTModelsJLD) |
| 81 | +const CTDirectExtIpopt = Base.get_extension(CTDirect, :CTDirectExtIpopt) |
| 82 | +const CTDirectExtKnitro = Base.get_extension(CTDirect, :CTDirectExtKnitro) |
| 83 | +const CTDirectExtMadNLP = Base.get_extension(CTDirect, :CTDirectExtMadNLP) |
| 84 | +const CTDirectExtADNLP = Base.get_extension(CTDirect, :CTDirectExtADNLP) |
| 85 | +const CTDirectExtExa = Base.get_extension(CTDirect, :CTDirectExtExa) |
| 86 | +Modules = [ |
| 87 | + CTBase, |
| 88 | + CTFlows, |
| 89 | + CTDirect, |
| 90 | + CTModels, |
| 91 | + CTParser, |
| 92 | + OptimalControl, |
| 93 | + CTFlowsODE, |
| 94 | + CTModelsPlots, |
| 95 | + CTModelsJSON, |
| 96 | + CTModelsJLD, |
| 97 | + CTDirectExtIpopt, |
| 98 | + CTDirectExtKnitro, |
| 99 | + CTDirectExtMadNLP, |
| 100 | + CTDirectExtADNLP, |
| 101 | + CTDirectExtExa, |
| 102 | +] |
| 103 | +for Module in Modules |
| 104 | + isnothing(DocMeta.getdocmeta(Module, :DocTestSetup)) && |
| 105 | + DocMeta.setdocmeta!(Module, :DocTestSetup, :(using $Module); recursive=true) |
| 106 | +end |
| 107 | + |
| 108 | +# For reproducibility |
| 109 | +mkpath(joinpath(@__DIR__, "src", "assets")) |
| 110 | +cp( |
| 111 | + joinpath(@__DIR__, "Manifest.toml"), |
| 112 | + joinpath(@__DIR__, "src", "assets", "Manifest.toml"); |
| 113 | + force=true, |
| 114 | +) |
| 115 | +cp( |
| 116 | + joinpath(@__DIR__, "Project.toml"), |
| 117 | + joinpath(@__DIR__, "src", "assets", "Project.toml"); |
| 118 | + force=true, |
| 119 | +) |
| 120 | + |
| 121 | +repo_url = "github.com/control-toolbox/OptimalControl.jl" |
| 122 | + |
| 123 | +# if draft is true, then the julia code from .md is not executed |
| 124 | +# to disable the draft mode in a specific markdown file, use the following: |
| 125 | +#= |
| 126 | +```@meta |
| 127 | +Draft = false |
| 128 | +``` |
| 129 | +=# |
| 130 | +makedocs(; |
| 131 | + draft=false, # debug |
| 132 | + sitename="OptimalControl.jl", |
| 133 | + format=Documenter.HTML(; |
| 134 | + repolink="https://" * repo_url, |
| 135 | + prettyurls=false, |
| 136 | + size_threshold_ignore=[ |
| 137 | + "api-optimalcontrol-user.md", "example-double-integrator-energy.md" |
| 138 | + ], |
| 139 | + assets=[ |
| 140 | + asset("https://control-toolbox.org/assets/css/documentation.css"), |
| 141 | + asset("https://control-toolbox.org/assets/js/documentation.js"), |
| 142 | + "assets/custom.css", |
| 143 | + ], |
| 144 | + ), |
| 145 | + pages=[ |
| 146 | + "Getting Started" => "index.md", |
| 147 | + "Basic Examples" => [ |
| 148 | + "Energy minimisation" => "example-double-integrator-energy.md", |
| 149 | + "Time mininimisation" => "example-double-integrator-time.md", |
| 150 | + ], |
| 151 | + "Manual" => [ |
| 152 | + "Define a problem" => "manual-abstract.md", |
| 153 | + "Use AI" => "manual-ai-llm.md", |
| 154 | + "Problem characteristics" => "manual-model.md", |
| 155 | + "Set an initial guess" => "manual-initial-guess.md", |
| 156 | + "Solve a problem" => "manual-solve.md", |
| 157 | + "Solve on GPU" => "manual-solve-gpu.md", |
| 158 | + "Solution characteristics" => "manual-solution.md", |
| 159 | + "Plot a solution" => "manual-plot.md", |
| 160 | + "Compute flows" => [ |
| 161 | + "Flow API" => "manual-flow-api.md", |
| 162 | + "From optimal control problems" => "manual-flow-ocp.md", |
| 163 | + "From Hamiltonians and others" => "manual-flow-others.md", |
| 164 | + ], |
| 165 | + ], |
| 166 | + "API" => [ |
| 167 | + "OptimalControl.jl - User" => "api-optimalcontrol-user.md", |
| 168 | + "Subpackages - Developers" => [ |
| 169 | + "CTBase.jl" => "api-ctbase.md", |
| 170 | + "CTDirect.jl" => "api-ctdirect.md", |
| 171 | + "CTFlows.jl" => "api-ctflows.md", |
| 172 | + "CTModels.jl" => "api-ctmodels.md", |
| 173 | + "CTParser.jl" => "api-ctparser.md", |
| 174 | + "OptimalControl.jl" => "api-optimalcontrol-dev.md", |
| 175 | + ], |
| 176 | + ], |
| 177 | + "RDNOPA 2025" => "rdnopa-2025.md", |
| 178 | + ], |
| 179 | + plugins=[links], |
| 180 | +) |
| 181 | + |
| 182 | +deploydocs(; repo=repo_url * ".git", devbranch="main", push_preview=true) |
| 183 | +# push_preview: use https://control-toolbox.org/OptimalControl.jl/previews/PRXXX where XXX is the pull request number |
0 commit comments