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

Aperta
#511 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ocots ci sta già lavorando.

Dal 3/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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

Lingua principale
Julia
Stelle
3
Fork
1
Merge medio
8h
PR unite (30g)
57

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di control-toolbox/CTModels.jl

Tutte le issue di control-toolbox/CTModels.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.