Skip to content

Make SobolMultistart the default bounded solver (stall recovery, #1147) - #1278

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:bounded-stall-recovery
Sep 14, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:bounded-stall-recovery

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds SobolMultistart, a deterministic multistart wrapper for bound-constrained solves, and makes it the default solver for problems with lb or ub (both NonlinearProblem and NonlinearLeastSquaresProblem, across solve/init/initialization_alg). It addresses the failure mode reported in #1147: native bounded methods can converge to a constrained stationary point on an active bound that is not a root of the system — a genuine KKT point of the box-constrained merit problem that scipy's reference trf implementation and IPOPT reproduce identically — and report Stalled with a nonzero residual.

SobolMultistart(alg = FastShortcutBoundedPolyalg(); nstarts = 16) runs the wrapped bounded algorithm from prob.u0 first — so a normally-converging solve costs exactly one polyalgorithm solve — then from a deterministic Sobol low-discrepancy sequence of restarts (finite bounds sample the box; infinite bounds use a search_scale * max(1, |u0_i|) window). Every start goes through the ordinary solve/init path, so linsolve, concrete_jac, sparse jac_prototype, JVP/VJP callbacks, AD backends, and solver kwargs are inherited unchanged. The wrapper keeps the best feasible result, early-exits on success (early_exit = true), returns Success only for an actual root, and reports Stalled otherwise — it never masks failure. solve(prob, FastShortcutBoundedPolyalg()) selects the purely local sequence explicitly.

An IPOPT-style restoration probe (restoration = true) runs when a start stalls on an active bound with nonzero residual: one unbounded solve from the stalled iterate with nonfixed bounds removed. A probe root inside the original box is returned as the solution; a root outside the box is evidence the stall is a genuine constrained solution — the stalled result is kept and the outside root is reported via a warning. (Note this is deliberately local: real IPOPT restoration was tested against the #1147 MWE and also fails to escape — the multistart supplies the nonlocal recovery, the probe supplies honest classification.)

Before / after (MWE from #1147)

f!(u, p) = [cos(u[2]) + sin(u[1]) - 0.5, sin(u[2]) + cos(u[1]) - 0.3]
prob = NonlinearProblem(NonlinearFunction{false}(f!), [0.3, 1.0], nothing;
    lb = [-100.0, 0.0], ub = [100.0, 10.0])
  • solve(prob) → Success at u = [-0.24457517905731213, 5.548652801868546], |resid| ≈ 3.6e-16 (was Stalled before this PR)
  • solve(prob, FastShortcutBoundedPolyalg()) → Stalled at u = [-0.950045503572065, 0.0], |resid| ≈ 0.421 — the explicit local path still reports the boundary KKT point honestly
  • solve(prob, SobolMultistart(; nstarts = 1)) → Stalled, with warning that the restoration probe converged to a root outside the box at u ≈ [-0.2446, -0.7345] — honest classification of the genuine constrained stall

Initialization semantics under the wrapper

  • SobolMultistart.__solve runs the initialization pipeline once, then every sub-solve and the restoration probe run with initializealg = SciMLBase.NoInit() (mirroring the polyalgorithm's stage handling) — init callbacks fire exactly once on uncached and cached paths, and NoInit errors propagate.
  • NonlinearSolveNoInitCache.solve! now forwards initializealg = SciMLBase.NoInit() to the inner solve so cached solves of wrapper algorithms do not re-run initialization (also fixes the same double-init for any __solve-only algorithm that re-enters solve).
  • supports_postcondition delegates to the wrapped algorithm so postcondition kwargs keep restricting the inner polyalgorithm's stages.

Test plan

SobolMultistart bounded recovery in test/PolyAlgorithms/sobol_multistart_tests.jl (56 tests) plus updated bounded_defaults_tests.jl, covering:

  • the Bounded NonlinearProblem stalls on a problem with a root inside the box #1147 regression: explicit local polyalg stalls, default solve reaches the interior root (also via TrustRegionReflective() and BoundedTrustRegion() wrappers, and through init/solve!)
  • deterministic starts and prob.u0-first invariant (nstarts = 1 reproduces the direct solve)
  • restoration accepting an in-box root and reporting an out-of-box root honestly (warning + Stalled)
  • failure is never masked (Stalled when no root exists)
  • initialization callbacks fire exactly once on cached and uncached paths; NoInit propagates errors
  • postcondition still restricts the wrapped polyalgorithm's stages
  • constructor validation, mixed/infinite bounds, fixed coordinates, NonlinearLeastSquaresProblem, scalar state
  • sparse jac_prototype and matrix-free Krylov (KrylovJL_LSMR) sub-solves
  • cache-internals tests (cache.caches, cache.best, retain_best) now use the explicit FastShortcutBoundedPolyalg()

Run results:

  • GROUP=PolyAlgorithms julia --project -e 'using Pkg; Pkg.test()' — all green (386 bounded-default + 56 new + all other group tests)
  • GROUP=Core julia --project -e 'using Pkg; Pkg.test()' — all green (incl. NoInit Caching and Bounds:* testsets affected by the solve! change)
  • GROUP=QA — 28/28 root, 20/20 lib/NonlinearSolveFirstOrder
  • julia --project=docs docs/make.jl builds; the docs example asserts both the local Stalled and default Success paths live
  • Runic formatting clean; typos clean; git diff --check clean

Dependency / license note

Adds Sobol.jl 1.5 (MIT license; bundled direction-number data under a permissive attribution notice) as a direct dependency of NonlinearSolveFirstOrder. No copyleft dependencies are introduced.

🤖 Generated with Devin CLI (model: SWE-2 Max)
Session: /home/crackauc/.local/share/devin/cli/transcripts/aluminum-blizzard.json (local Devin session, no shareable URL)

ChrisRackauckas and others added 2 commits September 13, 2026 17:52
Native bounded methods can converge to a constrained stationary point
on an active bound that is not a root of the system (issue SciML#1147).
SobolMultistart wraps a bounded algorithm with deterministic Sobol
restarts: prob.u0 is always tried first, finite bounds are sampled
over the box, and infinite bounds use a search_scale window around
u0. Every start runs through the ordinary solve/init path, so
Jacobian, AD, sparse prototype, operator, and linear-solver choices
carry over unchanged.

When a start stalls on an active bound with nonzero residual, an
IPOPT-style restoration probe reruns once from the stalled iterate
with the nonfixed bounds removed. A probe that lands inside the
original box returns that root; a root outside the box confirms the
stall is a genuine constrained solution, keeps the stalled result,
and reports the outside root via a warning. The wrapper returns the
best feasible sub-solve, reports Stalled when no start converges,
and never reports a failed sub-solve as a success. The default
FastShortcutBoundedPolyalg behavior is unchanged.

Adds Sobol.jl (MIT) as a NonlinearSolveFirstOrder dependency.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.10.21
Agent-Model: SWE-2 Max
Agent-Session: /home/crackauc/.local/share/devin/cli/transcripts/aluminum-blizzard.json (local Devin session, no shareable URL)
Bounded NonlinearProblem and NonlinearLeastSquaresProblem defaults now wrap
FastShortcutBoundedPolyalg in SobolMultistart (16 deterministic starts, u0
first). A successful local solve costs exactly one polyalgorithm solve; the
Sobol restarts and restoration probe only run when the local solve stalls on
a constrained stationary point that is not a root, which is where the
previous default reported Stalled (issue SciML#1147). Selecting
FastShortcutBoundedPolyalg() explicitly keeps the purely local sequence.

Initialization semantics are preserved under the wrapper: SobolMultistart
runs the initialization pipeline once and passes initializealg = NoInit()
to sub-solves, and NonlinearSolveNoInitCache.solve! forwards NoInit so init
callbacks do not fire a second time on the cached path. supports_postcondition
is delegated to the wrapped algorithm, and sub-solve errors are propagated
with throw.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.10.21
Agent-Model: SWE-2 Max
Agent-Session: /home/crackauc/.local/share/devin/cli/summaries/history_b07e5f4e8ea44218.md (local session transcript)
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Add SobolMultistart for bounded stall recovery Make SobolMultistart the default bounded solver (stall recovery, #1147) Sep 14, 2026
@ChrisRackauckas
ChrisRackauckas merged commit 52b7e8c into SciML:master Sep 14, 2026
98 of 104 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 14, 2026
- Make SobolMultistart the default bounded solver (stall recovery, #1147) (#1278)
- Bump actions/upload-artifact from 4 to 7 (#1279)
- Bump julia-actions/cache from 2 to 3 (#1281)
- Bump actions/checkout from 6 to 7 (#1282)
- Bump julia-actions/setup-julia from 2 to 3 (#1280)



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 14, 2026
- Add shared NLLS sensitivity helpers for the SciMLSensitivity reverse-mode adjoint (#1275)
- Release NonlinearSolveBase 2.51.0 (#1277)
- Make SobolMultistart the default bounded solver (stall recovery, #1147) (#1278)
- Bump actions/upload-artifact from 4 to 7 (#1279)
- Bump julia-actions/cache from 2 to 3 (#1281)
- Bump actions/checkout from 6 to 7 (#1282)
- Bump julia-actions/setup-julia from 2 to 3 (#1280)



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 14, 2026
- Add shared NLLS sensitivity helpers for the SciMLSensitivity reverse-mode adjoint (#1275)
- Release NonlinearSolveBase 2.51.0 (#1277)
- Make SobolMultistart the default bounded solver (stall recovery, #1147) (#1278)
- Bump actions/upload-artifact from 4 to 7 (#1279)
- Bump julia-actions/cache from 2 to 3 (#1281)
- Bump actions/checkout from 6 to 7 (#1282)
- Bump julia-actions/setup-julia from 2 to 3 (#1280)



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