Repository navigation
Make SobolMultistart the default bounded solver (stall recovery, #1147) - #1278
Merged
ChrisRackauckas merged 2 commits intoSep 14, 2026
Merged
Conversation
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
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]>
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.
Summary
Adds
SobolMultistart, a deterministic multistart wrapper for bound-constrained solves, and makes it the default solver for problems withlborub(bothNonlinearProblemandNonlinearLeastSquaresProblem, acrosssolve/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 referencetrfimplementation and IPOPT reproduce identically — and reportStalledwith a nonzero residual.SobolMultistart(alg = FastShortcutBoundedPolyalg(); nstarts = 16)runs the wrapped bounded algorithm fromprob.u0first — 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 asearch_scale * max(1, |u0_i|)window). Every start goes through the ordinarysolve/initpath, solinsolve,concrete_jac, sparsejac_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), returnsSuccessonly for an actual root, and reportsStalledotherwise — 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)
solve(prob)→Successatu = [-0.24457517905731213, 5.548652801868546],|resid| ≈ 3.6e-16(wasStalledbefore this PR)solve(prob, FastShortcutBoundedPolyalg())→Stalledatu = [-0.950045503572065, 0.0],|resid| ≈ 0.421— the explicit local path still reports the boundary KKT point honestlysolve(prob, SobolMultistart(; nstarts = 1))→Stalled, with warning that the restoration probe converged to a root outside the box atu ≈ [-0.2446, -0.7345]— honest classification of the genuine constrained stallInitialization semantics under the wrapper
SobolMultistart.__solveruns the initialization pipeline once, then every sub-solve and the restoration probe run withinitializealg = SciMLBase.NoInit()(mirroring the polyalgorithm's stage handling) — init callbacks fire exactly once on uncached and cached paths, andNoIniterrors propagate.NonlinearSolveNoInitCache.solve!now forwardsinitializealg = 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-enterssolve).supports_postconditiondelegates to the wrapped algorithm sopostconditionkwargs keep restricting the inner polyalgorithm's stages.Test plan
SobolMultistart bounded recoveryintest/PolyAlgorithms/sobol_multistart_tests.jl(56 tests) plus updatedbounded_defaults_tests.jl, covering:TrustRegionReflective()andBoundedTrustRegion()wrappers, and throughinit/solve!)prob.u0-first invariant (nstarts = 1reproduces the direct solve)Stalled)Stalledwhen no root exists)NoInitpropagates errorspostconditionstill restricts the wrapped polyalgorithm's stagesNonlinearLeastSquaresProblem, scalar statejac_prototypeand matrix-free Krylov (KrylovJL_LSMR) sub-solvescache.caches,cache.best,retain_best) now use the explicitFastShortcutBoundedPolyalg()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 CachingandBounds:*testsets affected by thesolve!change)GROUP=QA— 28/28 root, 20/20lib/NonlinearSolveFirstOrderjulia --project=docs docs/make.jlbuilds; the docs example asserts both the localStalledand defaultSuccesspaths livetyposclean;git diff --checkcleanDependency / 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)