SECTION 1.1 GENERAL OPTIONS FOR OPTIMIZATION
This package contains a set of Fortran algorithms designed to optimize general non-linear functions supplied by the user, as well as a number of statistical and mathematical routines. In the following, variables will be denoted by capital letters. Numerical values will be denoted by lower case letters. Thus, NP refers to the variable NP; np refers to a particular value of NP. Default values for various parameters are set by calling the the SUBROUTINE DFLT, as in
Not every GQOPT module requires DFLT to be called; however, the safe thing to do is to always CALL DFLT as the first executable statement of the MAIN program. This is ESSENTIAL if any optimization is to be performed.
Preliminaries for Optimization: Depending on the type of function (continuously differentiable, smooth 2nd derivatives, etc.) there are several possible methods available in GQOPT which will find a local (not necessarily global) optimum of this user-supplied function. Appendix A contains suggestions on the choice of methods for various problems. Regardless of the method selected, the user must write two Fortran programs: (1) a calling program and (2) a subroutine to define the function to be optimized. Since all variables in this package are in double precision, the user should put the Fortran statement
IMPLICIT REAL*8 (A-H,O-Z)
in both of these routines. The main program must contain the equivalent of the following statements:
IMPLICIT REAL*8 (A-H,O-Z) EXTERNAL FUNC EXTERNAL METHOD C C NOTE THAT MICROSOFT REQUIRES EXTERNAL STATEMENTS TO COME C IMMEDIATELY AFTER THE IMPLICIT STATEMENT C DIMENSION X0(i1),ALABEL(i1) COMMON/BSTACK/AINT(i2) COMMON/BSTAK/NQ,NTOP C C NOTE THAT ANY READS FROM OR WRITES TO FILES MUST HAVE THE C APPROPRIATE FILES OPENED AND CLOSED (AT THE END). NFILE IS C THE LOGICAL OUTPUT DEVICE AND DEFAULTS TO 8. C OPEN(8,FILE='name',STATUS='NEW') C C TO INITIALIZE ALL DEFAULTS, CALL SUBROUTINE DFLT C CALL DFLT NP=i1 NQ=i2 ITERL=i3 MAX=i4 ACC=a1 CALL OPT(X0,NP,F,METHOD,ITERL,MAX,IER,ACC,FUNC,ALABEL) CLOSE(8)
as well as a means of initializing X0 to some initial estimate of the optimum. ALABEL should contain a label (8 characters) for each of the variables. The array can be initialized in a DATA statement or by calling subroutine LABEL (see Section 1.5). In the above i1 - i4 are integer numbers and a1 is a double precision number, explained below.
i1 = Number of variables with respect to which the function is
to be optimized.
i2 = Greater than or equal to the scratch storage required (see particular method for details).
i3 = Maximum no. of iterations permitted before error is returned.
i4 = 1 if maximization is desired. = 2 if minimization is desired.
a1 = Accuracy desired in results. (e.g. 1.D-5)
METHOD = Name of method selected (e.g. GRADX).
FUNC = Name of function subroutine supplied (e.g. FUNC1).
On exit OPT will return the best function value to date, F, the variables at the best point, X0, and a flag, IER, to indicate why the optimization terminated. A positive value of IER generally signifies convergence to a local optimum while a negative value indicates a breakdown in the algorithm. See the particular method for details. The SUBROUTINE DFLT must be invoked to initialize defaults. It can be invoked several times in the same program if the user has reset several parameter values and wishes to restore all the defaults. The subroutine FUNC has the following arguments:
SUBROUTINE FUNC(X,NP,F,*) DOUBLE PRECISION X(NP),F F=........... RETURN END
FUNC = Name of function supplied.
X = Input, variable values at which the function is to be evaluated.
NP = Input, number of variables.
F = Output, function value at X.
* = Error return (accessed by RETURN 1) in case function is undefined at the requested point. This should not be used to constrain a well defined function to a region.
NOTE: X must never be modified in the FUNC subroutine.
Note that data may be passed to the routine FUNC from the main program by means of unlabelled COMMON or through any COMMON block other than those listed in Appendix B. It is very important that the user not attempt to use in other subroutines (e.g. in user-supplied FP or SP) any quantities computed in FUNC and passed to these subroutines in COMMON. The attempt to do so may result in unpredictable errors.
Warning: Information must not be passed to FUNC in elements of the X-array beyond the NPth element. Thus, if NP=9 but the X- array is dimensioned X(11) in the MAIN program, the user should resist the temptation to pass to FUNC important constants in X(10) and X(11). Failure to observe this rule will lead to unpredictable errors. Several options are available to the user regardless of the method selected. Like the other options to be mentioned, they can be used by including the appropriate COMMON statement (exactly as described) in the calling program and setting the desired parameter to some specified value. See Appendix B for an index of COMMON blocks. Note that any options selected in the main program for one method will remain in effect unless explicitly changed. The general options are as follows:
IPT = 0 No output sent to unit NFILE; not even error messages
= 1 Only calling variables and final result sent to NFILE
= 2 As in 1 plus variables and function sent on each step.
= 3 As in 2 plus important elements of the step are sent. Default value is 2.
JPT = Same codes as IPT, except it controls screen output.
NFILE = Device number of output files. Default value is 8.
MFILE = Has no meaning in this version of GQOPT; reserved for future use.
NDIG = Number of significant figures printed. Default value is 8.
NPUNCH = Device number for "punched" output (from DFP). Default is 9.
NREAD = Input file number. Default is 5. See Section 3.2
NVAR1 = ISTOP(1) applies only to the first NVAR1 variables.
Default value is NP (i.e. all variables). ISTOP (1) = 0 to enable
package to stop when attempted step sizes (of the 1st NVAR1
variables) are each less than ACC (relatively)
ISTOP(1) = 1 to disable stopping criterion 1. Default = 0.
ISTOP(2) = 0 to enable package to stop when the norm of the gradient at any point is less than ACC. Default value =0.
ISTOP(2) = 1 to disable stopping criterion 2.
ISTOP(3) = 0 to enable package to stop when the relative improvement in the function value on any step is less than ACC. Default=0.
ISTOP(3) = 1 to disable stopping criterion 3.
NOTES: 1. If all ISTOP values are 0, the optimization will stop on any of these conditions. 2. If all ISTOP values are 1, then all stopping conditions are suppressed. Therefore OPT will return with an error code and will not permit execution of these routines. 3. If the function value is 0, ISTOP(3) becomes meaningless.
|Sect. 1.3||Sect.1.5|Sect.1.10|Sect.1.11|Sect.10| Sect.10.1|Sect.10.2|Sect.10.3|Sect.10.4|Sect.10.5|Sect.10.6|Sect.11.3|