[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 小時 33 分鐘
- 30 天內合併 PR
- 55
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
control-toolbox/OptimalControlProblems.jl 的其他 Issue
-
[Cron/Doc] ModelingToolkit convergence cron, trajectories, and documentation (#308)可能已有人在做 @ocots 今天認領。 未關閉documentation feature
control-toolbox/OptimalControlProblems.jl#439 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[Tests] Corleone solve helper and ModelingToolkit test suite (smoke, equivalence, reference solution) (#308)可能已有人在做 @ocots 今天認領。 未關閉feature
control-toolbox/OptimalControlProblems.jl#438 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[Problems] ModelingToolkitBackend, extension ModelingToolkitModels, and continuous bryson_denham (#308)可能已有人在做 @ocots 今天認領。 未關閉feature
control-toolbox/OptimalControlProblems.jl#437 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
cron-convergence
難度 4/5 3-5 天 新手友好度 32/100
control-toolbox/OptimalControlProblems.jl#436 · 3 則留言 ·
維護者通常 1 天內回覆
-
cron-failure
難度 4/5 3-5 天 新手友好度 35/100
control-toolbox/OptimalControlProblems.jl#435 · 5 則留言 ·
維護者通常 1 天內回覆
查看 control-toolbox/OptimalControlProblems.jl 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
FluxML/Metalhead.jl#407 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
-
難度 1/5 1 小時以內 新手友好度 88/100
SciML/ModelingToolkit.jl#5371 ·
維護者通常 2 天內回覆
-
GNNLux MEGNetConv drops the state of stateful sublayers可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉lux
難度 2/5 1-3 小時 新手友好度 76/100
JuliaGraphs/GraphNeuralNetworks.jl#732 ·
維護者通常 2 天內回覆