INTERFACE RanMin; IMPORT R3, DOct; (* Minimizes "f" by random probes near the current minimum. The client must given in the array "x" a set of points whose affine span contains the desired minimum point. The array must have "M" rows and "N" columns, with "M" in "[1..N+1]". The parameters "minRadius" and "maxRadius" control the spread of the probes around the current minimum. They are roughly the maximum and minimum baricentric coordinates of the probe displacements, relative to the given frame "x". If "report" is not NIL, it is called whenever a new minimum is found. If "normalize" is not NIL, it is applied to every generated point, before evaluating "f" on it. This feature allows minimization inside bounded domains, or over curved subspaces of "R^N". The procedure stops when "report" returns TRUE, or after "maxCalls" calls to "f", or after 2M consecutive probes at distance "minRadius" from the current minimum have failed to produce a new minimum. Upon return return, "xm" will be the best point found, and ym will be its value. *) TYPE Arc = DOct.Arc; MatrixR3 = REF ARRAY OF ARRAY OF R3.T; VetorR3 = REF ARRAY OF R3.T; Vetor = REF ARRAY OF REAL; GoalFunc = PROCEDURE (VAR a: Arc; READONLY x: VetorR3): REAL; ReportProc = PROCEDURE (VAR x: VetorR3; y: REAL): BOOLEAN; NormalizeProc = PROCEDURE (VAR x: VetorR3); PROCEDURE Rmin(a: Arc); END RanMin.