Read the limits of the duals at the switching times by label (with a mask of the known limits)

Abierto
#511 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@ocots ya está trabajando en esto.

Desde el 3/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Follow-up of #493 (PR #509). Part of control-toolbox/CTFlows.jl#512 (tracking of the constraint duals). Not urgent: no consumer needs it today; open to keep track of the design.

Problem

Since #509, the limits of the duals at the switching times are given by label, SwitchingModel(; duals=Dict(label => (left, right))), but read by component: limits(sw, :path_dual), limits(sw, :state_dual), left_limit(sol, :control_dual, i). The rows of a label whose limits were not given hold NaN.

  • The asymmetry: a producer gives the limits of :c1, a reader must know the rows of :c1 (constraint_rows) to find them back.
  • There is no mask of the known limits, unlike the duals (DualMasks): NaN is the only signal of "not given", so a NaN really computed by a producer cannot be told apart from a limit not given (the plot draws both as "no jump", see PlotCase._fill_unknown_limits). For the duals, the mask is the authority and NaN only a safety net.

Proposal

Do the two together, or neither:

  • A reader by label, symmetric of the input, e.g. dual_limits(sol, model, label) -> (left, right) (one row per switching time, the signed dual for a box label, a scalar per time for a one-row label), throwing a PreconditionError when the limits of label were not given, as dual does; and has_dual_limits(sol, model, label).
  • A mask of the known limits per kind in the SwitchingModel (path, state, control), canonical as DualMasks (nothing when every column is known), so that the reader has an authority to decide; serialized like the dual masks (written only when partial).

The plot (#506 / #510) could then read the limits of a row by label instead of by columns.

Why not in #509

A mask without a reader by label would be state that nobody consults; NaN is enough and consistent for data read by component (see the discussion in #509).

Tests

  • by label = by component for path and box labels, one-row and vector labels;
  • a label without limits throws a PreconditionError; has_dual_limits agrees;
  • the mask: canonical, serialized, a file without it read as before.

🤖 Generated with Claude Code

Lenguaje dominante
Julia
Estrellas
3
Forks
1
Merge medio
8 h
PR fusionados (30 d)
57

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de control-toolbox/CTModels.jl

Todos los issues de control-toolbox/CTModels.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.