Use clamp-then-shrink for trust-box construction at variable bounds#570
Open
rjoomen wants to merge 1 commit into
Open
Use clamp-then-shrink for trust-box construction at variable bounds#570rjoomen wants to merge 1 commit into
rjoomen wants to merge 1 commit into
Conversation
rjoomen
force-pushed
the
fix/trust-box-clamp-then-shrink
branch
from
July 23, 2026 13:05
713c74b to
424b37b
Compare
Near a variable bound the trust box was built by sliding the full-width box inside [lb, ub] (the "slide always" policy). That kept the 2*box_size width but let the QP step exceed box_size on the interior-facing side whenever a bound was active, breaking the trust-region invariant ||p||_inf <= box_size that the SQP merit-improve machinery relies on -- even for iterates strictly inside their bounds. Switch to clamp-then-shrink: clamp the iterate into [lb, ub], then strict-shrink the box against the bounds. For in-bounds iterates this restores ||p||_inf <= box_size; when the iterate has drifted outside its bounds (failed step, bad warm-start) the box still stays well-formed (non-empty, non-inverted), so the QP solver does not error out. Applied to both QP problem variants (IfoptQPProblem, TrajOptQPProblem) and the trajopt_sco optimizer. Verified by trust_box_floor_unit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rjoomen
force-pushed
the
fix/trust-box-clamp-then-shrink
branch
from
July 23, 2026 13:08
424b37b to
4f2d9ac
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.
This is a follow-up to #472, which fixed the trust box extending past variable bounds by sliding the full-width box inside [lb, ub] (the "slide always" policy). That fix kept the box well-formed, but preserving the full 2·box_size width let the QP step exceed box_size on the interior-facing side whenever a bound was active — breaking the trust-region invariant ‖p‖∞ ≤ box_size that the SQP merit-improve machinery relies on, even for iterates strictly inside their bounds (within a trust-radius of a bound).
This PR replaces the slide-always policy with clamp-then-shrink: clamp the iterate into [lb, ub], then strict-shrink the box against the bounds.
It keeps the bug-fix property from #472 (box stays well-formed at and beyond bounds) while restoring the trust-region invariant for in-bounds iterates.
Behavior
Scope
Applied consistently to both QP-problem variants (IfoptQPProblem, TrajOptQPProblem) and the trajopt_sco optimizer.
Testing
New unit test trust_box_floor_unit covers the in-bounds invariant, the near-bound ramp, the at-bound floor, and the outside-bounds well-formedness across all three code paths.