Skip to content

Add a native bounded trust-region solver - #1219

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:feature/bounded-trust-region
Sep 10, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:feature/bounded-trust-region

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed

Adds BoundedTrustRegion, an explicit first-order solver that handles box bounds in the original coordinates. It projects dogleg and Cauchy candidates into the feasible box, chooses the candidate with the better quadratic-model reduction, and updates the trust radius from actual versus predicted reduction. Exact-bound initial guesses are supported; infeasible initial guesses are rejected before evaluating the residual.

For nonlinear least-squares problems, projected-gradient stationarity is a successful constrained optimum. For nonlinear root problems, the same non-root stationary point is not reported as success: the default leaves normal root termination in control, while an explicit gtol returns Stalled. The new public API is documented and the root and FirstOrder minor versions are bumped.

Scope and issue behavior

This is related to #1147, but does not close it. BoundedTrustRegion avoids the transform derivative vanishing at a bound, but it is still a local method and cannot guarantee selection of the interior-root basin.

From the reported u0 = [0.3, 1.0], the explicit bounded method converges to the lower-bound local least-squares point:

NonlinearProblem             retcode=Stalled u=[-0.950045503572065, 0.0] maxresid=0.3134419726056261
NonlinearLeastSquaresProblem retcode=Success u=[-1.030376814873944, 0.0] maxresid=0.3574929197184791

From u0 = [0.3, 5.0], in the interior-root basin:

NonlinearProblem retcode=Success u=[-0.24457517905731216, 5.548652801868546] maxresid=2.7755575615628914e-16

Failing before / passing after

The new test file was loaded in the Core test environment against clean base dc80c72d1:

include("misc_tests__item9.jl")
ERROR: LoadError: UndefVarError: `BoundedTrustRegion` not defined in `Main`
in expression starting at misc_tests__item9.jl:4

The same test file on this branch:

Test Summary:        | Pass  Total   Time
Bounded trust region |   24     24  28.3s

The assertions cover the native-bounds trait, interior roots, exact-bound least-squares stationarity, non-root root-problem behavior, out-of-place/in-place functions, static arrays, scalar and partial bounds, the issue residual, infeasible starts before residual evaluation, and reinitialization.

Verification

Julia 1.12.4, Linux x86_64:

lib/NonlinearSolveFirstOrder
GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()'
  Bounded trust region            |   24     24
  General NLLS Solvers            |  480    480
  NewtonRaphson                   |  309    309
  TrustRegion                     | 1176   1176
  Structured Jacobians            |   16     16
  SciMLOperator Jacobians         |   14     14
     Testing NonlinearSolveFirstOrder tests passed

lib/NonlinearSolveFirstOrder
GROUP=QA julia --project=. -e 'using Pkg; Pkg.test()'
  QA | 20 20
     Testing NonlinearSolveFirstOrder tests passed

repository root
GROUP=QA julia --project=. -e 'using Pkg; Pkg.test()'
  QA | 28 28
     Testing NonlinearSolve tests passed

JULIA_CONDAPKG_BACKEND=Null JULIA_PYTHONCALL_EXE=/usr/bin/python3 julia --project=docs docs/make.jl
  exit 0; doctests and document checks completed

julia --project=/home/crackauc/.julia/packages/Runic/2Ay9P -m Runic --check \
  lib/NonlinearSolveFirstOrder/src/NonlinearSolveFirstOrder.jl \
  lib/NonlinearSolveFirstOrder/src/solve.jl \
  lib/NonlinearSolveFirstOrder/src/trust_region.jl \
  lib/NonlinearSolveFirstOrder/test/misc_tests.jl \
  lib/NonlinearSolveFirstOrder/test/misc_tests__item9.jl src/NonlinearSolve.jl

typos Project.toml docs/src/native/solvers.md \
  docs/src/solvers/nonlinear_least_squares_solvers.md \
  docs/src/solvers/nonlinear_system_solvers.md docs/src/tutorials/bound_constraints.md \
  lib/NonlinearSolveFirstOrder/Project.toml \
  lib/NonlinearSolveFirstOrder/src/NonlinearSolveFirstOrder.jl \
  lib/NonlinearSolveFirstOrder/src/solve.jl \
  lib/NonlinearSolveFirstOrder/src/trust_region.jl \
  lib/NonlinearSolveFirstOrder/test/misc_tests.jl \
  lib/NonlinearSolveFirstOrder/test/misc_tests__item9.jl src/NonlinearSolve.jl

git diff --check origin/master...HEAD
  all exited 0 with no output

After the final rebase onto 9655f2694, which only changes Broyden/reset-condition code and a root test, the bounded boundary and interior-root smoke assertions also passed:

boundary_nlls=Success interior_root=Success maxresid=2.7755575615628914e-16

The docs build emitted only existing page-size warnings and the expected skipped-deployment warning.

Not verified

  • GPU/CUDA groups: no GPU is available.
  • Downstream and Julia pre jobs.
  • Julia 1.10 tests could not start in the shared depot because its installed PrecompileTools cache had a StaticData compatibility failure; the branch was validated with Julia 1.12.4 instead.

Review point

This is a projected dogleg/Cauchy method, not a Coleman-Li reflective implementation, and it is opt-in rather than a new default. In particular, it deliberately does not claim to make the reported initial guess in #1147 reach the interior root.

Links

ChrisRackauckas and others added 2 commits August 29, 2026 21:46
`BoundedTrustRegion` is new public API in NonlinearSolveFirstOrder, and 2.5.0
was registered from master while this branch was open.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Agent-Harness: Claude Code
Agent-Model: claude-fable-5-1
Agent-Session: https://claude.ai/code/session_01QnF4Nc4VpRrSjbbBTgeaUb
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the feature/bounded-trust-region branch 2 times, most recently from 6f2915f to 6e47e1a Compare September 10, 2026 08:48
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 10, 2026 09:20
@ChrisRackauckas
ChrisRackauckas merged commit ab11738 into SciML:master Sep 10, 2026
72 of 76 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 10, 2026
- Remove name duplicates in keyword arguments/named tuples (#1238)
- Add 32-bit Core CI lane via test_groups.toml (#1239)
- Add a native bounded trust-region solver (#1219)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 10, 2026
- Remove name duplicates in keyword arguments/named tuples (#1238)
- Add 32-bit Core CI lane via test_groups.toml (#1239)
- Add a native bounded trust-region solver (#1219)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 10, 2026
- Remove name duplicates in keyword arguments/named tuples (#1238)
- Add 32-bit Core CI lane via test_groups.toml (#1239)
- Add a native bounded trust-region solver (#1219)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 10, 2026
- Remove name duplicates in keyword arguments/named tuples (#1238)
- Add 32-bit Core CI lane via test_groups.toml (#1239)
- Add a native bounded trust-region solver (#1219)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants