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
When the residuals are not finite (eg Inf or NaN), the solver propagates them into the next call, which usually leads to things silently iterating until the maximum number of iterations are exhausted, without a warning.
An MWE is
using NLsolve
functionf(x)
any(isnan, x) &&printstyled("things went south\n"; color =:red)
@show x
map(x ->0.2<abs(x) <1?oftype(x, NaN) : x^3, x)
endnlsolve(f, fill(1.1, 3), autodiff =:forward, iterations =50, method =:newton)
If the static line search is used, this should definitely be caught somewhere, and the solver should stop. If a line search is used, it will keep halving the steps until a finite value is encountered. Thanks
Problem
When the residuals are not finite (eg
Inf
orNaN
), the solver propagates them into the next call, which usually leads to things silently iterating until the maximum number of iterations are exhausted, without a warning.An MWE is
Not sure if #228 is related.
Suggestions
At least a sanity check terminating the solver and returning as non-converged would avoid doing meaningless iterations. This would be a quick fix.
A heuristic algorithm could potentially recover from this by shrinking the steps taken until everything is finite, but that's more complex.
The text was updated successfully, but these errors were encountered: