The AMOEBA function performs multidimensional minimization of a function Func ( x ), where x is an n -dimensional vector, using the downhill simplex method of Nelder and Mead, 1965, Computer Journal , Vol 7, pp 308-313.
The downhill simplex method is not as efficient as Powell's method, and usually requires more function evaluations. However, the simplex method requires only function evaluations--not derivatives--and may be more reliable than Powell's method.
If the minimum is found, AMOEBA returns an n -element vector corresponding to the function's minimum value. If a minimum within the given tolerance is not found within the specified number of iterations, AMOEBA returns a scalar value of -1. Results are returned with the same precision (single- or double-precision floating-point) as is returned by the user-supplied function to be minimized.
This routine is written in the IDL language. Its source code can be found in the file
subdirectory of the IDL distribution. AMOEBA is based on the routine
described in section 10.4 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission.
The fractional tolerance to be achieved in the function value--that is, the fractional decrease in the function value in the terminating step. If the function you supply returns a single-precision result, Ftol should never be less than your machine's floating-point precision--the value contained in the EPS field of the structure returned by the MACHAR function. If the function you supply returns a double-precision floating-point value, Ftol should not be less than your machine' double-precision floating-point precision. See MACHAR for details.
The function to be minimized must be written as an IDL function and compiled prior to calling AMOEBA. This function must accept an n -element vector as its only parameter and return a scalar single- or double precision floating-point value as its result.
Set this keyword equal to a scalar or n -element vector containing the problem's characteristic length scale for each dimension. SCALE is used with P0 to form an initial ( n +1) point simplex. If all dimensions have the same scale, set SCALE equal to a scalar.
Set this keyword equal to an n by n +1 single- or double-precision floating-point array containing the starting simplex. After AMOEBA has returned, the SIMPLEX array contains the simplex enclosing the function minimum. The first point in the array, SIMPLEX[*,0], corresponds to the function's minimum. This keyword is ignored if the P0 and SCALE keywords are set.
Use AMOEBA to find the slope and intercept of a straight line that fits a given set of points, minimizing the maximum error. The function to be minimized (FUNC, in this case) returns the maximum error, given p = intercept, and p = slope. First define the function FUNC: