You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bounds transform for problems with initialization data and quasi-Newton algorithms (#955)
* Fix bounds transform for problems with initialization data and quasi-Newton algs
Two bugs in the box-constraint bounds transform:
1. `transform_bounded_problem` unconditionally read `alg.autodiff`, which threw a
`FieldError` for algorithms without that field (e.g. `QuasiNewtonAlgorithm`,
reached as part of the default polyalgorithm). Guard the access.
2. The wrapped function carried over the original `initialization_data`, which is
defined in the *bounded* coordinates. Running it on the transformed problem
interpreted the unbounded iterate `t` as a bounded state and corrupted the
solution (e.g. ModelingToolkit `NonlinearProblem`s, which always attach
initialization data, converged to `from_unbounded(root)` instead of `root`).
Initialization is now run once in the original bounded space before
transforming, and stripped from the transformed function so it isn't re-run
in `t`-space.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
* Test the bounds-transform fix in NonlinearSolveBase's own suite
The umbrella `test/bounds_tests.jl` integration test exercised the fix through a
full solve, but on Julia < 1.11 the umbrella resolves the *registered*
NonlinearSolveBase (the `[sources]` path redirect to the in-repo sublibrary is
ignored there), so the test ran against unpatched code and failed.
Add a `transform_bounded_problem` unit test to NonlinearSolveBase's own test
suite, which always runs against the in-repo code (incl. on lts), covering the
quasi-Newton `autodiff`-access guard with a dummy algorithm that has no
`autodiff` field. Gate the umbrella integration test on the loaded
NonlinearSolveBase version so it only runs where the fix is present.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
---------
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
0 commit comments