Skip to content

Scale dynamics constraints as residuals for optimal control - #4841

Draft
SebastianM-C wants to merge 2 commits into
SciML:masterfrom
SebastianM-C:smc/residual_scaling
Draft

Scale dynamics constraints as residuals for optimal control#4841
SebastianM-C wants to merge 2 commits into
SciML:masterfrom
SebastianM-C:smc/residual_scaling

Conversation

@SebastianM-C

Copy link
Copy Markdown
Member

Split out of #4394.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

The dynamics constraints are currently emitted as ∂x ~ tₛ*f(x), scaling each side
independently. For problems with multi-scale state variables this admits degenerate
tₛ → 0 solutions and converges poorly in Ipopt. This reformulates them as a single
scaled residual:

(∂x - tₛ*f(x)) / scale ~ 0

The scale defaults to getnominal(dvs[i]), so with no nominal value metadata and no
user-provided scales the formulation reduces exactly to the original. A scales
kwarg on the problem constructors lets the user override per variable.

This builds on the nominal value metadata from #4425process_DynamicOptProblem
now returns the resolved scales alongside pmap so the backends can apply them in
add_equational_constraints!.

Draft pending a decision on one point: the observed-bounds split (#4840) lifts
observed bounds into auxiliary variables with an equality constraint that is
currently unscaled. If both land, they should probably agree on a single scaling
convention rather than one using nominal values and the other not.

SebastianM-C and others added 2 commits August 6, 2026 14:38
Formulate dynamics as (∂x - tₛ*f(x)) / scale == 0 instead of scaling
each side independently. This prevents degenerate tₛ → 0 solutions and
improves Ipopt convergence for problems with multi-scale state variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SebastianM-C
SebastianM-C force-pushed the smc/residual_scaling branch from 8cc3b19 to a9c06fb Compare August 6, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant