C SUBROUTINE OPTIM(FUNC,XVLO,XVEC,XVHI,NVEC,IOPT) C C Subroutine OPTIM: Master optimization test routine. Uses a number C of methods to look for minima of function FUNC C as the NVEC parameters in XVEC are varied between C their limits of XVLO and XVHI. C C Update history: C V1.0 Original version 8-Oct-1992 C IMPLICIT NONE C C Arguments: C FUNC = R*4 function = function to optimize C XVLO = R*4(1) = array of lower limits to XVEC C XVEC = R*4(1) = array of quantities to find at minimum C XVHI = R*4(1) = array of upper limits to XVEC C NVLN = I*4 = physical length of vectors C NVEC = I*4 = number of parameters C IOPT = I*4 = minimization type C REAL*4 FUNC EXTERNAL FUNC REAL*4 XVLO(1),XVEC(1),XVHI(1) INTEGER*4 IOPT,NVEC C C Subprogrammes C GRIDS = subroutine = perform grid search C MONTE = subroutine = perform Monte-Carlo search C POWLL = subroutine = perform Powell minimization C SMPLX = subroutine = perform simplex minimization C SIMAN = subroutine = perform simulated annealing C SIMMU = subroutine = perform simulated annealing, multiple-moves C SIMPO = subroutine = perform SA + Powell C SIMPU = subroutine = perform SA(multiple) + Powell C EXTERNAL GRIDS,MONTE,POWLL C C Branch according to option C IF (IOPT .EQ. 1) THEN CALL GRIDS(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 2) THEN CALL MONTE(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 3) THEN CALL POWLL(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 4) THEN CALL SMPLX(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 5) THEN CALL SIMAN(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 6) THEN CALL SIMMU(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 7) THEN CALL SIMPO(FUNC,XVLO,XVEC,XVHI,NVEC) ELSEIF (IOPT .EQ. 8) THEN CALL SIMPU(FUNC,XVLO,XVEC,XVHI,NVEC) ELSE WRITE (6,699) ENDIF C C End C RETURN C 699 FORMAT (' '/ + ' *** Error: illegal option in OPTIM ***'/) C END