[Problems] Proof of concept: a ModelingToolkit modeling, solved with Corleone, with our own bryson_denham
Les mainteneurs répondent en général sous 1 jour
@ocots y travaille déjà.
Depuis le 4/11/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
Updated on 2026-11-06 after #360 (convergence is reported, not tested) and #375 (reference objectives). Where an older comment contradicts this description, the description wins; what changed is listed in the update comment.
Goal
A proof of concept of a new modeling, ModelingToolkit: write our own bryson_denham as a ModelingToolkit system in this package, as an extension, and show how to solve it with Corleone (SciML, direct shooting with DiffEq), with retrieval, tests and documentation. This shows that every part of the infrastructure (registry, statuses, tests, crons, results pipeline, documentation) handles a modeling whose method differs. Then decide whether to write more problems this way.
Modeling and solving are separate, as for OptimalControl (problem written with @def, method chosen in solve): the modeling is the language the problem is written in, ModelingToolkit; Corleone is one way to solve a ModelingToolkit system, as Ipopt is for JuMP. Other methods could solve the same system (ModelingToolkit's own dynamic optimization interfaces, e.g. JuMPDynamicOptProblem, CasADiDynamicOptProblem, to check).
Part of #310, step 7 (last). Depends on #303, #304, #306, #314, #307.
What it is not
Not an import of SciML's OptimalControlBenchmarks catalogue. The problem is ours, rewritten: our dynamics, parameters, cost, initial guess; only the method changes (shooting with piecewise-constant controls instead of collocation). Their catalogue is a source of inspiration (MTK and Corleone usage, prepare_benchmark, solve_with_corleone, plotting) and of problems to port later.
Problem
bryson_denham as in ext/OptimalControlModels/bryson_denham.jl: ẋ₁ = x₂, ẋ₂ = u, x(0) = (0, 1), x(1) = (0, -1), x₁(t) ≤ 1/9, cost ∫ ½ u², parameters from ext/MetaData/bryson_denham.jl. Analytic optimum (ℓ = 1/9 ≤ 1/6): J = 4/(9ℓ) = 4, recorded as the analytic objective with its source (#379). The reference_objective of #375 is the objective of the trapezoidal discretization at the default grid (4.000143…): it does not apply to a shooting solve, whose discretization differs.
Inherent to shooting with Corleone, to state on the problem page: the state constraint is imposed at the points of a constraint grid only, and controls are piecewise constant on a control grid.
The ModelingToolkit system must be continuous. In SciML's catalogue, the constructor receives the grids and samples the state constraint itself (x(tᵢ) ≲ 1/9 for tᵢ in constraint_grid). Here:
- (a) write a continuous path constraint
x₁(t) ≲ 1/9in the system, if ModelingToolkit can represent it; - (b) sample it on Corleone's constraint grid when preparing the solve.
First task: check (a). If ModelingToolkit cannot represent a continuous path constraint, fall back to passing the constraint grid at retrieval, as grid_size for JuMP, and say so here.
Scope
- Modeling: entry
ModelingToolkitBackendin the modeling table (#303); extension triggered by ModelingToolkit only; fileext/ModelingToolkitModels/bryson_denham.jl; status:draftfirst. - Retrieval:
bryson_denham(ModelingToolkitBackend(); parameters=…)returns our genericProblem(#283);model(pb)is the continuous ModelingToolkit system (with its time span). - Solving with Corleone (not part of the extension; in tests, documentation and user code): build the control, shooting and constraint grids from a grid size (single shooting by default, multiple shooting as an option), prepare the Corleone model (as
prepare_benchmarkin SciML's catalogue), solve with Ipopt. - Initial guess: our shared
:init(#306) is used: evaluated on the control grid for the controls, and at the shooting nodes for the states in multiple shooting, written into the parameter vector of the prepared Corleone model (model.ps, throughpack/reconstructas in Corleone's examples). Check first that this is possible. - Tests (
test/ModelingToolkitenvironment, which also loads Corleone; labeltest ModelingToolkit backend; Saturday cron of #305):
Three kinds of tests, as for the other modelings (#360):- does not break (every run): build the system; solve with Corleone on a small grid with a few iterations (Ipopt); no exception, finite objective;
- model equivalence (every run): the cross-evaluation: project the optimal control of OptimalControl onto the piecewise-constant control grid, evaluate the Corleone model with it, compare cost and constraint violation with OptimalControl's result. This checks that the mathematical problem is the same although the methods differ; the comparison needs a tolerance derived from the grid (piecewise-constant controls, sampled constraint). Check first what Corleone lets us evaluate with imposed parameters;
- convergence report (cron, never fails, no tolerance): solve on the default grid; report the solver status and the gaps to the analytic objective and to the OptimalControl objective.
- Documentation: the ModelingToolkit documentation adapter of #307 / #314: the tab of the problem page shows how to get the system and solve it with Corleone; result in
result.json; plot. Nothing else changes, which checks that the documentation handles every modeling generically.
Points to check first
- Environments: with an extension, users who do not load ModelingToolkit install nothing; but the
test/ModelingToolkitand documentation environments must resolve the OptimalControl v2 stack and the SciML stack together (shared dependencies such as ForwardDiff or Symbolics). If the documentation environment cannot, compute these results in their own job (#314) and only read them in the documentation. - Compat bounds for ModelingToolkit (extension) and Corleone (test and documentation environments), which move fast.
Noted while reading OptimalControlBenchmarks (for later)
Not needed here, since we write our own problems; to report to the authors if useful:
robbins: the state constraint isx₃(tᵢ) ≥ 0in a variable namedgrid_cons_x₁; the Robbins problem constrainsx₁.double_oscillator:m₁ = 200(ours 100), and the cost integrated over(0, 1)while the horizon is[0, 2π].bryson_denham: cost∫ w²(no ½), state constraint sampled.
Done when
- Continuous path constraint in the ModelingToolkit system checked (a), or fallback documented.
-
ModelingToolkitBackendin the modeling table;bryson_denhamavailable in it, with our parameters; solved with Corleone using our initial guess. - Tests pass in
test/ModelingToolkit(does not break, cross-evaluation); the convergence report shows the gaps; status switched to:validonce the model is equivalent. - Problem page shows the ModelingToolkit tab (get, then solve with Corleone) and results without specific code in the generators.
- Decision in this issue: write more problems with ModelingToolkit or not.
- Langage dominant
- Julia
- Étoiles
- 13
- Forks
- 1
- Merge moyen
- 3 h 24 min
- PR mergées (30 j)
- 34
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de control-toolbox/OptimalControlProblems.jl
-
[Dev] One source of truth per problem, and the equality of the modelings checked by computationPeut-être pris @ocots l’a pris aujourd’hui. Ouverte
control-toolbox/OptimalControlProblems.jl#391 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[Cron] cron-failureOuvertecron-failure
Difficulté 4/5 1-2 jours Accessibilité débutants 25/100
control-toolbox/OptimalControlProblems.jl#381 ·
Les mainteneurs répondent en général sous 1 jour
-
[Metadata] Declared fields: tags, references, Corleone, reference solutionPeut-être pris @ocots l’a pris il y a 1 jour. Ouverte
control-toolbox/OptimalControlProblems.jl#379 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[Metadata] Shared initial guess in the metadata, read by every modelingPeut-être pris @ocots l’a pris il y a 1 jour. Ouverte
control-toolbox/OptimalControlProblems.jl#377 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[Dev] Precompile the problems so that users and tests do not recompile them every timePeut-être pris @ocots l’a pris il y a 1 jour. Ouverte
control-toolbox/OptimalControlProblems.jl#373 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de control-toolbox/OptimalControlProblems.jl
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Add project: Typst_jll.jlPeut-être pris @github-actions l’a pris il y a 1 jour. Ouverteadd-project
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
YDX-2147483647/best-of-typst#590 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100