[Metadata] Computed features, reference objective, shared initial guess
维护者通常 1 天内回复
@ocots 已经在做这个了。
开始于 2026年11月4日。
评估
这个 Issue 还没有评估数据。
描述
Agents: read the guide for agents in #310 first (order, difficulty, how to claim an issue, working method). The specification is in this description and in the comments below. This description was updated on 2026-11-06, after #360 and #375. Where an older comment contradicts it, the description wins: see the update comment.
Goal
Separate what is computed about a problem from what is declared in its metadata, add the declared fields the tests, the crons and the benchmarks need, and make the metadata the single source of the initial guess shared by every modeling (#151).
Part of #310, step 5. Depends on #283 (continuous problems, Problem) and #303 (statuses). Used by #304 (comparison rule), #305 (crons), #307 (documentation pages).
Work: sub-issues
| Part | Issue | State |
|---|---|---|
| 1. Reference objectives | #375 | done (#380) |
| 2. Features computed from the model | #376 | free; the documentation switch waits for #311 |
| 3. Shared initial guess in the metadata (with #151) | #377 | waits for #368, #369 |
| 4. Robustness of the initial guess, known local objectives | #378 | free |
| 5. Declared fields: tags, references, Corleone, reference solution, analytic objective | #379 | low priority |
How the tests use the metadata (since #360)
Three kinds of tests. Convergence is not a binary criterion any more.
- Does not break. Every CI run, short: every problem in every configuration, on a small grid with a few iterations. It fails on an exception or a non-finite objective. Convergence is not checked.
- Model equivalence. Every CI run, no solve: the modelings of a problem define the same problem (at the initial guess, and the NLP equivalence of #284). It fails when they differ. This is the important comparison between modelings.
- Convergence. In the weekly cron, or on demand (argument
convergence, labeltest convergence). Each problem is solved on its default grid. The report gives the solver status and the relative gap of the objective to the reference objective of the problem, for the grid and the scheme of the solve. It never fails: there is no tolerance. The cron flags what got worse since the previous run (issuecron-convergence).
So a metadata field is never a test threshold. References and known solutions say how far a solve is from them; statuses (:valid, :draft) say whether a model is finished and equivalent, not whether it converges.
Current state
ext/MetaData/<p>.jlholds:grid_size,:parameters,:status, optionally:notes. The schemaMETADATA_SCHEMA(src/OptimalControlProblems.jl:required,optional,generated) is checked at load time and bytest/suite/core/test_consistency.jl. An unknown field fails, so a new field must be added there.:reference_objectiveis a generated field (#375). See below.- The documentation browser computes dimensions, cost kind (Mayer / Lagrange / Bolza), fixed or free final time and constraint counts from the
ocp(docs/browser.jl,collect_problem_data). - Initial guesses are written in each model file. In
ext/OptimalControlModels/they are mostly constants, some functions of time. JuMP models use constantstart=values.
Computed, never written by hand (#376)
A function (e.g. features(:beam)) computes, when an extension is loaded: dimensions, cost kind, fixed or free initial and final times, kinds and counts of constraints (box on state / control / variable, nonlinear path, boundary). From the ocp (OptimalControl modelings), or from the keys stored in the JuMP model for problems available in JuMP only. Move the computation out of docs/browser.jl into it; the documentation (browser, status page) and CTBenchmarks read it.
Fields
| Field | Content |
|---|---|
:grid_size, :parameters |
unchanged |
:status, :notes |
see #303; :draft = model not finished or not equivalent, never "does not converge" (#360) |
:reference_objective |
generated, see below (#375) |
:init |
see below (#377) |
:tags |
controlled vocabulary defined in src and checked by the tests (e.g. :hard from CTDirect#580, :analytic, :large_state) (#379) |
:references |
bibliographic sources of the problem (literature values of the objective, when known, go here as information) (#379) |
:corleone |
optional, informative: a related problem in SciML's OptimalControlBenchmarks (#308, #379) |
:reference_solution |
optional: analytic x(t), u(t), for convergence orders (#379) |
| known local objectives | see #378 |
is dropped: since #360 a convergence failure is reported, never a test failure, so there is nothing to declare.:known_failures
Every field is type-checked at load time and by the consistency tests.
:reference_objective (done in #375)
- One reference per scheme, at the default grid of the problem: the objective of the discretized problem, which every solve of the convergence report is compared with. The trapezoidal rule exists for every problem; the other schemes come with #369.
- Computed from the convergence tests, never typed.
tools/references/update.jlreads their results (cron artifacts or a local run) and keeps the best objective among the solves that converged (every modeling, configuration and platform). It records the spread between them; above 1e-6,agreement = falsemeans that the configurations reached different solutions (#378). Stored inext/MetaData/references/<p>.toml, one table per scheme, with the grid, the parameters, the run and every solve. Procedure:tools/references/README.md. OptimalControlProblems.reference_objective(p; grid_size, scheme)returns the value, ornothing.- The consistency tests fail when a reference no longer matches the default grid or parameters of its problem (compute it again), and when a problem
:validin one modeling only has no reference (comparison rule). - For a problem available in one modeling only, a computed reference is a regression check, not an independent validation: the status page (#307) shows it as such.
- An analytic objective of the continuous problem, when it is known, is information with its source (#379). It is not the reference of a discretized solve: the two differ by the discretization error.
- No tolerance: the gap is reported, never tested.
Local solutions (#378)
Some problems have several local solutions (glider, cart_pendulum, and mountain_car, where Ipopt and MadNLP reach two of them). Next to the reference, a list of known local objectives per scheme and default grid, generated, not typed. The convergence report says which one a solve reached (the best known, a known local one, or a new one). A cron test solves each problem under several solver options and reports the spread: it tells whether an initial guess is robust.
:init (#377)
The initial guess of every modeling comes from the metadata, no longer from each model file:
- format
(state=…, control=…, variable=…); each component a constant, a vector, or a function oft, never data on a grid; - OptimalControl and OptimalControlScalarized: passed as is (
Problem.init, #283); - JuMP: evaluated at the nodes, with the number of controls of the scheme (
N+1for trapezoid,Nfor Euler and midpoint, see #284); - overridable:
beam(JuMPBackend(); init=…), andinit=insolveon the OptimalControl side; - maintainer's rule: the guess must make the solvers converge without being too close to the solution, so that the solves still exercise the iterations. Do not tune tolerances or grids first;
- the tests check that the OptimalControl guess and the JuMP start values coincide at the nodes (
comparison/test_init).
Not now
:expected_structure (smooth, bang-bang, singular, state constraints) is dropped: it depends on the parameters, and doing it properly means a list of arcs and switching times. To revisit with indirect methods.
Done when
-
features(:p)computed from the model;docs/browser.jluses it (#376). - Declared fields with type checks; consistency tests cover them (#379).
-
:reference_objectivefor every problem, computed from the convergence tests, source stated (#375). - Known local objectives and the robustness report (#378).
- Initial guesses read from the metadata by every modeling; no initial guess left in the model files (#377).
- Initial guess documented (#151), with how to override it (#377).
- 主要语言
- Julia
- 星标
- 13
- 派生
- 1
- 平均合并
- 3 小时 24 分钟
- 30 天内合并 PR
- 34
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
control-toolbox/OptimalControlProblems.jl 的其他 Issue
-
[Dev] One source of truth per problem, and the equality of the modelings checked by computation可能已有人在做 @ocots 今天认领。 未关闭
control-toolbox/OptimalControlProblems.jl#391 · 已指派 1 人 ·
维护者通常 1 天内回复
-
cron-failure
难度 4/5 1-2 天 新手友好度 25/100
control-toolbox/OptimalControlProblems.jl#381 ·
维护者通常 1 天内回复
-
[Metadata] Declared fields: tags, references, Corleone, reference solution可能已有人在做 @ocots 于 1 天前认领。 未关闭
control-toolbox/OptimalControlProblems.jl#379 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Metadata] Shared initial guess in the metadata, read by every modeling可能已有人在做 @ocots 于 1 天前认领。 未关闭
control-toolbox/OptimalControlProblems.jl#377 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Dev] Precompile the problems so that users and tests do not recompile them every time可能已有人在做 @ocots 于 1 天前认领。 未关闭
control-toolbox/OptimalControlProblems.jl#373 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 control-toolbox/OptimalControlProblems.jl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
-
难度 2/5 1-3 小时 新手友好度 67/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
backport 1.14 GC
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复