MIN1DIMENSION procedure
Finds the minimum of a function in one dimension (R.W. Payne).
Options
Parameters
Description
MIN1DIMENSION searches for the minimum of a function in one dimension. The parameters to be estimated by the minimization are listed by the PARAMETER parameter of MIN1DIMENSION. Step lengths and initial values must be supplied using the STEPLENGTH and INITIAL parameters. When there are several parameters, these also define the dimension in the parameter space over which the function is minimized. Within each step of the minimization, the same multiple is used for the steplength of every parameter. So the dimension is defined as the set of parameter values that can be calculated as
PARAMETER[1...p] = INITIAL[1...p] + Move * STEPLENGTH[1...p]
where Move is a scalar, and p is the number of parameters. You can also specify lower bounds with the LOWER parameter, and upper bounds with the UPPER parameter.
The function can be defined by specifying a list of GenStat calculation structures with the CALCULATION option, similarly to the way in which functions for optimization are specified for the FITNONLINEAR directive (see the Guide to GenStat, Part 2 Statistics, Section 3.8). For example, you could find the minimum of the function 5*X-25*LOG(X) as follows.
EXPRESSION Calc; VALUE=!e(Fx = 5 * X - 25 * LOG(X))
MIN1DIMENSION [PRINT=minimum,monitor,plot; EXIT=exit;\
CALCULATION=Calc; FUNCTION=Fx]\
X; STEPLENGTH=1; INITIAL=1; LOWER=0.001
Alternatively, more complicated functions can be specified by defining a procedure _MIN1DFUNCTION, which operates similarly to the RESAMPLE procedure that is called by procedures BOOTSTRAP and JACKKNIFE. This is more complicated to specify, but it has the advantage that you can use any GenStat command to obtain the function value (e.g. ANOVA, FIT, SVD and so on). The DATA option is then used to list any data structures that are needed by _MIN1DFUNCTION to calculate the value of the function. Details are given in the Methods Section.
The PRINT option controls printed output with the settings:
By default, PRINT=minimum.
The scalars specified by the PARAMETER parameter save the estimated values of the parameters, and the FUNCTION scalar saves the minimum value. You can also save a scalar, using the EXIT option, which is set to 0 if the minimization was successful or to 1 if it did not converge.
The MAXCYCLE option sets a limit on the number of iterations; by default this is 250. The TOLERANCE option specifies the tolerance for convergence (default 10-6), and the CRITERION option specifies what is tested. When CRITERION=function, convergence is achieved when the current function evaluations differ by less than the (scalar) value supplied by TOLERANCE. Alternatively, when CRITERION=parameters, the parameter values at the current evaluations must differ by less than TOLERANCE, which can then be set to either a scalar (to use the same tolerance with every parameter) or a variate (for different tolerances).
Options: PRINT, CALCULATION, FUNCTION, DATA, CRITERION, MAXCYCLE, EXIT, TOLERANCE.
Parameters: PARAMETER, LOWER, UPPER, STEPLENGTH, INITIAL.
Method
MIN1DIMENSION performs a series of iterations in which three points are moved in the one dimension to locate the minimum. The idea is that the two outer points should bracket the minimum, while the inner point locates it.
The procedure _MIN1DFUNCTION, which you can use to calculate the function instead of the CALCULATION and FUNCTION options, has two options. DATA supplies a pointer containing the data structures specified by the DATA option of MIN1DIMENSION (so, DATA[1] is the first of these structures, DATA[2] is the second, and so on). FUNCTION is a scalar, which should be set to the function value. There is one parameter, called PARAMETER. The PROCEDURE statement that defines _MIN1DFUNCTION should set option PARAMETER=pointer. The parameters of the function can then be referred to as PARAMETER[1], PARAMETER[2], and so on (and these will be in the same order as in the PARAMETER parameter of MIN1DIMENSION). The definition below has the same effect as the expression
EXPRESSION Calc; VALUE=!e(Fx = 5 * X - 25 * LOG(X))
shown in the description.
PROCEDURE [PARAMETER=pointer] '_MIN1DFUNCTION'
" calculates the function for MIN1DIMENSION "
OPTION NAME=\
'DATA', "(I: pointer) data to calculate the function"\
'FUNCTION'; "(O: scalar) returns the function value"\
MODE=p; TYPE='pointer','scalar'
PARAMETER NAME=\
'PARAMETER'; "(I: scalar) parameter values"\
MODE=p; TYPE='scalar'; SET=yes; DECLARED=yes; PRESENT=yes
CALCULATE FUNCTION = 5*PARAMETER[1] - 25*LOG(PARAMETER[1])
ENDPROCEDURE
The parameter X can then be estimated by the statement
MIN1DIMENSION [PRINT=minimum,monitor,plot; EXIT=exit]\
X; STEPLENGTH=1; INITIAL=1; LOWER=0.001
Action with
RESTRICT
The effects of restrictions on the data variables will depend on how the calculation is defined (by the CALCULATION option or within the _MIN1DFUNCTION procedure).