Does anybody know about a powerful routine/algorithm (preferrably in scipy/python) to localise "all" the local minima for a scalar real function of N variables in a defined ("rectangular") region of N-dimensional vector space ?
the constrained and unconstrained minimization algorithms in scipy all return only a single minimum (global or local)
The answer is yes.
Getting readyMake a new folder in your Desktop called scipy-optimize . Download scipy-optimize-data. zip and move the file to this folder. If it's not unzipped yet, double-click on it to unzip it.
The SciPy Optimize library provides a set of functions to minimize (or maximize) objective functions.
Scipy's basinhopping has a callback
argument that can be used to save all found minima.
For instance:
all_minima = []
def save_minima(x, f, accepted):
all_minima.append(x)
basinhopping(func, x0, callback=save_minima)
Obviously, this doesn't return all local minima necessarily. But it does return all that it finds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With