Suggested ehancement for NewtonPar: stop residual theshold and relative tolerance
In the Newton iteration, it sometimes happen for bad initial guess that the residual blow out to infinity very quickly. This may even causes NaNto occurs, causing issues down the line.
I would suggest to add in NewtonPar() a field residual_stop_threshold=Inf (default value to not change behaviour) which would automatically stop the Newton iterations if the residual exceed the threshold. Doing so would avoid blowout and in, during continuation, prevent some time waste trying to converge at bad guesses by immediately culling it.
Another improvement for NewtonPar() would be the explicitly split relative and absolute tolerance (with aTol and rTol fields). For large scale problem, it is more convenient to use relative tolerance which is less sensitive to the number of points.
For residual_stop_threshold, there is already a solution. You can pass a callback to solve or a callback_newton to contination. See for example here.
You can use the predefined callbacks cbMaxNormAndΔp or cbMaxNorm or make your own
As for abstol and reltol, that's a good idea. If you know how to modify newton, please make a PR
is it OK for this one?
Hi, I have started to write a PR and I saw than the Newton code is duplicated between the PALC algorithm and from the Newton solver (with the latter not using linesearch).
Could both method be merged into a single interface ?
Great! Thank you! It is not easy to merge them, it requires a dedicated infrastructure for very little gain. I agree that conceptually, it is annoying (and for maintenance too as you observe).
Hi,
Have you progressed on this?