Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

minimization in scipy, algorithm to find all local minima of a N dimensional scalar function

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)

like image 514
Mathias Vanwolleghem Avatar asked Nov 21 '12 22:11

Mathias Vanwolleghem


People also ask

Is Scipy minimize deterministic?

The answer is yes.

How do I get Scipy optimize?

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.

Does Scipy have maximize?

The SciPy Optimize library provides a set of functions to minimize (or maximize) objective functions.


1 Answers

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.

like image 79
Julius Avatar answered Oct 01 '22 13:10

Julius