Search code examples
pythonscipyscipy-optimizescipy-optimize-minimize

Quick Question: Use the default value of the scipy.optimize.minimize tol parameter


I was looking through the documentation of scipy.optimize.minimize for the default value of the parameter tol, but here the only description of the parameter is

Tolerance for termination. For detailed control, use solver-specific options.

I need a way to assign a default value to the parameter, since I want the user to chose whether or not he would like to set a custom tolerance. If there should not be a tolerance set, I don't know what to put into the variable. Also, it cannot be method-specific, since the method can also be chosen by the user. I would save a lot of time if I knew the default value, since there are a lot of different minimize calls -> if statements would make the code very ugly and quite a bit longer. Thanks!


Solution

  • You can see here how the tol parameter is handled in minimize. The default value is method specific. For example for Nelder-Mead they are xatol=1e-4, fatol=1e-4. You should check out all the methods here. (They are named as _minimize_methodname.) I don't think there is a way to set a global tol.