Skip to content

[Paper] Control reconstruction faithful to the discretization scheme #659

Open

Description

@ocots

Goal

Make the control returned by a direct solve a function of time that is faithful to the discretization scheme, instead of a piecewise-constant interpolation for every scheme.

Why

For the benchmark paper (control-toolbox/CTBenchmarks.jl#207), the computed control is applied to a digital twin of the system through an actuator with its own clock (step Δt_a), which is not the clock of the algorithm (step h). When Δt_a < h, the actuator reads the control inside the steps of the algorithm, so what it reads is entirely determined by how the discrete control is turned into a function of time.

With a piecewise-constant reconstruction, the applied control is first-order accurate in time even when the scheme is of order 4 or 6: the accuracy paid for is lost, and the experiment would measure the reconstruction instead of the scheme. This also matters to any user who samples control(sol)(t) on a grid finer than the discretization grid.

What we know

  • CTModels.build_solution stores a control_interpolation (:constant or :linear). The default is :constant (documented as "direct methods"), :linear being for indirect methods. CTDirect does not seem to set it, so every scheme returns a piecewise-constant control, including the trapezoidal rule, whose controls live at the nodes.
  • With Gauss–Legendre 2 and 3, stage-wise controls are now the default formulation (Stage-wise controls for IRK methods #583), but the solution returns the control averaged over each step with the weights b_j; the stage values exist in the NLP but are not exposed.

Proposal (to be discussed)

Scheme What the scheme assumes Natural reconstruction
explicit Euler, midpoint one control per step, constant on the step piecewise constant (current); check the side of the interval
implicit Euler control evaluated at the end of the step piecewise constant with the right value; check the convention
trapezoid controls at the nodes, dynamics evaluated at both ends piecewise affine between nodes
Gauss–Legendre 2 and 3 controls at the collocation points of each step polynomial per step through the stage values, once they are exposed

The same question exists for the state: the collocation polynomial gives a natural dense output for Gauss–Legendre.

A more ambitious option, for later: rebuild the control between nodes by minimizing the Hamiltonian along the interpolated state and costate. It relies on the costate being correctly time-stamped (#640) and on the maximum principle, so it is a perspective rather than part of the paper's core.

Tasks to define

  • Check what each scheme actually returns today (values, time stamps, side of the intervals).
  • Set control_interpolation (or a richer reconstruction) according to the scheme; check that CTModels can carry a per-step polynomial, or extend it.
  • Expose the stage controls of Gauss–Legendre (Stage-wise controls for IRK methods #583).
  • Tests: on a smooth problem, the reconstructed control sampled on a grid much finer than h should converge at the order expected for the scheme.
  • Same reconstruction for the Exa modeler (its model is generated by CTParser).

Related

#583 (stage-wise controls for IRK methods), #640 (costate time stamps), #658 (clean direct methods: performance), control-toolbox/CTBenchmarks.jl#207 (practical quality of the computed control), tracking issue control-toolbox/CTBenchmarks.jl#200. Planning notes: objective O6.

How to work on this theme

This is a theme issue: it describes the work to do and what is known so far, it is not meant to be closed by a single PR.

  1. Whoever takes it first defines the work precisely and splits it into sub-issues (they can live in any repository of the organization).
  2. Work proceeds through the sub-issues; tick the checklist below as they are closed.
  3. Close the theme when everything is done or explicitly dropped.

Sub-issues

  • to be created when the theme is taken

Activity

  1. ocots commented on Nov 9, 2026

    @ocots
    MemberAuthor

    See also control-toolbox/CTModels.jl#518. The idea there is to construct functions of time for the state, control, costate, duals, that are consistent with the order of convergence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

paperBenchmark paper

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions