Repository navigation
Add support for transforming bounded parameters into unbounded ones - #814
Merged
Merged
Conversation
JamesWrigley
force-pushed
the
bounds
branch
3 times, most recently
from
February 13, 2026 21:11
bd9c7fe to
7ba62e6
Compare
This adds support for bounds for any algorithm that doesn't natively support it.
Member
Author
|
Applied runic in 69cb989. |
| # doesn't receive 0 or 1, which would give ±Inf. Only applied once to u0 before | ||
| # the initial transform — it's a no-op if u0 is already in the interval. | ||
| # | ||
| # We use sqrt(eps) (~1.5e-8 for Float64) as the relative nudge factor. Plain eps |
Member
There was a problem hiding this comment.
that still seems large? Is eps()^(3/4) not more reasaonable?
|
|
||
| function _transform_u(w::BoundedWrapper, u) | ||
| return if isnothing(w.u_cache) | ||
| _from_unbounded.(u, w.lb, w.ub) |
Member
There was a problem hiding this comment.
this allocates. If it's enzyme, the cache should be in the w function and be written to.
Member
Author
There was a problem hiding this comment.
Ah right I didn't realize Enzyme doesn't use Dual's. Fixed in 8167dcd and added some more tests for the cache type. Do we also need to check Mooncake/ReverseDiff?
Member
|
It might be good to follow up with some kind of tutorial on box constraints? Since this is a feature many people ask about. But, merging as the feature seems done so let's get it out there. |
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/NonlinearSolve.jl
that referenced
this pull request
Feb 15, 2026
Follow-up to SciML#814 — adds a Documenter.jl tutorial covering box constraints for NonlinearProblem and NonlinearLeastSquaresProblem, including two-sided bounds, one-sided bounds, curve fitting, and in-place formulations. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 4.6 <[email protected]>
2 tasks
ChrisRackauckas
added a commit
that referenced
this pull request
Feb 16, 2026
Follow-up to #814 — adds a Documenter.jl tutorial covering box constraints for NonlinearProblem and NonlinearLeastSquaresProblem, including two-sided bounds, one-sided bounds, curve fitting, and in-place formulations. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 4.6 <[email protected]>
5 tasks done
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 adds support for bounds for any algorithm that doesn't natively support it. As suggested in SciML/CurveFit.jl#84. I didn't use TransformVariables.jl since the transform seems like a fairly straightforward thing to implement. I did add a dependency on LogExpFunction since that has robust versions of
logitandlogistic, but that's already a transitive dependency through ForwardDiff so it shouldn't increase load times. PreallocationTools is likewise also a dependency of SciMLBase.Written with a lot of help from Claude 🤖
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.