Page 165 - Compact Numerical Methods For Computers
P. 165
154 Compact numerical methods-for computers
competitively with the program FMIN due to Brent as given in Forsythe et al (1977)
when several tests were timed on an IBM 370/168.
The choice of the step adjustment factors Al and A2 to enlarge the step length
or to reduce it and change its sign can be important in that poor choices will
obviously cause the success-failure process to be inefficient. Systematic optimisa-
tion of these two parameters over the class of one-dimensional functions which
may have to be minimised is not feasible, and one is left with the rather
unsatisfactory situation of having to make a judgement from experience. Dixon
(1972) mentions the choices (2,-0·25) and (3,-0·5). In the present application,
however, where the success-failure steps are followed by inverse interpolation, I
have found the set (1·5,-0·25) to be slightly more efficient, though this may
merely reflect problems I have been required to solve.
Algorithm 17. Minimisation of a function of one variable
procedure min1d(var bb : real; {initial value of argument of function
to be minimised, and resulting minimum position}
var st: real; {initial and final step-length}
var ifn : integer; {function evaluation counter}
var fnminval : real {minimum function value on return});
{alg17.pas ==
One-dimensional minimisation of a function using success-failure
search and parabolic inverse interpolation
Copyright 1988 J.C.Nash
}
{No check is made that abs(st)>0.0. Algorithm will still converge.}
var
a1, a2, fii, s0, s1, s2, tt0, tt1, tt2, x0, x1, x2, xii : real;
notcomp, tripleok: boolean;
begin
writeln(‘alg17.pas -- One dimensional function minimisation’);
{STEP 0 -- partly in procedure call}
ifn := 0; {to initialize function evaluation count}
a1 := 1.5; {to set the growth parameter of the success-failure search}
a2 := -0.25; {to set the shrink parameter of the success-failure search}
x1 := bb; {to start, we must have a current ‘best’ argument}
notcomp := false; {is set TRUE when function cannot be computed. We set it
here otherwise minimum or root of fn1d may be displayed}
s0 := fn1d(x1,notcomp); ifn := ifn+l; {Compute the function at xl.}
if notcomp then
begin
writeln(‘***FAILURE *** Function cannot be computed at initial point’);
halt;
end;
repeat {Main minimisation loop}
x0 := xl; {to save value of argument}
bb := x0;
x1 := x0+st; {to set second value of argument}
s1 := fn1d(x1,notcomp); if notcomp then s1 := big; ifn := ifn+1;
{Note mechanism for handling non-computability of the function.}
tripleok := false; {As yet, we do not have a triple of points in a V.}