INTERFACE JSUniMin; (* An ad-hoc algorithm for minimizing a univariate function without derivatives. Created by J.Stolfi on May-Jul 1994. *) IMPORT UniMin; TYPE T <: Public; Public = UniMin.T OBJECT METHODS setAlpha(alpha: LONGREAL): T; (* Sets the ``venture risk factor''. "alpha = 1" gives strict golden bissection search; "alpha < 1" uses parabolic fitting, at the cost of possibly slower convergence in the worst case. *) END; (* The "minimize" method does not use the derivative provided by "eval", and works only with the function values. It looks for three points "u", "z", "v" in the given interval "[a__b]" such that 1. The points are ordered and not too close: "u + delta <= z <= v - delta" 3. They bracket at lest one local minimum: "F(z) <= MIN(F(u), F(v))" 4. The gaps can't be split any further: "MAX(z-u, v-z) < 2*delta" where "delta = tol + sqrt(machinePrecision)*ABS(z)" When such a triple is found, or when either "eval" or "check" return "TRUE", "minimize" returns in "fx" the smallest of "F(u)" "F(z)", and "F(w)", and in "x" the corresponding argument. *) END JSUniMin.