This function does gradient-less minimization using the Nelder-Mead algorithm. No constraints are honoured.
[x0,v,nev] = nelder_mead_min (f,args,ctl) - Nelder-Mead minimization
Minimize 'f' using the Nelder-Mead algorithm. This function is inspired
from the that found in the book "Numerical Recipes".
ARGUMENTS
---------
f : string : Name of function. Must return a real value
args : list : Arguments passed to f.
or matrix : f's only argument
ctl : vector : (Optional) Control variables, described below
or struct
RETURNED VALUES
---------------
x0 : matrix : Local minimum of f
v : real : Value of f in x0
nev : number : Number of function evaluations
CONTROL VARIABLE : (optional) may be named arguments (i.e. "name",value
------------------ pairs), a struct, or a vector of length <= 6, where
NaN's are ignored. Default values are written <value>.
OPT. VECTOR
NAME POS
ftol,f N/A : Stopping criterion : stop search when values at simplex
vertices are all alike, as tested by
f > (max_i (f_i) - min_i (f_i)) /max(max(|f_i|),1)
where f_i are the values of f at the vertices. <10*eps>
rtol,r N/A : Stop search when biggest radius of simplex, using
infinity-norm, is small, as tested by :
ctl(2) > Radius <10*eps>
vtol,v N/A : Stop search when volume of simplex is small, tested by
ctl(2) > Vol
crit,c ctl(1) : Set one stopping criterion, 'ftol' (c=1), 'rtol' (c=2)
or 'vtol' (c=3) to the value of the 'tol' option. <1>
tol, t ctl(2) : Threshold in termination test chosen by 'crit' <10*eps>
narg ctl(3) : Position of the minimized argument in args <1>
maxev ctl(4) : Maximum number of function evaluations. This number <inf>
may be slightly exceeded.
isz ctl(5) : Size of initial simplex, which is : <1>
{ x + e_i | i in 0..N }
Where x == args{narg} is the initial value
e_0 == zeros (size (x)),
e_i(j) == 0 if j != i and e_i(i) == ctl(5)
e_i has same size as x
Set ctl(5) to the distance you expect between the starting
point and the minimum.
rst ctl(6) : When a minimum is found the algorithm restarts next to
it until the minimum does not improve anymore. ctl(6) is
the maximum number of restarts. Set ctl(6) to zero if
you know the function is well-behaved or if you don't
mind not getting a true minimum. <0>
verbose, v Be more or less verbose (quiet=0) <0>