Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 67 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
67
Dung lượng
297,36 KB
Nội dung
662 Appendix D Sample Computer Programs FU = FB AB = AA FB = FA AA = AL + (AU - AL) * (1.0D0 - 1.0D0 / GR) CALL FUNCT(AA,FA,NCOUNT) GO TO 30 C C FA IS GREATER THAN FB (STEP 5) C 50 AL = AA FL = FA AA = AB FA = FB AB = AL + (AU - AL) / GR CALL FUNCT(AB,FB,NCOUNT) GO TO 30 C C FA IS EQUAL TO FB (STEP 6) C 60 AL = AA FL = FA AU = AB FU = FB AA = AL + (1.0D0 - 1.0D0 / GR) * (AU - AL) CALL FUNCT(AA,FA,NCOUNT) AB = AL + (AU - AL) / GR CALL FUNCT(AB,FB,NCOUNT) GO TO 30 C C MINIMUM IS FOUND C IF ((AU - AL) .LE. EPSLON) GO TO 80 C C IMPLEMENT STEPS 4 ,5 OR 6 OF THE ALGORITHM C IF (FA - FB) 40, 60, 50 C C FA IS LESS THAN FB (STEP 4) 40 AU = AB 80 ALFA = (AU + AL) * 0.5D0 CALL FUNCT(ALFA,F,NCOUNT) RETURN END FIGURE D-2 Continued Appendix D Sample Computer Programs 663 C THE MAIN PROGRAM FOR STEEPEST DESCENT METHOD C C DELTA = INITIAL STEP LENGTH FOR LINE SEARCH C EPSLON= LINE SEARCH ACCURACY C EPSL = STOPPING CRITERION FOR STEEPEST DESCENT METHOD C NCOUNT= NO. OF FUNCTION EVALUATIONS C NDV = NO. OF DESIGN VARIABLES C NOC = NO. OF CYCLES OF THE METHOD C X = DESIGN VARIABLE VECTOR C D = DIRECTION VECTOR C G = GRADIENT VECTOR C WK = WORK ARRAY USED FOR TEMPORARY STORAGE C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(4), D(4), G(4), WK(4) C C DEFINE INITIAL DATA C DELTA = 5.0D-2 EPSLON= 1.0D-4 EPSL = 5.0D-3 NCOUNT= 0 NDV = 3 NOC = 100 C C STARTING VALUES OF THE DESIGN VARIABLES C X(1)=2.0D0 X(2)=4.0D0 X(3)=10.0D0 CALL GRAD(X,G,NDV) WRITE(*,10) 10 FORMAT(' NO. COST FUNCT STEP SIZE', & ' NORM OF GRAD ') DO 20 K = 1, NOC CALL SCALE (G,D,-1.0D0,NDV) CALL GOLDM(X,D,WK,ALFA,DELTA,EPSLON,F,NCOUNT,NDV) CALL SCALE(D,D,ALFA,NDV) CALL PRINT(K,X,ALFA,G,F,NDV) CALL ADD(X,D,X,NDV) CALL GRAD(X,G,NDV) IF(TNORM(G,NDV) .LE. EPSL) GO TO 30 20 CONTINUE FIGURE D-3 Computer program for steepest descent method. 664 Appendix D Sample Computer Programs CALL FUNCT(X,F,NCOUNT,NDV) WRITE(*,50)' THE OPTIMUM COST FUNCTION VALUE IS :', F 50 FORMAT(A, F13.6) WRITE(*,*)'TOTAL NO. OF FUNCTION EVALUATIONS ARE', NCOUNT STOP END SUBROUTINE GRAD(X,G,NDV) C C CALCULATES THE GRADIENT OF F(X) IN VECTOR G C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(NDV),G(NDV) G(1) = 2.0D0 * X(1) + 2.0D0 * X(2) G(2) = 2.0D0 * X(1) + 4.0D0 * X(2) + 2.0D0 * X(3) G(3) = 2.0D0 * X(2) + 4.0D0 * X(3) RETURN END SUBROUTINE SCALE(A,X,S,M) C C MULTIPLIES VECTOR A(M) BY SCALAR S AND STORES IN X(M) C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION A(M),X(M) WRITE(*,*) WRITE(*,*)' LIMIT ON NO. OF CYCLES HAS EXCEEDED' WRITE(*,*)' THE CURRENT DESIGN VARIABLES ARE:' WRITE(*,*) X CALL EXIT 30 WRITE(*,*) WRITE(*,*) 'THE OPTIMAL DESIGN VARIABLES ARE:' WRITE(*,40) X 40 FORMAT (3F15.6) FIGURE D-3 Continued Appendix D Sample Computer Programs 665 RETURN END SUBROUTINE ADD(A,X,C,M) C C ADDS VECT0RS A(M) AND X(M) AND STORES IN C(M) C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION A(M), X(M), C(M) DO 10 I = 1, M C(I) = A(I) + X(I) 10 CONTINUE RETURN END DO 10 I = 1, M X(I) = S * A(I) 10 CONTINUE RETURN END REAL*8 FUNCTION TNORM(X,N) C C CALCULATES NORM OF VECTOR X(N) C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(N) SUM = 0.0D0 DO 10 I = 1, N SUM = SUM + X(I) * X(I) 10 CONTINUE TNORM = DSQRT(SUM) FIGURE D-3 Continued 666 Appendix D Sample Computer Programs SUBROUTINE UPDATE (XN,X,D,AL,NDV) C C UPDATES THE DESIGN VARIABLE VECTOR C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION XN(NDV), X(NDV), D(NDV) DO 10 I = 1, NDV XN(I) = X(I) + AL * D(I) 10 CONTINUE RETURN END SUBROUTINE PRINT(I,X,ALFA,G,F,M) C C PRINTS THE OUTPUT C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(M),G(M) WRITE(*,10) I, F, ALFA, TNORM(G,M) 10 FORMAT(I4, 3F15.6) RETURN END SUBROUTINE FUNCT(X,F,NCOUNT,NDV) C C CALCULATES THE FUNCTION VALUE C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(NDV) NCOUNT = NCOUNT + 1 F = X(1) ** 2 + 2.D0 * (X(2) **2) + 2.D0 * (X(3) ** 2) & + 2.0D0 * X(1) * X(2) + 2.D0 * X(2) * X(3) RETURN END FIGURE D-3 Continued Appendix D Sample Computer Programs 667 CALL UPDATE(XN,X,D,AU,NDV) CALL FUNCT(XN,FU,NCOUNT,NDV) IF (FA .GT. FU) THEN AL = AA SUBROUTINE GOLDM(X,D,XN,ALFA,DELTA,EPSLON,F,NCOUNT,NDV) C C IMPLEMENTS GOLDEN SECTION SEARCH FOR MULTIVARIATE PROBLEMS C X = CURRENT DESIGN POINT C D = DIRECTION VECTOR C XN = CURRENT DESIGN + TRIAL STEP * SEARCH DIRECTION C ALFA = OPTIMUM VALUE OF ALPHA ON RETURN C DELTA = INITIAL STEP LENGTH C EPSLON= CONVERGENCE PARAMETER C F = OPTIMUM VALUE OF THE FUNCTION C NCOUNT= NUMBER OF FUNCTION EVALUATIONS ON RETURN C IMPLICIT DOUBLE PRECISION (A-H, O-Z) DIMENSION X(NDV), D(NDV), XN(NDV) GR = 0.5D0 * DSQRT(5.0D0) + 0.5D0 DELTA1 = DELTA C C ESTABLISH INITIAL DELTA C AL = 0.0D0 CALL UPDATE(XN,X,D,AL,NDV) CALL FUNCT(XN,FL,NCOUNT,NDV) F = FL 10 CONTINUE AA = DELTA1 CALL UPDATE(XN,X,D,AA,NDV) CALL FUNCT(XN,FA,NCOUNT,NDV) IF (FA .GT. FL) THEN DELTA1 = DELTA1 * 0.1D0 GO TO 10 END IF C C ESTABLISH INITIAL INTERVAL OF UNCERTAINTY C J = 0 20 CONTINUE J = J + 1 AU = AA + DELTA1 * (GR ** J) FIGURE D-3 Continued 668 Appendix D Sample Computer Programs AA = AU FL = FA FA = FU GO TO 20 END IF C C REFINE THE INTERVAL OF UNCERTAINTY FURTHER C AB = AL + (AU - AL) / GR CALL UPDATE(XN,X,D,AB,NDV) CALL FUNCT(XN,FB,NCOUNT,NDV) 30 CONTINUE IF((AU-AL) .LE. EPSLON) GO TO 80 C C IMPLEMENT STEPS 4 ,5 OR 6 OF THE ALGORITHM C IF (FA-FB) 40, 60, 50 C C FA IS LESS THAN FB (STEP 4) C 40 AU = AB FU = FB AB = AA FB = FA AA = AL + (1.0D0 - 1.0D0 / GR) * (AU - AL) CALL UPDATE(XN,X,D,AA,NDV) CALL FUNCT(XN,FA,NCOUNT,NDV) GO TO 30 C C FA IS GREATER THAN FB (STEP 5) C 50 AL = AA FL = FA AA = AB FA = FB AB = AL + (AU - AL) / GR CALL UPDATE(XN,X,D,AB,NDV) CALL FUNCT(XN,FB,NCOUNT,NDV) GO TO 30 C C FA IS EQUAL TO FB (STEP 6) C FIGURE D-3 Continued Appendix D Sample Computer Programs 669 C C MINIMUM IS FOUND C 80 ALFA = (AU + AL) * 0.5D0 RETURN END FU = FB AA = AL + (1.0D0 - 1.0D0 / GR) * (AU - AL) CALL UPDATE(XN,X,D,AA,NDV) CALL FUNCT(XN,FA,NCOUNT,NDV) AB = AL + (AU - AL) / GR CALL UPDATE(XN,X,D,AB,NDV) CALL FUNCT(XN,FB,NCOUNT,NDV) GO TO 30 60 AL = AA FL = FA AU = AB FIGURE D-3 Continued D.4 Modified Newton’s Method The modified Newton’s method evaluates the gradient as well as the Hessian for the function and thus has a quadratic rate of convergence. Note that even though the method has a superior rate of convergence, it may fail to converge because of the singularity or indefiniteness of the Hessian matrix of the cost function. A program for the method is given in Fig. D-4. The cost function, gradient vector, and Hessian matrix are calculated in the subroutines FUNCT, GRAD, and HASN, respectively. As an example, f(x) = x 1 2 + 2x 2 2 + 2x 3 2 + 2x 1 x 2 + 2x 2 x 3 is chosen as the cost function. The Newton direction is obtained by solving a system of linear equations in the subroutine SYSEQ. It is likely that the Newton direction may not be a descent direction in which the line search will fail to evaluate an appro- priate step size. In such a case, the iterative loop is stopped and an appropriate message is printed. The main program for the modified Newton’s method and the related subroutines are given in Fig. D-4. 670 Appendix D Sample Computer Programs C THE MAIN PROGRAM FOR MODIFIED NEWTON'S METHOD C C DELTA = INITIAL STEP LENGTH FOR LINE SEARCH C EPSLON= LINE SEARCH ACCURACY C EPSL = STOPPING CRITERION FOR MODIFIED NEWTON'S METHOD C NCOUNT= NO. OF FUNCTION EVALUATIONS C NDV = NO. OF DESIGN VARIABLES C NOC = NO. OF CYCLES OF THE METHOD C X = DESIGN VARIABLE VECTOR C D = DIRECTION VECTOR C G = GRADIENT VECTOR C H = HESSIAN MATRIX C WK = WORK ARRAY USED FOR TEMPORARY STORAGE C IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION X(3), D(3), G(3), H(3,3), WK(3) C C DEFINE INITIAL DATA C DELTA = 5.0D-2 EPSLON = 1.0D-4 EPSL = 5.0D-3 NCOUNT = 0 NDV = 3 NOC = 100 C C STARTING VALUES OF THE DESIGN VARIABLES C X(1) = 2.0D0 X(2) = 4.0D0 X(3) = 10.0D0 CALL GRAD(X,G,NDV) WRITE(*,10) 10 FORMAT(' NO. COST FUNCT STEP SIZE', & ' NORM OF GRAD ') DO 20 K = 1, NOC CALL HASN(X,H,NDV) CALL SCALE (G,D,-1.0D0,NDV) CALL SYSEQ(H,NDV,D) IF (DOT(G,D,NDV) .GE. 1.0E-8) GO TO 60 CALL GOLDM(X,D,WK,ALFA,DELTA,EPSLON,F,NCOUNT,NDV) CALL SCALE(D,D,ALFA,NDV) CALL PRINT(K,X,ALFA,G,F,NDV) FIGURE D-4 A program for Newton’s method. Appendix D Sample Computer Programs 671 30 WRITE(*,*) WRITE(*,*) 'THE OPTIMAL DESIGN VARIABLES ARE :' WRITE(*,40) X 40 FORMAT(4X,3F15.6) CALL FUNCT(X,F,NCOUNT,NDV) WRITE(*,50) ' OPTIMUM COST FUNCTION VALUE IS :', F 50 FORMAT(A, F13.6) WRITE(*,*) 'NO. OF FUNCTION EVALUATIONS ARE : ', NCOUNT CALL EXIT 60 WRITE(*,*) WRITE(*,*)' DESCENT DIRECTION CANNOT BE FOUND' WRITE(*,*)' THE CURRENT DESIGN VARIABLES ARE:' WRITE(*,40) X STOP END DOUBLE PRECISION FUNCTION DOT(X,Y,N) C C CALCULATES DOT PRODUCT OF VECTORS X AND Y C IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION X(N),Y(N) SUM = 0.0D0 DO 10 I = 1, N SUM = SUM + X(I) * Y(I) 10 CONTINUE DOT = SUM RETURN END CALL GRAD(X,G,NDV) IF(TNORM(G,NDV) .LE. EPSL) GO TO 30 20 CONTINUE WRITE(*,*) WRITE(*,*)' LIMIT ON NO. OF CYCLES HAS EXCEEDED' WRITE(*,*)' THE CURRENT DESIGN VARIABLES ARE:' WRITE(*,*) X CALL EXIT CALL ADD(X,D,X,NDV) FIGURE D-4 Continued [...]... 5, f* = - 50 10. 39 x* = (2, 1), u* = 0, u* = 2, f* = -1 10. 40 x* = (0.241507, 1 2 1 2 0.184076, 0.574317); u* = (0, 0, 0, 0), v* = -0.7599, f* = 0.3799 1 692 Answers to Selected Problems Chapter 12 Introduction to Optimum Design with MATLAB 12.1 For l = 0.5 m, To = 10 kN◊m, Tmax = 20 kN◊m, x* = 103 mm, x* = 0.955, f* = 2.9 kg 12.2 1 2 For l = 0.5, To = 10 kN◊m, Tmax = 20 kN◊m, do = 103 mm, d* = 98.36... u* = (4.568 ¥ 10- 3, 0, 3.332 ¥ 10- 8, 0, 0, 0, 0) 5.46 do = 103 mm, d* * i = 98.36 mm, f* = 2.9 kg, u* = (4.657 ¥ 10- 3, 0, 3.281 ¥ 10- 8, 0, 0, 0, 0) 5.47 R* = 50.3 mm, t* = 2.34 mm, f* = 2.9 kg, u* = (4.643 ¥ 10- 3, 0, 3.240 ¥ 10- 8, 0, 0, 0, 0) 5.48 H* = 50 cm, D* = 3.42 cm, f* = 6.6 kg, u* = (0, 9.68 ¥ 10- 5, 0, 4.68 ¥ 10- 2, 0, 0) 5.50 Not a convex programming problem; D* = 10 m, H* = 10 m, f* = 60,000... , 2 ), u* = 1, f* = 0.5 10. 30 x* = (1, 1), u* = 0, f* = 0 10. 31 x* = ( 4, 3 ), 5 5 2 u* = 5, f* = 1 10. 32 x* = (2, 1), u* = 0, f* = -3 10. 33 x* = (1, 2), u* = 0, f* = -1 5 10. 34 x* = ( 13, 11), v* = - 1, f* = - 25 10. 35 x* = (3, 1), v* = -2, v* = -2, f* = 2 10. 36 1 2 3 6 6 6 9 5 3 63 26 x* = ( 48, 40), u* = 0, f* = - 192 10. 37 x* = ( 2 , 2), u* = 1, f* = - 2 10. 38 x* = ( 10 , 15 ), 23 23 23 3547... y4 = -3.239 6.98 y1 = 0, y2 = 0, y3 = 7 0, y4 = 6 6.99 y1 = -1.556, y2 = 0.556 6 .100 y1 = 0, y2 = 5, y3 = - 3 6 .101 y1 = -0.5, 3 5 1 y2 = -2.5 6 .102 y1 = - 3, y2 = 0, y3 = 3 6 .103 y1 = 0.2, y2 = 0.4 6 .104 y1 = 0.25, y2 = 1.25, y3 = 0, y4 = 0 6 .105 y1 = 2, y2 = 0 6 .106 Infeasible problem 6 .107 y1 = 3, y2 = 0 6. 110 For b1 = 10: -8 £ D1 £ 8; for b2 = 6: -2.667 £ D2 £ 8; for b3 = 2: -4 £ D3 £ •; for b4 =... physical meaning of Lagrange multipliers, 143–148 postoptimality analysis, 143–148 second-ordered conditions for constrained optimization, 179–184 sufficiency check for rectangular beam design problem, 184–185 unconstrained optimum design problems, 103 –119 Concepts, optimum design (exercises), 166–174 constrained optimum design problems, 168–172 engineering design examples, 174 global optimality, 173–174... 300.6 cm2 4.80 R* = 7.871686 ¥ 10- 2, t* = 1.574337 ¥ 10- 3, u* = (0, 3.056 ¥ 10- 4, 0.3038, 0, 0), f* = 30.56 kg 4.81 Ro = 7.950204 * ¥ 10- 2, R* = 7.792774 ¥ 10- 2, u* = (0, 3.056 ¥ 10- 4, 0.3055, 0, 0), f* = 30.56 kg 4.82 x* i 1 = 60.50634, x* = 1.008439, u* = 19,918, u* = 23,186, u* = u* = 0, f = 23,186.4 4.83 h* = 2 1 2 3 4 14 m, A* = 5000 m2, u* = 5.9 ¥ 10- 4, u* = 6.8 ¥ 10- 4, u* = u* = u* = 0, f* = $13.4... search, 657–660 golden section search, 660 modified Newton’s method, 669–673 steepest descent method, 660–669 Computers, role in interactive design optimization, 434–435 Concepts and methods, multiobjective optimum design, 543–563 Concepts, calculus, 89 103 concept of necessary and sufficient conditions, 102 103 example—calculation of gradient vector, 91 example—evaluation of gradient and Hessian of... expansion of a function of two variables, 95 gradient vector, 90–91 Hessian matrix, 92–93 quadratic forms and definite matrices, 96 102 Taylor’s expansion, 93–96 Concepts, optimum design, 83–174, 175–190 alternate form of KKT necessary conditions, 175–178 basic calculus concepts, 89 103 constrained optimum design problems, 119–143 engineering design examples, 158–166 exercises, 185–190 global optimality,... i nite optimum points, f* = 0.812 kg 3.27 A* = 5000, h* = 14, f* = $13.4 million 3.28 R* ഡ 1.0 m, t* = 0.0167 m, f* ഡ 8070 kg 3.29 A* = 6.1 cm2, A* = 2.0 cm2, f* = 5.39 kg 1 2 3.31 t* = 8.45, f* = 1.91 ¥ 105 3.32 R* = 7.8 m, H* = 15.6 m, f* = $1.75 ¥ 106 3.33 Infinite optimum points; one point: R* = 0.4 m, t* = 1.59 ¥ 10- 3 m, f* = 15.7 kg 3.34 For l = 0.5 m, To = 10 kN◊m, Tmax = 20 kN◊m, x* = 103 mm,... (4.643 ¥ 10- 3, 0, 3.240 ¥ 10- 8, 0, 0, 0, 0) 5.69 R* = 33.7 mm, t* = 5.0 mm, f* = 41.6 kg, u* = (0, 2.779 ¥ 10- 4, 0, 0, 0, 5.54, 0) 5.70 R* = 21.3 mm, t* = 5.0 mm, f* = 26.0 kg, u* = (0, 1.739 ¥ 10- 4, 0, 0, 0, 3.491, 0) 5.71 R* = 27.0 mm, t* = 5.0 mm, f* = 33.0 kg, u* = (0, 2.165 ¥ 10- 4, 0, 0, 0, 4.439, 0) 5.72 A* = 413.68 mm2, A* = 163.7 mm2, f* = 5.7 kg, u* = (0, 1.624 ¥ 10- 2, 0, 1 2 6.425 ¥ 10- 3, 0) . OF DESIGN VARIABLES C NOC = NO. OF CYCLES OF THE METHOD C X = DESIGN VARIABLE VECTOR C D = DIRECTION VECTOR C G = GRADIENT VECTOR C H = HESSIAN MATRIX C WK = WORK ARRAY USED FOR TEMPORARY STORAGE C. (2000b). Ability of objective functions to generate points on nonconvex pareto frontiers. AIAA Journal, 38(6), 108 4 109 1. Mitchell, M. (1996). An introduction to genetic algorithms. Cambridge, MA:. 5.0D-3 NCOUNT= 0 NDV = 3 NOC = 100 C C STARTING VALUES OF THE DESIGN VARIABLES C X(1)=2.0D0 X(2)=4.0D0 X(3) =10. 0D0 CALL GRAD(X,G,NDV) WRITE(* ,10) 10 FORMAT(' NO. COST FUNCT STEP