Tests of the duals: every kind of constraint, direct vs indirect, pinned algorithms
Los mantenedores suelen responder en 1 día
@ocots ya está trabajando en esto.
Desde el 31/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Follow-up of control-toolbox/CTFlows.jl#495 (the duals a flow can give) and companion of #1016 (doc examples of the sign convention).
Why
The ecosystem has one convention for the multipliers: ct-conventions SGN1–SGN6 (control-toolbox/ct-conventions#49). SGN6 is tested at the NLP level, in CTSolvers. Nothing yet checks it at the level of an optimal control solution, for every kind of constraint, and between the direct and the indirect method (SGN5). Only OptimalControl loads CTDirect and CTFlows together, so this test can only live here.
The idea is to pin the algorithms (solver, modeler, scheme, grid, options). With them pinned, we know what dual(sol, ocp, :label) should return. The tests then check that the duals are consistent across solvers, senses, ways of writing a constraint, and methods. A known gap is written as a @test_broken, so it stays visible and the test turns green when it is fixed.
What to test
For each kind of constraint, on a problem with a closed form:
| Kind | Example | Notes |
|---|---|---|
| path, mixed | x(t) + u(t) ≤ 0 (example 1 of #1016: dual = e^{t−1}) |
already sketched in #1016 |
| state constraint of order 1, as a path constraint and as a state box | x(t) ≥ 0.1, three arcs (control-toolbox/CTFlows.jl#440) |
same dual both ways (SGN5) |
| control box | e.g. ẋ = u, −1 ≤ u ≤ 1, x(0) = 0, −x(1) → min: u = 1, p = 1, upper dual = 1 |
scale of the box duals: CTDirect#639 |
| boundary, equality and inequality | an active and an inactive inequality row | sign of a one-sided row (SGN2) |
| variable box | a free variable that hits a bound |
Run every case along these axes:
- sense:
min Jandmax −J, which must give the same duals and costate (SGN1,SGN4); - writing:
g ≤ 0and−g ≥ 0(SGN2), and path vs box for the same constraint (SGN5); - solver: Ipopt and MadNLP (and others when available), with the solver and its version in the name of the test, as
SGN6asks; - modeler:
:adnlpand:exa(:exagives no path or boundary dual yet); - method: a direct solve and the solution of
Flow(ocp, law; constraint=:label, multiplier=μ), as far as CTFlows gives each kind (control-toolbox/CTFlows.jl#495).
Compare the sign exactly and the value up to the discretisation error, on pinned grids.
Known gaps, to be written as @test_broken
- Box duals are not divided by the time step, and their sign is opposite to that of the path duals: control-toolbox/CTDirect.jl#639.
- Path and boundary duals are missing with
:exa. - A flow does not yet give boundary, box, or variable duals (control-toolbox/CTFlows.jl#495).
Open questions
- Where: the test suite of OptimalControl, the docs (#1016: each example is also a test), or both, with the docs kept to the readable cases?
- CI cost: MadNLP and
:exaadd time. Should the full matrix run behind a label? - Tolerances: a fixed tolerance per pinned grid, or a check of the convergence order when the grid is refined?
Related: #1014 (the convention), #1015 (the page), #1016 (doc examples), control-toolbox/CTSolvers.jl#288, control-toolbox/CTDirect.jl#639, control-toolbox/CTFlows.jl#495.
🤖 Generated with Claude Code
- Lenguaje dominante
- Julia
- Estrellas
- 135
- Forks
- 11
- Merge medio
- 7 h 51 min
- PR fusionados (30 d)
- 22
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de control-toolbox/OptimalControl.jl
-
[Doc] User guide to the duals: every kind, constraint ↔ dual, direct ↔ indirectPosiblemente ocupada @ocots la tomó hace 5 días. Abierto
control-toolbox/OptimalControl.jl#1035 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Doc] Examples for the sign convention of duals and costate (min/max, writing of constraints, direct vs indirect)Posiblemente ocupada @ocots la tomó hace 13 días. Abierto
control-toolbox/OptimalControl.jl#1016 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Documentation: sign conventions (min/max, p⁰, constraints, duals) and how they appear in a solutionPosiblemente ocupada @ocots la tomó hace 16 días. Abiertodocumentation
control-toolbox/OptimalControl.jl#1015 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Tests fail on Julia 1.13: keyword-only anonymous function in test/problems/goddard.jlPosiblemente ocupada @ocots la tomó hace 18 días. Abierto
control-toolbox/OptimalControl.jl#996 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Docs: use Makie.Figure() instead of Makie.plot() for an empty canvasPosiblemente ocupada @ocots la tomó hace 18 días. Abierto
control-toolbox/OptimalControl.jl#994 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de control-toolbox/OptimalControl.jl
Issues similares
-
backport 1.14 GC
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
`binary_focal_loss` throws a `DomainError` when a negative sample has `ŷ = 1`Posiblemente ocupada @parth-patel010 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FluxML/Flux.jl#2818 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
JuliaDiff/TaylorSeries.jl#445 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
control-toolbox/CTActions#139 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SciML/Optimization.jl#1448 ·
Los mantenedores suelen responder en 1 día