simplex - Nelder-Mead simplex optimizer (amoeba)¶
simplex |
Minimize a function using Nelder-Mead downhill simplex algorithm. |
Downhill simplex optimizer.
-
bumps.simplex.
simplex
(f, x0=None, bounds=None, radius=0.05, xtol=0.0001, ftol=0.0001, maxiter=None, update_handler=None, abort_test=<function dont_abort>)[source]¶ Minimize a function using Nelder-Mead downhill simplex algorithm.
This optimizer is also known as Amoeba (from Numerical Recipes) and the Nealder-Mead simplex algorithm. This is not the simplex algorithm for solving constrained linear systems.
Downhill simplex is a robust derivative free algorithm for finding minima. It proceeds by choosing a set of points (the simplex) forming an n-dimensional triangle, and transforming that triangle so that the worst vertex is improved, either by stretching, shrinking or reflecting it about the center of the triangle. This algorithm is not known for its speed, but for its simplicity and robustness, and is a good algorithm to start your problem with.
Parameters:
- f : callable f(x,*args)
- The objective function to be minimized.
- x0 : ndarray
- Initial guess.
- bounds : (ndarray,ndarray) or None
- Bounds on the parameter values for the function.
- radius: float
- Size of the initial simplex. For bounded parameters (those which have finite lower and upper bounds), radius is clipped to a value in (0,0.5] representing the portion of the range to use as the size of the initial simplex.
Returns: Result (park.simplex.Result)
- x : ndarray
- Parameter that minimizes function.
- fx : float
- Value of function at minimum:
fopt = func(xopt)
. - iters : int
- Number of iterations performed.
- calls : int
- Number of function calls made.
- success : boolean
- True if fit completed successfully.
Other Parameters:
- xtol : float
- Relative error in xopt acceptable for convergence.
- ftol : number
- Relative error in func(xopt) acceptable for convergence.
- maxiter : int=200*N
- Maximum number of iterations to perform. Defaults
- update_handler : callable
- Called after each iteration, as callback(k,n,xk,fxk), where k is the current iteration, n is the maximum iteration, xk is the simplex and fxk is the value of the simplex vertices. xk[0],fxk[0] is the current best.
- abort_test : callable
- Called after each iteration, as callback(), to see if an external process has requested stop.
Notes
Uses a Nelder-Mead simplex algorithm to find the minimum of function of one or more variables.