Scale dynamics constraints as residuals for optimal control - #4841
Draft
SebastianM-C wants to merge 2 commits into
Draft
Scale dynamics constraints as residuals for optimal control#4841SebastianM-C wants to merge 2 commits into
SebastianM-C wants to merge 2 commits into
Conversation
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
force-pushed
the
smc/residual_scaling
branch
from
August 6, 2026 12:54
8cc3b19 to
a9c06fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #4394.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
The dynamics constraints are currently emitted as
∂x ~ tₛ*f(x), scaling each sideindependently. For problems with multi-scale state variables this admits degenerate
tₛ → 0solutions and converges poorly in Ipopt. This reformulates them as a singlescaled residual:
The scale defaults to
getnominal(dvs[i]), so with no nominal value metadata and nouser-provided scales the formulation reduces exactly to the original. A
scaleskwarg on the problem constructors lets the user override per variable.
This builds on the nominal value metadata from #4425 —
process_DynamicOptProblemnow returns the resolved
scalesalongsidepmapso the backends can apply them inadd_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.