docs: results — reading, plotting, and persisting a solution - #867
Open
ocots wants to merge 5 commits into
Open
Conversation
Fixes the spec's own accessor list: is_empty(sol) doesn't exist (is_empty only takes a TimeGridModel, not a Solution) — the real solution-level check is is_empty_time_grid(sol), which the page now uses. Drops the "Solution struct" section (API-reference material) and the inline export/import note (now results/save-load.md's job). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ports the attic almost entirely (thorough, mostly current per spec), with two real fixes found by executing it for real: - CTModels.jl#392 (the VBox plotting bug from PR 5/6) turns out to affect nearly every bare plot(sol) call in this file specifically — triggered whenever the default (empty) description is used, regardless of styles or layout kwargs. Fixed throughout with explicit :state/:costate/:control selectors or layout=:group, with one clear note up front rather than repeating it everywhere. - The flow-plotting section's saveat=fine_grid no longer works as a call-time keyword; it moved to Flow's construction-time options and now needs a companion dense=false to avoid a SciML-level dense/saveat conflict. Rewrote the subsection around the working form, verified live (117 points vs 19 on the default grid). Trimmed the plotattr()/Plots.attributes() <details> blocks — generic Plots.jl mechanics, not OptimalControl API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
First time export_ocp_solution/import_ocp_solution are documented on the site. All claims verified live: exact JLD2/JSON3 round-trip, the double-extension footgun (filename="sol.jld2" writes sol.jld2.jld2), the real ExtensionError text for both missing backends, and that a reloaded solution works as an init= warm start identically to a fresh one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…rk board Full julia --project=docs docs/make.jl + npx vitepress build rebuild, clean: 0 undefined-binding/no-docs/duplicate-docs warnings, all three results/ pages' @example blocks execute, 0 unresolved @refs from them. test/suite/shape/test_shape_contract.jl re-run (27/27 passed). typos clean. All 6 acceptance criteria ticked against that build; two real findings beyond the checklist recorded in the report: CTModels.jl#392 affecting nearly every bare plot(sol) call in the attic source, and an off-by-3 line citation in the spec for the plot ExtensionError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #866 (
docs/solve, not yet merged) — base branch isdocs/solve, notmain, since PR 7 depends on PR 6 per the work board. Rebase ontomainonce #866 (and #865) merge.Writes the three "Results" pages (
docs/src/results/), replacing the PR-2 stubs:solution.md,plot.md,save-load.md(new page — this API was undocumented anywhere on the site before). This section is deliberately placed before Flows (PR 8): aFlow-produced trajectory is read and plotted with the exact same generics as asolve-returnedSolution, so PR 8 can say "same as Results" instead of repeating this content.solution.md: the spec's own accessor list includesis_empty(sol), which doesn't exist —is_emptyonly accepts aTimeGridModel, confirmed live viaMethodError. Used the real accessor,is_empty_time_grid(sol), instead. Dropped the "Solution struct" section (API-reference material) and the inlineexport_ocp_solution/import_ocp_solutionnote, nowsave-load.md's job.plot.md: ported the attic almost entirely (spec: "thorough and current"), with two real fixes found by executing every example for real:plot(sol)call in this specific attic file — triggered by an empty/default description regardless of styles orlayout=. Fixed throughout with explicit:state/:costate/:controlselectors orlayout=:group, with one clear note near the top instead of repeating the caveat at every occurrence.saveat=fine_gridno longer works as a call-time keyword ((::OptimalControlFlow)(tspan, x0, p0; ...)only acceptsvariable/unsafe/augmentnow) — it moved to a construction-time option onFlow(...)itself, and needs a companiondense=falseto avoid a SciML-level dense/saveat conflict. Rewrote the subsection around the working form, verified live (117 points vs. 19 on the default grid).plotattr()/Plots.attributes()<details>blocks — generic Plots.jl mechanics, not OptimalControl API.save-load.md(new): every claim verified live — exact JLD2 round-trip, JSON3 round-trip (bit-exact in this run, phrased as "not guaranteed" in general since JSON floats aren't always exact), the realExtensionError/IncorrectArgumentmessages, and that a reloaded solution works as aninit=warm start identically to a fresh one. Also filed CTModels.jl#399 (feature request, not a bug):filenameis documented as a base name with the extension always auto-appended, sofilename="sol.jld2"writessol.jld2.jld2— confirmed reproducible, documented explicitly on the page with a warning rather than silently worked around.Test plan
julia --project=docs docs/make.jl— full rebuild, two iterations to clean: 0 undefined-binding/no-docs/duplicate-docs warnings, all three pages'@exampleblocks execute, 0 unresolved@refs from them.npx vitepress buildon the Documenter output — site builds; spot-checked cross-links into docs: modelling — describe an optimal control problem #865'smodelling-inspectand docs: solve — direct methods, choosing and configuring them #866'ssolve-initial-guessanchors resolve in the built HTML.test/suite/shape/test_shape_contract.jl— 27/27 passed (backs the scalar-control-shape claim onsolution.md).typos— clean.docs/reports/07-results.mdacceptance criteria re-checked against the real build (6/6 ticked, two extra findings recorded beyond the checklist).🤖 Generated with Claude Code