Improve the logic to select initial guesses in the hybrid solver
In #11010, an interesting case is discussed where the hybrid solver needs to handle a nonlinear system with initial guesses that are not good enough. In particular, there is one variable which has no start attribute (hence it starts from zero), a nominal value of 1 (which should be meant for scaling!) and min = 0, max = 0.05.
The solver first tries with 0, then it apparently uses the nominal attribute 1 as a second best candidate guess value. The problem is, that value is outside the min/max bound, and it causes a singularity.
I would suggest to improve the hybrid solver by always limiting initial guess values with the min and max attributes.
Adding @bilderbuchi to the loop.
I would suggest to improve the hybrid solver by always limiting initial guess values with the min and max attributes.
#12201 changes the behavior so that iteration variables are always clamped between their min/max before every newton step, not only at the initial guess(es).
Excellent! I'm curious to see if this improves some simulation in the library testsuite. Thanks!
Is this only for the hybrid solver or also for the damped Newton solver?
Currently only hybrid. But I will look at it again and try to find a better place to do the clamping. I'd prefer to do it at a single place in the code, but perhaps this needs to be copied to several places...
OK. In fact, this could be a double-edged sword, since in some cases min-max attributes could be a bit bogus, as demonstrated by the few regressions we got.
Ideally, we should try with clamping first, and if if fails, retry without.