Skip to content

docs: page-by-page review of the documentation (2026-11) - #1063

Draft
ocots wants to merge 132 commits into
mainfrom
docs/review-2026-11
Draft

ocots wants to merge 132 commits into
mainfrom
docs/review-2026-11

Conversation

@ocots

@ocots ocots commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Page-by-page proof-read of the hand-written documentation pages, in sidebar order. One commit per reviewed page.

Mechanics

  • During a review, draft = true in docs/make.jl: the build skips every @example / @repl block. It is set back to false at the end of each section.
  • The page under review carries a temporary @meta Draft = false block, so it is the only page that executes. The marker is removed before the page is committed.
  • Net effect of the branch: content fixes only — no draft flip, no leftover @meta blocks.

Pages

Progress is reported in the commits (one per page) and in the status comments below; the latest one covers Getting started, Modelling and Solve (direct). Done: the Examples, Getting started, Modelling and Solve sections. Still to read: Results, Flows, Geometry, Migration, About. Generated api/*.md pages are out of scope; guided-tour.md is edited through docs/src-literate/guided-tour.jl.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocots and others added 3 commits November 14, 2026 23:03
The header told to run `julia --project=. docs/make.jl`, which activates the
root environment first: shared dependencies then resolve from the root
Manifest, against the note below it (docs/Manifest.toml must win) and against
CTActions' documentation workflow, which runs with --project=docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ocots

ocots commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

Critical review before the page-by-page pass

A review of the hand-written pages as they stand on this branch, compared with what the sub-packages (CTBase, CTModels, CTParser, CTDirect, CTSolvers, CTFlows, CTLie) show in their own documentation and code, and with the presentation of OptimalControlProblems.jl. Every item has an identifier and a checkbox, so you can tick what you take.

Overall. The pages are in good shape: executed examples, hidden @asserts on known values, one notation. The weak points are elsewhere:

  1. Caveats about upstream bugs that have since been fixed (A1). The examples still carry the workaround.
  2. A few features that the sub-packages document and this site does not (B1 to B3). Each comes with a small gap in the public API.
  3. The same two problems on almost every page (C1).
  4. A home page and a gallery that are plain text, while the tools for something better are already installed (D1 to D3).

Method. Conventions: ct-conventions v0.14.0, ct-agents v0.5.0. Checks were run in the docs environment (julia --project=docs): OptimalControl 2.2.1-beta, CTBase 0.30.13, CTModels 0.21.1, CTFlows 0.18.3, CTDirect 2.0.0, CTSolvers 0.7.0, CTParser 0.9.6, CTLie 0.3.1. "Measured" below means I ran it there.

  • Read in full: index, the three Getting started pages, formulation, abstract-syntax, without-control, all of Solve except initial-guess, results/solution, flows/overview, multi-phase, shooting, geometry/overview, the gallery and four examples (energy, time, turnpike, singular control).
  • Read by outline and excerpts only: functional-api, inspect, with-ai, initial-guess, plot, plot-makie, save-load, the other Flows and Geometry pages, the four other examples, migration.
  • Not done: no full build, and no page was looked at in a browser. A3 is deduced from the CSS.

A. Fix first (facts)

  • A1. Fourteen of the eighteen upstream issues cited as open caveats are closed, and the text still describes the bug. Decision C2.3 of the previous pass was "when the issue is fixed, delete the line".

    Issue Page The page says Now
    CTFlows#435 results/plot a flow's solution has 5 points, "the curves are polygons" measured: 250 points
    CTFlows#434 results/plot, flows/overview saveat without dense=false "crashes the Julia session" measured: works, 11 points for 11 saveat times
    CTFlows#441 results/plot, flows/overview, flows/constrained-arcs with saveat, the point call returns the value at the last saved time measured: returns the value at tf
    CTFlows#437 flows/from-ocp variable_costate=true on a trajectory call: "a MethodError that does not say so yet" measured: a PreconditionError with a hint
    CTFlows#438 flows/accessors (twice) the pseudo-gradients "only take the full form (t, x, p, v)"; on a state flow "a MethodError for now" measured: the short form (x, p, u) works; the error is an IncorrectArgument naming vector_field
    CTLie#41 geometry/lift "the message names ad instead of Lift" measured: the message names Lift
    CTSolvers#234 installation when MadNLPGPU is missing, "the error first asks for MadNLP" measured by the probe: no longer the case
    CTFlows#436, CTFlows#440, CTModels#435 flows/overview, flows/constrained-arcs, save-load "does not name the cause yet", etc. closed; not re-measured
    CTBase#570 flows/simulation, migration OpenLoop(() -> 1) fails at the call with a MethodError closed, but measured: still a raw MethodError. The text is right; the issue may need reopening
    CTLie#40, CTParser#355, CTBase#569 lie-macro, choosing-a-method, plot already in the past tense ("before CTLie 0.3…") history, which C2.1 sends to migration.md

    Still open, text fine: CTDirect#638, #639, Update CTParser version to 0.7 #640, CTParser#414.

    Main consequence. With CompatHelper: bump compat for CTDirect to 0.14, (drop existing compat) #434, CompatHelper: bump compat for CTFlows to 0.8 for package docs, (drop existing compat) #435 and CompatHelper: bump compat for CTDirect to 0.14, (drop existing compat) #441 fixed, the saveat/dense=false workaround can go. It is on 10 pages: results/plot, flows/overview, flows/constrained-arcs and the seven examples that use flows. Each of these examples builds its flows twice (once to shoot, once "for the plot") and explains why. Removing the second build takes a few lines and one paragraph off each.

    Process. The probes of docs/probes/ were meant to fail when a fix lands (C9.3). They do, but nothing runs them (no workflow calls docs/probes/run.jl). I ran them: 8 of 11 pass. The three failures are fixes that landed: installation_gpu_errors.jl (CTSolvers#234), plot_flow_saveat.jl (CTFlows#434), and solution_duals.jl, where the probe still expects box and path multipliers of opposite signs while the page already describes the new convention. I would run the probes at the start of the pass, then in the docs CI.

  • A2. discretize is exported and cannot be called once OrdinaryDiffEqTsit5 is loaded. Measured: after using OptimalControl, OrdinaryDiffEqTsit5, discretize(ocp, …) throws an UndefVarError, because SciMLBase exports the same name. It is the only one of the 199 exported names that clashes with Tsit5, Plots or NonlinearSolve. Every flows page and every example loads Tsit5. This is a code decision (stop exporting it, or document OptimalControl.discretize), to take before B2.

  • A3. On a narrow screen, functional-api.md probably loses its functional-API column. theme/style.css defines .responsive-columns-40-60 twice. The first block (around line 380, commented "50% / 50%") hides the last column under 700px with opacity: 0; max-width: 0; max-height: 0. The second block (around line 418), whose comment says the columns should stack, does not reset these three properties. Fix: delete the first block. To check on a phone-width window.

  • A4. with-ai.md demonstrates a refinement that the page itself calls unnecessary. The follow-up prompt "Use a form compatible with examodels" produces the coordinatewise form, then the page says "it was not needed". It is the remnant of a rule that no longer exists. I would replace it with a refinement that teaches something, such as "add an initial guess with @init" or "label the speed constraint and read its multiplier".

  • A5. Four error transcripts are pasted by hand (installation, flows/overview, results/plot, save-load), with locations such as descriptive_routing.jl:259 and REPL[6]:1 that go stale without notice. CTBase 0.30.13 has CTBase.DevTools.repl_without_extensions, which the CTSolvers documentation uses to run such a transcript in a process without the extension. To try on installation.md first. On the same subject, abstract-syntax.md defines its own quiet_location helper where CTBase.DevTools.warnings_without_paths now exists.

  • A6. Small contradictions.

    • Guided tour: "this right-column costate is exactly the adjoint p of Pontryagin's Maximum Principle". results/solution.md explains that it is shifted by half a step. Write "approximates".
    • flows/multi-phase.md and flows/constrained-arcs.md (twice): "This example comes from the v2.0.4 manual". This is history on a user page (C2.1), and the reader cannot use it.
    • results/solution.md: typeof(u(0.25)) is shown, against C2.4.
    • results/solution.md and flows/shooting.md say that dual(sol, ocp, :start) is a better initial costate than costate(sol)(t0). All the examples and the guided tour use costate(direct_sol)(t0). Choose one and say why once.
    • Spelling: 151 "-ise" forms against 18 "-ize" forms ("discretize", "optimization") in index, explicit-mode, gpu, with-ai, flows/overview.
    • abstract-syntax.md has the only !!! hint of the site (elsewhere tip). Check how it renders.

B. What the sub-packages show and this site does not

  • B1. Phase labels and the switching structure of a solution. Shown in CTFlows ("Control laws", "Multi-phase flows") and CTModels ("Switching structure"). It works from OptimalControl today (measured):

    fp = Flow(ocp, (x, p, v) -> 1; label="bang +")
    fm = Flow(ocp, (x, p, v) -> -1; label="bang −")
    sol = (fp * (1, fm))((0, 2), [-1, 0], [1, 1]; variable=2)
    # the display shows:  Switching times : [1.0]    Phases : bang + → bang −

    According to the CTFlows page, plot then marks the switching times and writes the labels on the control. No page here mentions label=. Six pages build concatenations (multi-phase, shooting, constrained-arcs, and the time, turnpike and state-constraint examples), and the structure of the solution is the whole point of the indirect method.

    • Docs: one section in flows/multi-phase.md, and labels in the examples.
    • Code: switching_times, phase_labels, left_limit and right_limit are not reachable as OptimalControl.x (measured). The user sees the structure and cannot read it. This deserves an issue.
  • B2. The direct method in stages: discretize, ocp_model, nlp_model, ocp_solution. These four names are exported, and no guide page uses them. docs/api-coverage.md gives as criterion "every exported symbol appears in at least one guide page". Users ask for this: get the NLP, look at its size, give it to their own solver. Measured:

    • discretize(ocp, OptimalControl.Collocation(grid_size=20)), then nlp_model(docp, init, OptimalControl.ADNLP()), gives an ADNLPModel (62 variables, 44 constraints).
    • solve(docp, init, modeler, solver; display=false) returns a Solution.
    • The loop cannot be closed by hand. ocp_solution only accepts a BuiltModel, and nothing reachable from OptimalControl builds one (build_model is not imported). So the exported nlp_model and ocp_solution cannot be used together.

    Proposal: a page "The NLP behind solve" in the Solve section, once A2 and the ocp_solution question are settled in the code.

  • B3. Errors. CTBase has an "Exceptions" guide and CTSolvers an "Error messages reference". Here the exceptions appear on about fifteen pages and no page presents them. I would add a short reference page: one row per exception, with what it means, its usual cause, and what to do, plus how to catch one (e isa OptimalControl.IncorrectArgument) and a link to the CTBase guide.

    Code gap (measured): six exceptions are imported and SolverFailure is not. It is the exception a flow throws when an integration fails, which is the case flows/shooting.md illustrates with unsafe=true. So OptimalControl.SolverFailure is undefined and the user cannot catch it by name.

  • B4. Exported names that no guide page teaches. From a word-boundary search of the pages, to confirm by hand:

    • options introspection: option_names, option_defaults, option_description, option_type, option_default, strategy_ids, available_parameters, default_parameter, type_from_id, create_registry;
    • integration results: final_state, evaluate_at, AbstractIntegrationResult (CTSolvers has a page "Integration results");
    • is_empty, is_empty_time_grid, get_build_examodel, controlled_vector_field, ControlLaw, Multiplier, MultiPhaseFlow and the abstract types.

    For each family, either teach it (options.md shows option_value and option_source, and could list the others in a table) or declare it reference-only in api-coverage.md. Some may not need to be exported at all.

  • B5. How a solution interpolates. results/solution.md says "these functions interpolate". CTModels ("Trajectories") says how: the state and the costate linearly, the control piecewise constant by default. This explains the steps in a zoomed control plot and the tolerance of the hidden assert in first-problem.md. Two sentences are enough.

  • B6. What the direct method does. The Flows section opens with "The Pontryagin Maximum Principle, briefly". The Solve section has no counterpart: the transcription (grid, scheme, NLP) is explained only in the guided tour, with Euler. The CTDirect home page has the right fifteen lines (the transcription table and the NLP form). I would move the paragraph of the tour to solve/overview.md as "The direct method, briefly". It also prepares B2.

  • B7. A non-uniform time_grid. The option appears in one parenthesis of choosing-a-method.md. An example on the bang–bang problem, with a grid refined around the switch, would show what it is for.


C. Structure

  • C1. Two problems carry the whole site. The double integrator (ẋ(t) == [v(t), u(t)]) is defined on 26 pages, most often with the energy cost, otherwise in minimum time. Self-contained pages are a good choice. The cost is that Solve, Results and Flows each open with the same fifteen lines, and a reader who goes through the site sees very little variety.

    • Minimal: fold the block into ::: details The problem used on this page, with one sentence and a link to "Your first problem". The page stays copy-pasteable and starts on its subject.
    • Better: vary where the topic asks for it. initial-guess deserves a problem where the guess matters (Goddard, already in the tour). options and explicit-mode could show a problem where tolerances change the result.
  • C2. The first problem is told four times: index (Basic usage), first-problem, the guided tour, and the energy example. I would keep the first two as they are, and cut from the tour what has its own page: the Bolza formulation and the Euler discretisation (see B6). The tour then gets sooner to what only it shows: @def against the functional API, Goddard, continuation, GPU, and the link from direct to indirect.

  • C3. flows/shooting.md and examples/double-integrator-time.md are the same page twice: same problem, same shoot!, same result. flows/multi-phase.md solves it a third time. They also differ on where the guess comes from (see A6). I would keep the complete story in the example, and make shooting.md the method page: unknowns and conditions, unsafe, where a guess comes from, how to check the result, with shorter code and a link.

  • C4. Sidebar order.

    • Solve: overview ends on "Two ways to steer it", then the sidebar goes to "Initial guess". I would use Overview, Choosing a method, Options, Explicit mode, Initial guess, GPU.
    • Flows: "Shooting", which the overview calls "the payoff", is last, after two reference pages. I would use Overview, From an OCP, Shooting, Multi-phase flows, Constrained arcs, Simulation, From Hamiltonians, Accessors.
  • C5. The ecosystem is announced and never linked. The home page mentions "an ecosystem of domain-specific applications, tutorials, and benchmarking tools" with no link, and "Where to go next" stays inside the site. Add a "Beyond this site" block (Tutorials.jl, OptimalControlProblems.jl, CTBenchmarks, the applications). Also, "planned support for homotopy continuation" undersells what the tour already does.

  • C6. A "Reference" group at the end of the sidebar: API reference, Errors (B3), Migrating from v2.0. Today the migration page is a top-level item of its own.


D. Presentation

vitepress-plugin-tabs is in docs/package.json and registered in config.mts, and no page uses it. The site also has its own Vue components already.

  • D1. Home page. The first screen is a paragraph and the logo, and the code comes after a scroll. The page then continues with Contributing, Testing and Reproducibility. Proposal:

    • a hero with the logo, one line, and three buttons (Get started, Examples, GitHub);
    • four to six cards: DSL, direct, indirect, GPU, geometry, ecosystem;
    • the twelve-line program with its figure;
    • "Where to go next" as cards, and the citation.

    Contributing, Testing and Reproducibility would move to an "About" page. "Testing" in particular is maintainer content (C2.2). The cheapest route is the VitePress layout: home front matter. OptimalControlProblems already passes front matter through a @raw html block (outline: false on its problem pages), so this should work; to prototype.

  • D2. Gallery as cards. It is a three-column text table, and a reader chooses an example by the shape of its solution. I would give each example a card: a thumbnail of the solution, the title, the one-line story, and feature chips ("free t_f", "bang–bang", "singular arc", "state constraint", "control-free", "Makie"). OptimalControlProblems has the pattern (ProblemsGallery.vue, the problem-facts chips). With eight examples, a CSS grid and thumbnails saved by each example at build time are enough, without the JSON pipeline. The reading order stays.

  • D3. Tabs where two versions of the same thing sit side by side.

    • Examples: "@def | Mathematics" in place of responsive-columns-left-priority, which hides the mathematics under 700px.
    • functional-api.md: "@def | Functional API", with a shared key so that one choice applies to the seven problems. It also removes A3.
    • abstract-syntax.md: "Unicode | ASCII", once.
    • from-ocp.md: the three formulations of a free final time.

    To prototype on one page first: @example blocks inside :::tabs going through Documenter. ::: details and ::: code-group already work on this site.

  • D4. A line of facts under the title of each example, the same chips as in D2: "2 states · 1 control · free t_f · Mayer cost · bang–bang".

  • D5. Not recommended: a tab bar for the whole example page (Problem | Direct | Derivation | Indirect | Comparison), as on OptimalControlProblems. Those pages are reference cards with independent views. Ours are linear stories where the comparison uses the variables of the direct solve. Tabs would hide the thread, the page outline and the anchors.

  • D6. Downloads for the examples. Only the guided tour offers its script and notebook. Moving the eight examples to Literate would give the same. The cost is the #md/#nb duplication of every internal link, visible in guided-tour.jl. I would do it only if the notebooks are wanted.

  • D7. AI. with-ai.md asks an assistant to learn the DSL from a rendered page. A raw-Markdown version of the syntax page, or an llms.txt for the site, is easier for a model to read and cheaper. To explore, with A4.


E. Suggested order

  1. Before the pass: A1 with the probes, then A3 to A6. They change what you will read on eleven pages.
  2. During the pass: C1 (minimal version), C2, C3, B5 and B6, page by page.
  3. Code decisions to take in parallel (the pages depend on them): A2, the ocp_solution loop of B2, SolverFailure (B3), the switching accessors (B1). I can open the issues if you want them.
  4. Separate PRs, so that this one stays content-only: D1 to D4, C4 and C6 (the sidebar), and the new pages B2 and B3.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ocots

ocots commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

ocots and others added 4 commits November 15, 2026 10:08
With CUDA and CUDSS loaded but not MadNLPGPU, the ExtensionError now names
MadNLPGPU directly. The probe checks the new behaviour.

Fixed upstream: control-toolbox/CTSolvers.jl#234
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error raised by Lift on a HamiltonianVectorField now names Lift. The
@repl block shows it.

Fixed upstream: control-toolbox/CTLie.jl#41
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ditionError

CTFlows#437 is fixed: the error is no longer a MethodError and says that
variable_costate=true only works on the point call.

Fixed upstream: control-toolbox/CTFlows.jl#437
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… explicit

CTFlows#438 is fixed:
- the gradients of the Hamiltonian and the pseudo-Hamiltonian take the short
  form (x, p) and (x, p, u), as well as the full form; the page shows both and
  checks them with hidden asserts;
- an accessor on a state flow raises an IncorrectArgument that points to
  vector_field; the page shows it next to the Hamiltonian-flow case.

Fixed upstream: control-toolbox/CTFlows.jl#438
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocots and others added 13 commits November 15, 2026 11:25
… is built

CTBase#570 was closed as not planned: a Julia function has no fixed arity,
and a check at construction would reject valid laws. The MethodError at the
call is the intended behaviour, so the page drops the link to the issue and
adds a note that says why, and how to read the error.

Decision: control-toolbox/CTBase.jl#570
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The warning title said that OpenLoop checks the arity of the law, which it
does not. Retitle it, and drop the link to CTBase#570, closed as not planned:
the MethodError at the call is the intended behaviour.

Decision: control-toolbox/CTBase.jl#570
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment

CTModels#435 is fixed: the error no longer is an obscure dimension mismatch,
it lists what differs between the file and the model. Measured with JLD2 and
JSON.

Fixed upstream: control-toolbox/CTModels.jl#435
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tream

- CTFlows#434 and #441: saveat no longer needs dense=false, and the point call
  of a flow built with saveat returns the value at the requested time.
- CTFlows#436: a GPU flow called with host arrays raises a PreconditionError
  that says so (measured); without Mooncake, CTBase's check_backend raises an
  ExtensionError naming it (read in the code, no GPU to measure it here).

Fixed upstream: control-toolbox/CTFlows.jl#434,
control-toolbox/CTFlows.jl#436,
control-toolbox/CTFlows.jl#441
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The box and path multipliers now have the same sign, and with :exa, dual on a
boundary constraint throws a PreconditionError instead of returning zeros.
The page already describes both; the probe still expected the old behaviour.
CTDirect#639 (scaling) and CTParser#414 (:exa) stay open and are still checked.

Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Before CTLie 0.3, the expansion … failed" describes a bug fixed upstream
(CTLie#40). A user page states the current behaviour only (C2.1).

Fixed upstream: control-toolbox/CTLie.jl#40
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ases

"since CTParser 0.9.6" is history: the aliases are accepted by :exa in the
version the docs use (CTParser#355, fixed). The open CTDirect#638 caveat stays.

Fixed upstream: control-toolbox/CTParser.jl#355
Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SolverFailure is the exception a flow throws when an integration fails, and
the only one of the seven typed exceptions OptimalControl did not import. It
is now reachable as OptimalControl.SolverFailure (level 2, like the others),
listed in the qualified API reference, and covered by the reexport test.

Closes #1078

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
switching_times, phase_labels, has_switching, left_limit and right_limit
read the structure a multi-phase flow keeps in its Solution. They are
exported with the other Solution accessors (dual, iterations, ...), after a
check that none clashes with OrdinaryDiffEqTsit5, Plots, NonlinearSolve or
NLPModelsIpopt. switching_model stays in CTModels.

Tests: the reexport test covers the five names, and a new test reads the
structure of a two-phase time-minimal extremal through OptimalControl only
(times, labels, the jump of the control, the continuity of the state and
the costate), and checks a one-phase solution has none.

The guide pages come with #992.

Closes #1079

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocp_solution only accepts the BuiltModel that build_model returns, and
neither was reachable from OptimalControl, so the exported nlp_model and
ocp_solution could not be chained. Both are now imported at level 2
(qualified), which closes the loop:

    built = OptimalControl.build_model(docp, init, modeler)
    stats = ipopt(built.nlp)
    sol = ocp_solution(built, stats, modeler)

Tests: the reexport test covers the two names; a new test runs the whole
chain through OptimalControl for ADNLP and Exa, and checks it against solve
on the same discretized problem.

Closes #1077

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…veGrid

A trajectory call takes a `grid` keyword: an integer, UniformGrid(n) or
AdaptiveGrid(n), and by default an adaptive grid of 250 times. The two types
were not reachable from OptimalControl. They are imported at level 2, like
the other configuration objects; AbstractGrid and AutomaticGrid stay in
CTFlows. `grid=n` stays the common spelling.

Tests: the reexport test covers the two names and calls a flow with each,
and checks the default 250-time grid.

Review item A1 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Solution: the five switching accessors, with their guide pending in #992.
- Qualified: build_model and BuiltModel (explicit mode, the stages of solve),
  UniformGrid and AdaptiveGrid (plotting a flow), SolverFailure.
- Open holes: SolverFailure is implemented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
style.css defined .responsive-columns-40-60 twice. The first block, a copy of
the left-priority layout, hid the last column under 700px (opacity 0, zero
max-width and max-height); the second block stacks the columns but did not
reset these properties, so on a phone the functional-API column of
modelling/functional-api.md was invisible. The first block is removed: the
two columns now stack, as the comment of the second block says.

Review item A3 of #1063.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocots and others added 2 commits November 21, 2026 13:56
…ymmetry statement

- one commented using block at the top (OptimalControl, NLPModelsIpopt, CairoMakie, Colors)
- the problem in two tabs (@def / Mathematics), link to the direct method, 400 time steps stated
- the insertion values named and displayed with a hidden @show; the asserts reuse them
- the symmetry statement made exact (rotated departure point), costate origin and direct-only note
- Makie code without spaces around keyword equals; logo figure at half size

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The results shown at the end of a block were anonymous tuples. They are now
displayed with their name, one per line, with `@show`:

- the comparisons of the costs and of the final times (direct vs indirect)
- the unknowns of the shooting (p0, junction times, jumps, variables)
- "Your first problem": cost, iterations, status, state and control values

The @show of the named unknowns is hidden, the displayed expressions of the
comparisons are visible.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The shared stylesheet of control-toolbox.org resets the padding and the margin of
every MathJax container, inline (#90) and display (#92). Its selectors outrank the
bare mjx-container, so the template's padding and margin set here never applied.
The comment said the padding gave display math its space, which is no longer true.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ocots

ocots commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Status: the Examples section is done

All eight examples have been read page by page in gallery order and committed, one commit per page, plus two commits that apply a choice to every example at once. The pages were built and read in a browser, not only in the diff.

What changed across the examples

  • Same skeleton. A sentence before the using block, one commented line per package, links to the direct method and to shooting at their first use.
  • The problem in two tabs, @def | Mathematics, with one shared key, so a choice made on one page holds on the next. A page no longer jumps when a tab is switched (shared stylesheet, see below).
  • Flow labels explained where they first appear (time, turnpike), with a link to the multi-phase page, and no switching lines or phase names on the overlays that compare the direct and the indirect solution.
  • Named values. Results at the end of a block were anonymous tuples; they are now displayed with @show (the comparisons of costs and final times, the unknowns of the shooting, "Your first problem"). The guided tour already prints labelled values.
  • control-free: the derivation of $p_\omega$ is written out, with the origin of $q$.
  • singular-control: the boundary values are named (x0, y0, xf, yf), the figure has a left margin, and a Mathematics tab; the bound on $\theta$ that only helps the direct method is not in the mathematics.
  • state-constraint: Bryson–Denham gets the third regime ($a = 0.3$, no contact), the limit cases of the three regimes, and the indirect method in one tab per case, each with its direct/indirect figure; the comparison overlays the three, in the same order and colours as the direct plot.
  • logo: imports first, the problem in two tabs, the symmetry statement made exact, the figure at half size.

What it taught us about the direct method

The dual of the direct method does not mean the same thing for the two orders of state constraint, and the page now says so:

  • first-order constraint ($v \le v_{\max}$): the direct dual is $\mu h$, not $\mu = 38.4$: a warning on the page;
  • second-order constraint (Bryson–Denham): the multiplier is a measure, with no density on the boundary arc and atoms at the junctions; the peaks of the direct dual are the jumps of the costate ($2/(9a^2) \approx 22.2$ and $9.6$).

Dividing every box multiplier by the step, as CTDirect.jl#639 asks, would fix the first case and break the second. The issue now carries both examples with measured values, the link between the KKT multipliers and the maximum principle (Cots, Gergaud and Goubinat, OCAM), the sign conventions, and a list of questions to settle (what dual returns, the weight of each node per scheme, signs, tests). When it is fixed, the warning of state-constraint goes.

Outside this repository

  • control-toolbox.github.io#92 (display math: no margin nor padding) and #93 (scroll-behavior: auto, which made synced tabs jump), both merged and loaded live by every site;
  • ct-conventions#73, merged: the note on the VitePress backend said the template's padding rule stays; it is inert since time dependence for constraints ok #92;
  • here, the inert rule of style.css is dropped.

Not in this PR

draft = true in docs/make.jl and the docs Manifest.toml / Project.toml stay local, as announced in the description.

ocots and others added 11 commits November 21, 2026 23:14
…r min and max

The pseudo-Hamiltonian is always maximised: p0 <= 0 for a minimisation,
p0 >= 0 for a maximisation, with costate and duals unchanged (ct-conventions
SGN1-SGN5). Explain the normalisation of state constraints and link the
formulation, abstract syntax and dual variables pages.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…namics arguments

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e, callbacks first

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… set

- wrap the examples in ::::tabs with short labels, plus a legend before
  the tabs mapping each label to its gallery example
- move the per-example using statements into hidden @setup blocks; a
  plain julia block announces the two packages before the tabs
- drop the plot from the energy example and the Plots dependency
- temporary draft mode kept for single-page preview

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Raw HTML headings render with the same .vp-doc h3 style but are not
picked up by the outline extractor, keeping the right-side menu clean.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Headings inside the tabs leak into the page outline (the active panel's
heading is scanned into the right-side menu); raw HTML is escaped by the
VitePress pipeline, so plain bold keeps the titles out of the outline.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Remove the single-page draft setup and refresh the reproducibility
snapshot (docs/src/assets Manifest/Project).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… hook

Read back the executed model in the preview build instead of duplicating
it: a `<!-- model: id -->` comment tags an executed `@example` problem and
`@inspect-model <id> "fragment"…` blocks are rewritten at VitePress render
time into that problem's code with warning highlights on matching lines
(docs/src/.vitepress/inspect-model.ts, hooked in config.mts).

The page itself: per-section lead-ins, the executed problem as the single
source of truth for the highlighted display blocks, TimesModel and
ConstraintsModel details with CTModels cross-references, a state box added
to the richer example, :path (not :mixed) as the type of a mixed
constraint, equality-on-variable constraints documented as boxes with an
automatic label, `index` on a FreeTimeModel, distinct problem names in
Time dependence, and the is_* aliases listed in a table.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Point the teach-prompt URLs (and the prefill links of the assistant
buttons) at /stable/ rather than /dev/, fix the button colours to the
actual brand colours (ChatGPT black, Claude terracotta, Copilot indigo,
Gemini blue, Mistral orange, Perplexity teal), and invert the ChatGPT
chip in dark mode the way OpenAI itself does. Also "In our tests" and a
600px cap on the rocket image.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…, and solving them yourself

New page modelling/discretisation.md, after "Inspect a problem":
- the direct method, moved from the Solve overview (anchor
  modelling-discretisation-direct-method; the ten links to the old anchor follow);
- the four steps of `solve` (discretize, nlp_model, an NLP solver, ocp_solution);
- the discretised problem: built once, solved with several modelers/solvers,
  warm-started from a solution;
- the NLP models (ADNLPModel, ExaModel), evaluated through the NLPModels API;
- solving the NLP with ipopt / madnlp called directly, and turning the stats back
  into a Solution with OptimalControl.build_model + ocp_solution, versus `solve`.

The Solve overview keeps a short summary of the direct method; the "stages behind
solve" section of Explicit mode keeps only solve(docp, init, modeler, solver) and
points to the new page, which now carries the discretize/OrdinaryDiffEqTsit5
warning. Anchor added on "Discretisation schemes" (Choosing a method). The
notebook link of the guided tour now targets the @id anchor (the old slug did
not exist). NLPModels added to the docs environment (already in the manifest,
v0.21.12) for obj/grad/cons/jac.

Checked locally: draft build with the three executed pages opted out, CI=true,
no warning, every hidden @Assert passing (ct-conventions v0.14.0, ct-agents v0.5.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocots and others added 2 commits November 22, 2026 17:11
…pages

`import Pkg` (321575f) tripped the MOD3 guard test/suite/meta/test_no_import.jl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file itself was deleted in 89df4fb (staged by mistake with that docs
commit); this commit removes its commented-out `include`.

The file was added with its `include` already commented out (8aff195) and was
never loaded. Its content is redundant or unwanted: `variable`, `constraint`,
`objective` and `discretize` are already re-exported from CTModels and
CTSolvers.DOCP, and the one addition, a `discretize(ocp)` with a default
discretizer, is not wanted: discretising by hand is an advanced use, where the
discretizer is chosen explicitly.

Checked: test/suite/reexport, test/suite/meta, test/suite/solve/test_staged_pipeline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ocots and others added 7 commits November 22, 2026 19:42
…r-level solve

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-method

- overview: @show for the success/status/violation checks.
- Set up the single-page review: draft = true globally, Draft = false on
  choosing-a-method.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Emphasize the first-match rule of methods() with a tip and
  first(methods()) (also in explicit-mode).
- Incompatible tokens: the rule is "no method contains every token",
  with a cross-family example (:adnlp + :gpu).
- Schemes table: an explicit order column; the LQ convergence check
  moves into a details block with the output explained.
- time_grid example commented; the :exa limitations (custom grid,
  Gauss-Legendre) are warnings. The time_grid + :exa failure is a
  DimensionMismatch, tracked as CTDirect#638.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Introduce the two action options up front, in a table; the routing
  story and its escape hatches (route_to, bypass) are signposted to
  their sections.
- route_to section reordered: what it does first, then a note that no
  ambiguity exists today and that strategies declare a curated subset
  of options.
- NotProvided vs OptimalControl defaults explained in a note, with
  verified examples (max_iter, mu_strategy, hessian_approximation).
- Printed tables get headers; inspection blocks become @repl/@show.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Point to describe and the inspection sections right where options
  first appear; both sections get @id anchors.
- Component types are not exported: a warning explains the clash with
  the solver modules (NLPModelsIpopt brings its own Ipopt).
- Partial components: a warning that completed components only get
  default options — build them or use descriptive mode instead.
- mode=:permissive documented as the constructor-level alternative to
  bypass for several undeclared options.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Intro says what the initial guess is (the starting point of the NLP
  iterations) and maps the page; a sentence introduces the usings.
- Examples as @repl with one-line outputs; data lines silenced; the
  figure code of the obstacle example folded in a details block, with
  hidden asserts (the default guess reaches the better solution).
- The two running problems in tabs.
- Facts checked and added: linear interpolation on a time grid, held
  constant outside it; @init validates the guess itself; named tuples
  take component labels and (T, data) pairs; a grid spec referenced
  from a temporal one gives an UndefVarError.
- Real error sessions for a wrong dimension and for init together with
  initial_guess; the indexed syntax x[1](t) becomes a warning
  (control-toolbox/CTParser.jl#434).
- Warm start: grids may differ, links to grid and discrete continuation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Intro says what runs on the device (ExaModels with a CUDA backend,
  MadNLP with cuDSS) and maps the page; a sentence introduces the usings.
- display=false silences MadNLP too: the print_level=MadNLP.ERROR advice
  and the `using MadNLP` of the timing block are dropped.
- describe(:gpu) also lists :di and :sciml: they are the flows' ones.
- Option defaults, describe and the CUDA.functional() guard as @repl;
  the guard now runs a real solve on either parameter; the problem's
  display hidden; the construction warning hidden without a device.
- Combination errors are raised at construction or completion, not at
  compile time; the hard-coded "no functional device" message is gone.
- make.jl back to draft = false: every page executes again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ocots

ocots commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Status: Getting started, Modelling and Solve are done

Everything from the home page to the end of the Solve section (direct method) has now been read page by page, in sidebar order, and committed, one commit per page. Each page was built on its own (the other pages drafted) and read in the rendered output, with its examples executed. The branch is back to draft = false: every page runs again, and no Draft = false marker is left.

Still to read: Results, Flows, Geometry, Migration and About.

Getting started

  • Home: a hero page, an About page, links to the ecosystem; the installation snippet uses using Pkg.
  • Installation: the solver is not optional; the missing-solver error is shown from a real session; the MadNLPGPU caveat is gone (CTSolvers#234 is fixed).
  • First problem: each package is loaded where it is first used.
  • Guided tour: Flow with callbacks, an apogee zoom, a rocket animation and a basketball animation for shooting; the grid=nothing workaround is gone (CTFlows 0.18.4).

Modelling

  • Formulation: sign conventions of $p^0$, of the costate and of the multipliers, for min and max.
  • Abstract syntax: the two @def forms and the optional arguments of the dynamics.
  • Functional API: the seven worked problems in one tab set, the :exa error block, the formulation table, callbacks first.
  • Inspect a problem: reworked. A VitePress hook (<!-- model: id --> / @inspect-model) shows the executed problem with the lines under discussion highlighted, instead of a copy of it.
  • With AI: prompts only, links to /stable/, the real brand colours on the buttons.
  • Discretisation (new page): the direct method, moved here from the Solve overview; the discretised problem, built once and solved several times; the NLP models (ADNLPModel, ExaModel) through the NLPModels API; Ipopt or MadNLP called directly, and their output turned back into a Solution. NLPModels is added to the docs environment.

Solve (direct)

  • Overview: @show for the checks on success, status and violation.
  • Choosing a method: the first-match rule of methods() in a tip; incompatible tokens explained as "no method contains every token"; the order of each scheme in the table, the LQ convergence check in a details block; the :exa limitations (custom time grid, Gauss–Legendre) as warnings, the first one tracked in CTDirect#638.
  • Options: the two action options introduced first, in a table; route_to and bypass reordered; NotProvided and OptimalControl defaults explained in a note, with checked examples.
  • Explicit mode: why component types are not exported (the clash with the solver modules); completed components only get default options; mode=:permissive as the alternative to bypass.
  • Initial guess: an intro that says what the guess is; the two running problems in tabs. Added after checking: linear interpolation on a time grid, held constant outside it; @init validates the guess itself; a named tuple takes labels and (T, data) pairs. Real error sessions replace messages copied by hand; the warm start links to grid and discrete continuation.
  • GPU: display=false also silences MadNLP, so the print_level advice and the using MadNLP are gone; describe(:gpu) also lists :di and :sciml, which are used by flows; the CUDA.functional() guard now runs a real solve with either parameter.

Across these pages: @repl instead of println, data lines silenced with ;, plotting code folded in details blocks, and hidden @asserts on the values the text relies on.

Issues opened or followed during the pass

  • CTParser.jl#434: @init refuses the indexed syntax x[1](t), which @def accepts. initial-guess documents the limitation in a warning until then.
  • CTSolvers.jl#337: a display for DiscretizedModel and BuiltModel, after which the Discretisation page will show docp.
  • CTDirect.jl#638: a custom time_grid with :exa.
  • Dead code: src/imports/redefine.jl is removed.

Conventions applied: ct-conventions v0.14.0, ct-agents v0.5.0.

🤖 Generated with Claude Code

@ocots

ocots commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

To do once CTSolvers is released: nlp_model(built) on the discretisation page

docs/src/modelling/discretisation.md teaches a struct field, built.nlp (lines 221, 227 and 237). CTSolvers #338, merged in CTSolvers#340, adds the accessors for it. It is in [Unreleased] of CTSolvers, not yet in a release.

  • nlp_model(built) returns the NLP of a built DOCP and ocp_model(built) its original problem. They are new methods of the nlp_model and ocp_model that OptimalControl already re-exports (src/imports/ctsolvers.jl), so no import changes.
  • On the page, replace built.nlp by nlp_model(built), in the ipopt and madnlp examples and in the prose around line 221.
  • The [compat] bound on CTSolvers must require the release that contains it.
  • ocp_solution now only accepts a BuiltModel of a DiscretizedModel (a MethodError otherwise). Every call on this page already passes one.

Related: B2 of the critical review above and #1077: build_model is still not reachable from OptimalControl, so the loop nlp_model → solver → ocp_solution cannot be closed by hand from here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation push preview With 'run documentation': also deploy a preview of the docs run documentation Trigger the Documentation workflow on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant