************************************************************************ * PROGRAM TBUNU * * TEST PROGRAM FOR THE SUBROUTINE PBUNU * INTEGER NADD,NDECF,NEXT,NFG,NFH,NFV,NIT,NRED,NREM,NRES DOUBLE PRECISION F,FMIN,GMAX INTEGER I,IERR,IPRNT,ITERM,ITIME,NA,NF DOUBLE PRECISION RPAR(6),X(50) INTEGER IPAR(5) INTEGER NITER,NFVAL,NSUCC COMMON /PROB/NEXT COMMON /STAT/NDECF,NRES,NRED,NREM,NADD,NIT,NFV,NFG,NFH NITER=0 NFVAL=0 NSUCC=0 CALL TYTIM1(ITIME) * * LOOP FOR 20 TEST PROBLEMS * DO 30 NEXT = 1,20 * * CHOICE OF INTEGER AND REAL PARAMETERS * DO 10 I = 1,5 IPAR(I) = 0 10 CONTINUE DO 20 I = 1,6 RPAR(I) = 0.0D0 20 CONTINUE IF (NEXT.EQ. 6) IPAR(3) = 2 IF (NEXT.EQ. 8) IPAR(3) = 2 IF (NEXT.EQ.18) IPAR(3) = 2 IF (NEXT.EQ.20) IPAR(5) = 7 IPRNT=1 * * PROBLEM DIMENSION * NF = 50 NA = 0 * * INITIATION OF X AND CHOICE OF RPAR(1) * CALL TIUD19(NF,X,FMIN,RPAR(1),NEXT,IERR) IF (IERR.NE. 0) GO TO 30 IF (NEXT.EQ.14) RPAR(1) = 0.1D0 * * SOLUTION * CALL PBUNU(NF,NA,X,IPAR,RPAR,F,GMAX,IPRNT,ITERM) NITER=NITER+NIT NFVAL=NFVAL+NFV IF (ITERM.GT.0.AND.ITERM.LT.9) NSUCC=NSUCC+1 30 CONTINUE WRITE(6,50) NITER,NFVAL,NSUCC 50 FORMAT(' NITER =',I5,3X,' NFVAL =',I5,3X,' NSUCC =',I5) CALL TYTIM2(ITIME) STOP END * * USER SUPPLIED SUBROUTINE (CALCULATION OF F AND G) * SUBROUTINE FUNDER(NF,X,F,G) * * FUNCTION EVALUATION * DOUBLE PRECISION F INTEGER NF DOUBLE PRECISION G(*),X(*) INTEGER NEXT EXTERNAL TFFU19,TFGU19 COMMON /PROB/NEXT CALL TFFU19(NF,X,F,NEXT) * * GRADIENT EVALUATION * CALL TFGU19(NF,X,G,NEXT) RETURN END * * EMPTY SUBROUTINES * SUBROUTINE FUN(NF,KA,X,FA) DOUBLE PRECISION FA INTEGER KA,NF DOUBLE PRECISION X(*) KA=NF FA=X(1) RETURN END SUBROUTINE DER(NF,KA,X,GA) INTEGER KA,NF DOUBLE PRECISION GA(*),X(*) KA=NF GA(1)=X(1) RETURN END SUBROUTINE HES(NF,X,H) INTEGER NF DOUBLE PRECISION H(*),X(*) NF=1 H(1)=X(1) RETURN END ************************************************************************ * PROGRAM TBUNL * * TEST PROGRAM FOR THE SUBROUTINE PBUNL * INTEGER IEXT,KAP,LAP,NAA,NADD,NDECF,NEXT,NFG,NFH,NFV,NIT,NRED, + NREM,NRES DOUBLE PRECISION F,FMIN,GMAX INTEGER I,IERR,IPRNT,ITERM,ITIME,NA,NB,NC,NF DOUBLE PRECISION CF(20),CG(300),CL(20),CU(20),RPAR(6), + X(40),XL(40),XU(40) INTEGER IC(20),IPAR(5),IX(40) INTEGER NITER,NFVAL,NSUCC COMMON /PROB/IEXT,NEXT,NAA,KAP,LAP COMMON /STAT/NDECF,NRES,NRED,NREM,NADD,NIT,NFV,NFG,NFH NITER=0 NFVAL=0 NSUCC=0 CALL TYTIM1(ITIME) * * LOOP FOR 10 TEST PROBLEMS * DO 30 NEXT = 1,15 * * CHOICE OF INTEGER AND REAL PARAMETERS * DO 10 I = 1,5 IPAR(I) = 0 10 CONTINUE DO 20 I = 1,6 RPAR(I) = 0.0D 0 20 CONTINUE IPRNT = 1 * * PROBLEM DIMENSION * NF = 20 NA = 0 NB = 20 NC = 15 NAA = 165 * * INITIATION OF X AND CHOICE OF RPAR(1) * CALL TILD22(NF,NAA,NB,NC,X,IX,XL,XU,IC,CL,CU,CG,FMIN,RPAR(1), + NEXT,IEXT,IERR) IF (IERR.NE. 0) GO TO 30 IF (NEXT.EQ. 6) RPAR(6) = 0.5D 0 IF (NEXT.EQ. 8) RPAR(6) = 1.0D 0 IF (NEXT.EQ. 9) RPAR(6) = 2.5D-1 IF (NEXT.EQ.11) RPAR(1) = 1.0D 1 IF (NEXT.EQ.13) RPAR(6) = 1.0D-2 * * SOLUTION * CALL PBUNL(NF,NA,NB,NC,X,IX,XL,XU,CF,IC,CL,CU,CG,IPAR, + RPAR,F,GMAX,IPRNT,ITERM) NITER=NITER+NIT NFVAL=NFVAL+NFV IF (ITERM.GT.0.AND.ITERM.LT.9) NSUCC=NSUCC+1 30 CONTINUE WRITE(6,50) NITER,NFVAL,NSUCC 50 FORMAT(' NITER =',I5,3X,' NFVAL =',I5,3X,' NSUCC =',I5) CALL TYTIM2(ITIME) STOP END * * USER SUPPLIED SUBROUTINE (CALCULATION OF FA) * SUBROUTINE FUNDER(NF,X,F,G) * * FUNCTION EVALUATION * DOUBLE PRECISION F INTEGER NF DOUBLE PRECISION G(*),X(*) INTEGER IEXT,KAP,LAP,NA,NEXT DOUBLE PRECISION FTEMP,FVAL INTEGER K,KA EXTERNAL MXVNEG,TAFU22,TAGU22 COMMON /PROB/IEXT,NEXT,NA,KAP,LAP DO 10 KA = 1,NA CALL TAFU22(NF,KA,X,F,NEXT) IF (IEXT.EQ.0 .AND. F.GE.0.0D0 .OR. IEXT.LT.0) THEN FTEMP = F K = 1 ELSE FTEMP = -F K = -1 END IF IF (KA.EQ.1) THEN FVAL = FTEMP KAP = KA LAP = K ELSE IF (FVAL.LT.FTEMP) THEN FVAL = FTEMP KAP = KA LAP = K END IF 10 CONTINUE F = FVAL * * GRADIENT EVALUATION * CALL TAGU22(NF,KAP,X,G,NEXT) IF (LAP.GE.0) THEN ELSE CALL MXVNEG(NF,G,G) END IF RETURN END * * EMPTY SUBROUTINES * SUBROUTINE FUN(NF,KA,X,FA) DOUBLE PRECISION FA INTEGER KA,NF DOUBLE PRECISION X(*) KA=NF FA=X(1) RETURN END SUBROUTINE DER(NF,KA,X,GA) INTEGER KA,NF DOUBLE PRECISION GA(*),X(*) KA=NF GA(1)=X(1) RETURN END SUBROUTINE HES(NF,X,H) INTEGER NF DOUBLE PRECISION H(*),X(*) NF=1 H(1)=X(1) RETURN END 