- Timestamp:
- 09/05/08 11:49:42 (16 years ago)
- Branches:
- master
- Children:
- fafe4d6
- Parents:
- 2ebb8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minqsn.f
r2ebb8b6 rbd2278d 1 c**************************************************************2 c 3 cThis file contains the subroutines: minqsn,mc11a,mc11e4 c 5 cCopyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,6 cShura Hayryan, Chin-Ku7 cCopyright 2007 Frank Eisenmenger, U.H.E. Hansmann,8 cJan H. Meinke, Sandipan Mohanty9 c 10 c**************************************************************1 ! ************************************************************** 2 ! 3 ! This file contains the subroutines: minqsn,mc11a,mc11e 4 ! 5 ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann, 6 ! Shura Hayryan, Chin-Ku 7 ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann, 8 ! Jan H. Meinke, Sandipan Mohanty 9 ! 10 ! ************************************************************** 11 11 12 12 subroutine minqsn(n,mxn,x,f,g,scal,acur,h,d,w,xa,ga,xb,gb,maxfun, 13 #nfun)14 15 c.............................................................16 cPURPOSE: Quasi-Newton minimizer17 c 18 cUnconstrained local minimization of function FUNC19 cvs. N variables by quasi-Newton method using BFGS-20 cformula to update hessian matrix; approximate line21 csearches performed using cubic extra-/interpolation22 c[see Gill P.E., Murray W., Wright M.H., Practical23 cOptimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2.,24 c4.5.2.1]25 c 26 cINPUT: X,F,G - variables, value of FUNC, gradient at START27 cSCAL - factors to reduce(increase) initial step &28 cits lower bound for line searches, diagonal29 celements of initial hessian matrix30 cMXN - maximal overall number of function calls31 c 32 cOUTPUT: X,F,G - variables, value of FUNC, gradient at MINIMUM33 cNFUN - overall number of function calls used34 c35 cARRAYS: H - approximate hessian matrix in symmetric storage36 c(dimension N(N+1)/2)37 cW,D,XA,XB,GA,GB - dimension N38 c 39 cCALLS: MOVE - external to calculate function for current X40 cand its gradients41 cMC11E- solve system H*D=-G for search direction D, where42 cH is given in Cholesky-factorization43 cMC11A- update H using BFGS formula, factorizise new H44 caccording to Cholesky (modified to maintain its45 cpositive definiteness)46 c 47 cPARAMETERS:48 c49 cEPS1 - checks reduction of FUNC during line search50 c( 0.0001 <= EPS1 < 0.5 )51 cEPS2 - controls accuracy of line search (reduce to increase52 caccuracy; EPS1 < EPS2 <= 0.9 )53 cACUR - fractional precision for determination of variables54 c(should not be smaller than sqrt of machine accuracy)55 cTINY - prevent division by zero during cubic extrapolation56 c.............................................................13 & nfun) 14 15 ! ............................................................. 16 ! PURPOSE: Quasi-Newton minimizer 17 ! 18 ! Unconstrained local minimization of function FUNC 19 ! vs. N variables by quasi-Newton method using BFGS- 20 ! formula to update hessian matrix; approximate line 21 ! searches performed using cubic extra-/interpolation 22 ! [see Gill P.E., Murray W., Wright M.H., Practical 23 ! Optimization, Ch. 2.2.5.7, 4.3.2.1 ff.,4.4.2.2., 24 ! 4.5.2.1] 25 ! 26 ! INPUT: X,F,G - variables, value of FUNC, gradient at START 27 ! SCAL - factors to reduce(increase) initial step & 28 ! its lower bound for line searches, diagonal 29 ! elements of initial hessian matrix 30 ! MXN - maximal overall number of function calls 31 ! 32 ! OUTPUT: X,F,G - variables, value of FUNC, gradient at MINIMUM 33 ! NFUN - overall number of function calls used 34 ! 35 ! ARRAYS: H - approximate hessian matrix in symmetric storage 36 ! (dimension N(N+1)/2) 37 ! W,D,XA,XB,GA,GB - dimension N 38 ! 39 ! CALLS: MOVE - external to calculate function for current X 40 ! and its gradients 41 ! MC11E- solve system H*D=-G for search direction D, where 42 ! H is given in Cholesky-factorization 43 ! MC11A- update H using BFGS formula, factorizise new H 44 ! according to Cholesky (modified to maintain its 45 ! positive definiteness) 46 ! 47 ! PARAMETERS: 48 ! 49 ! EPS1 - checks reduction of FUNC during line search 50 ! ( 0.0001 <= EPS1 < 0.5 ) 51 ! EPS2 - controls accuracy of line search (reduce to increase 52 ! accuracy; EPS1 < EPS2 <= 0.9 ) 53 ! ACUR - fractional precision for determination of variables 54 ! (should not be smaller than sqrt of machine accuracy) 55 ! TINY - prevent division by zero during cubic extrapolation 56 ! ............................................................. 57 57 58 58 implicit real*8 (a-h,o-z) … … 60 60 61 61 parameter ( eps1=0.1d0, 62 #eps2=0.7d0,63 #tiny=1.d-32,64 65 #zero=0.d0,66 #izero=0,67 #ione=1 )62 & eps2=0.7d0, 63 & tiny=1.d-32, 64 65 & zero=0.d0, 66 & izero=0, 67 & ione=1 ) 68 68 69 69 dimension x(mxn),g(mxn),scal(mxn),h(mxn*(mxn+1)/2),d(mxn),w(mxn), 70 #xa(mxn),ga(mxn),xb(mxn),gb(mxn)70 & xa(mxn),ga(mxn),xb(mxn),gb(mxn) 71 71 72 72 nfun=0 73 73 itr=0 74 74 dff=0. 75 c_______________ hessian to a diagonal matrix depending on scale75 ! _______________ hessian to a diagonal matrix depending on scale 76 76 c=0. 77 77 do i=1,n … … 102 102 2 itr=itr+1 ! Start New Line-search from A 103 103 104 c______________ search direction of the iteration104 ! ______________ search direction of the iteration 105 105 do i=1,n 106 106 d(i)=-ga(i) … … 126 126 steplb=acur*c ! lower bound on step 127 127 128 c________________________ initial step of the line search128 ! ________________________ initial step of the line search 129 129 if (dff.gt.0.) then 130 130 step=min(1.d0,(dff+dff)/(-dga)) … … 134 134 135 135 3 if (nfun.ge.maxfun) then 136 cc write (*,*) ' minfor> exceeded max. number of function calls'136 !c write (*,*) ' minfor> exceeded max. number of function calls' 137 137 return 138 138 endif … … 159 159 if (gl2.ge.gl1) goto 4 160 160 endif 161 c______________ store function value if it is smallest so far161 ! ______________ store function value if it is smallest so far 162 162 f=fb 163 163 do i=1,n … … 182 182 stepub=stepub-step ! new upper bound on step 183 183 184 c_______________________________ next step by extrapolation184 ! _______________________________ next step by extrapolation 185 185 if (stepub.gt.0.) then 186 186 step=.5*stepub … … 244 244 return 245 245 end 246 c***********************************************246 ! *********************************************** 247 247 subroutine mc11a(a,n,mxn,z,sig,w,ir,mk,eps) 248 c 249 cCALLS: none250 c 248 ! 249 ! CALLS: none 250 ! 251 251 implicit real*8 (a-h,o-z) 252 252 implicit integer*4 (i-n) … … 368 368 return 369 369 end 370 c************************************370 ! ************************************ 371 371 subroutine mc11e(a,n,mxn,z,w,ir) 372 c 373 cCALLS: none374 c 372 ! 373 ! CALLS: none 374 ! 375 375 implicit real*8 (a-h,o-z) 376 376 implicit integer*4 (i-n)
Note:
See TracChangeset
for help on using the changeset viewer.