POWELL is based on the routine powell described in section 10.5 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.
We can use POWELL to minimize the function POWFUNC given above.
FUNCTION powfunc, X
RETURN, (X + 2.0*X) * EXP(-X^2 -X^2)
; Define the fractional tolerance:
ftol = 1.0e-4
; Define the starting point:
P = [.5d, -.25d]
; Define the starting directional vectors in column format:
xi = TRANSPOSE([[1.0, 0.0],[0.0, 1.0]])
; Minimize the function:
POWELL, P, xi, ftol, fmin, 'powfunc'
; Print the solution point:
PRINT, 'Solution point: ', P
; Print the value at the solution point:
PRINT, 'Value at solution point: ', fmin
Solution point: -0.31622777 -0.63245552
Value at solution point: -0.95900918
The exact solution point is [-0.31622777, -0.63245553].
The exact minimum function value is -0.95900918.
On input, P is an n-element vector specifying the starting point. On output, it is replaced with the location of the minimum.
Note: If POWELL is complex then only the real part is used for the computation.
On input, Xi is an initial n by n element array whose columns contain the initial set of directions (usually the n unit vectors). On output, it is replaced with the then-current directions.
An input value specifying the fractional tolerance in the function value. Failure to decrease by more than Ftol in one iteration signals completeness. For single-precision computations, a value of 1.0 ∞ 10-4 is recommended; for double-precision computations, a value of 1.0 ∞ 10-8 is recommended.
On output, Fmin contains the value at the minimum-point P of the user-supplied function specified by Func.
A scalar string specifying the name of a user-supplied IDL function of two or more independent variables to be minimized. This function must accept a vector argument X and return a scalar result.
For example, suppose we wish to minimize the function
To evaluate this expression, we define an IDL function named POWFUNC:
FUNCTION powfunc, X
Set this keyword to force the computation to be done in double-precision arithmetic.
Use this keyword to specify an output variable that will be set to the number of iterations performed.
Use this keyword to specify the maximum allowed number of iterations. The default is 200.
Note: POWELL halts once the value specified with ITMAX has been reached.