Télécharger gcmma_03.dgibi

Retour à la liste

Numérotation des lignes :

  1. * fichier : mma_03.dgibi
  2. ************************************************************************
  3. ************************************************************************
  4.  
  5. ************************************************************************
  6. * Test de l'opérateur MMA : Méthode des Asymptotes Mobiles *
  7. * Globalement Convergente *
  8. * Reproduction d'un cas test de l'article originel de Svanberg *
  9. * *
  10. * Krister Svanberg: The method of moving asymptotes - a new method *
  11. * for structural optimization *
  12. * International Journal for Numerical Methods in Engineering, *
  13. * vol. 24, 359-373 (1987) *
  14. * https://doi.org/10.1002/nme.1620240207 *
  15. * *
  16. * *
  17. * *
  18. * Optimisation d'une poutre en flexion de section variable *
  19. * *
  20. * |‾‾‾‾‾‾‾‾‾‾‾‾|____________ *
  21. * | | |____________ *
  22. * | | | |____________ *
  23. * | | | | |____________ *
  24. * | | | | | | *
  25. * | 1 | 2 | 3 | 4 | 5 | *
  26. * | | | | |‾‾‾‾‾‾‾‾‾‾‾‾| *
  27. * | | | |‾‾‾‾‾‾‾‾‾‾‾‾ | *
  28. * | | |‾‾‾‾‾‾‾‾‾‾‾‾ | *
  29. * | |‾‾‾‾‾‾‾‾‾‾‾‾ \|/ *
  30. * ‾‾‾‾‾‾‾‾‾‾‾‾ v *
  31. * *
  32. * La poutre est divisée en 5 troncons de même longueur et de sections *
  33. * x1 x2 x3 x4 et x5 qui seront les variables de conception. *
  34. * Elle est encastrée à gauche et soumise à une force verticale à *
  35. * droite. *
  36. * *
  37. * Le problème d'optimisation est le suivant : *
  38. * - Trouver x=(x1 x2 x3 x4 x5) pour minimiser la masse de la poutre *
  39. * - tels que la flèche soit inférieure à une limite donnée *
  40. * *
  41. * Au final, le problème à résoudre se ramène à : *
  42. * Minimiser : f0(x) = c1 * (x1 + x2 + x3 + x4 + x5) *
  43. * sur x *
  44. * *
  45. * avec : f1(x) = 61/x1**3 + 37/x2**3 + 19/x3**3 *
  46. * + 7/x4**3 + 1/x5**3 < c2 *
  47. * 1 < xi < 10 *
  48. * *
  49. * Si on choisit c1 = 0.0624 et c2 = 1, alors la solution est : *
  50. * x1 = 6.0160 x2 = 5.3092 x3 = 4.4943 x4 = 3.5015 x5 = 2.1527 *
  51. ************************************************************************
  52.  
  53. * Options d'affichage
  54. OPTI 'ECHO' 0 ;
  55. itrac = FAUX ;
  56.  
  57. * Procédure pour calculer f0, f1 ainsi que les dérivées partielles
  58. * df0/dxi, df1/dxi, df2/dxi pour i=1,2,3,4,5
  59. DEBP FONC a*'LISTREEL' ;
  60. c1 = 0.0624 ;
  61. c2 = 1. ;
  62. f0 = c1 * (SOMM a) ;
  63. df0da = PROG (DIME a)*c1 ;
  64. ld = PROG 61. 37. 19. 7. 1. ;
  65. fval = PROG ((SOMM (ld / (a ** 3))) - c2) ;
  66. dfda = ENUM (-3. * ld / (a ** 4)) ;
  67. FINP f0 df0da fval dfda ;
  68.  
  69. * Solution de référence
  70. x1ref = 6.0160 ;
  71. x2ref = 5.3092 ;
  72. x3ref = 4.4943 ;
  73. x4ref = 3.5015 ;
  74. x5ref = 2.1527 ;
  75. xref = PROG x1ref x2ref x3ref x4ref x5ref ;
  76. f0ref df0dxref fval0 dfdxref = FONC xref ;
  77. MESS 'Solution de reference' ;
  78. MESS ' x1 x2 x3 x4 x5 f0' ;
  79. MESS (CHAI 'FORMAT' '(F12.8)' x1ref /7 x2ref >1 x3ref >1 x4ref >1 x5ref >1 f0ref >1) ;
  80.  
  81. * Choix d'un point initial pour les inconnues
  82. x0 = PROG 5. 5. 5. 5. 5. ;
  83.  
  84. * Calcul de f0(x0), df0dx(x0), fval(x0), dfdx(x0)
  85. f0 df0dx fval dfdx = FONC x0 ;
  86.  
  87. * Initialisation de la table pour la MMA
  88. t = TABL ;
  89. t . 'X' = x0 ;
  90. t . 'XMIN' = 1. ;
  91. t . 'XMAX' = 10. ;
  92. t . 'F0VAL' = f0 ;
  93. t . 'DF0DX' = df0dx ;
  94. t . 'FVAL' = fval ;
  95. t . 'DFDX' = dfdx ;
  96. t . 'MOVE' = 1. ;
  97. t . 'C' = 1000. ;
  98. t . 'GC' = VRAI ;
  99. t . 'RAA0' = 0.01 ;
  100. t . 'RAA' = 0.01 ;
  101.  
  102. * Itérations de la MMA
  103. x01 = EXTR x0 1 ;
  104. x02 = EXTR x0 2 ;
  105. x03 = EXTR x0 3 ;
  106. x04 = EXTR x0 4 ;
  107. x05 = EXTR x0 5 ;
  108. lx1 = PROG x01 ;
  109. lx2 = PROG x02 ;
  110. lx3 = PROG x03 ;
  111. lx4 = PROG x04 ;
  112. lx5 = PROG x05 ;
  113. lit = PROG 0. ;
  114. lf0 = PROG f0 ;
  115. f1 = EXTR fval 1 ;
  116. li = PROG (MAXI 0. f1) ;
  117. MESS 'Optimisation par GC-MMA' ;
  118. MESS 'It sIt x1 x2 x3 x4 x5 f0 kktnorm' ;
  119. MESS (CHAI 'FORMAT' '(F12.8)' 0 0 /6 x01 >1 x02 >1 x03 >1 x04 >1 x05 >1 f0 >1) ;
  120. * Boucle d'optimisation
  121. REPE loop 20 ;
  122. * Appel à MMA
  123. lit = lit ET &loop ;
  124. * Boucle des sous itérations de la GCMMA
  125. REPE sloop 15 ;
  126. MMA t ;
  127. * Si le sous problème est conservatif
  128. * mise à jour des valeurs des fonctions et arret des sous itérations
  129. SI (t . 'CONSERV') ;
  130. xmma = t . 'X' ;
  131. f0 df0dx fval dfdx = FONC xmma ;
  132. t . 'F0VAL' = f0 ;
  133. t . 'DF0DX' = df0dx ;
  134. t . 'FVAL' = fval ;
  135. t . 'DFDX' = dfdx ;
  136. QUIT sloop ;
  137. * Sinon, mise à jour des valeurs des fonctions (pas besoin des gradients)
  138. * dans WTABLE et nouvelle sous itération
  139. SINON ;
  140. xmma = t . 'WTABLE' . 'X' ;
  141. f0 df0dx fval dfdx = FONC xmma ;
  142. t . 'WTABLE' . 'F0VALNEW' = f0 ;
  143. t . 'WTABLE' . 'FVALNEW' = fval ;
  144. FINSI ;
  145. FIN sloop ;
  146. * Calcul du résidu pour les conditions KKT
  147. res kkt2 kktinf = KKT_MMA t ;
  148. * Bilan de l'itération
  149. sit = t . 'WTABLE' . 'ITER' ;
  150. x1 = EXTR xmma 1 ;
  151. x2 = EXTR xmma 2 ;
  152. x3 = EXTR xmma 3 ;
  153. x4 = EXTR xmma 4 ;
  154. x5 = EXTR xmma 5 ;
  155. lx1 = lx1 ET x1 ;
  156. lx2 = lx2 ET x2 ;
  157. lx3 = lx3 ET x3 ;
  158. lx4 = lx4 ET x4 ;
  159. lx5 = lx5 ET x5 ;
  160. lf0 = lf0 ET f0 ;
  161. f1 = EXTR fval 1 ;
  162. li = li ET (MAXI 0. f1) ;
  163. MESS (CHAI 'FORMAT' '(F12.8)' &loop sit /6 x1 >1 x2 >1 x3 >1 x4 >1 x5 >1 f0 >1 kkt2 >1) ;
  164. FIN loop ;
  165. nit = (DIME lf0) - 1 ;
  166.  
  167. * Vérification du résultat
  168. errmax = MAXI 'ABS' ((xmma - xref) / xref) ;
  169. MESS 'Erreur relative max (sur x)' ;
  170. MESS errmax ;
  171.  
  172. * Évolutions temporelles de f, de l'infaisabilité et des variables
  173. * en fonction des itérations d'optimisation
  174. SI itrac ;
  175. lit = PROG 0. 'PAS' 1. nit ;
  176. evf0 = EVOL 'ROUG' 'MANU' 'Iteration' lit 'F0' lf0 ;
  177. evfr = EVOL 'ROUG' 'MANU' 'Iteration' (PROG 0. nit) 'F0' (PROG f0ref f0ref) ;
  178. tl = TABL ;
  179. tl . 2 = 'TIRR' ;
  180. tl . 'TITRE' = TABL ;
  181. tl . 'TITRE' . 1 = 'F0 calculee' ;
  182. tl . 'TITRE' . 2 = 'F0 ref.' ;
  183. DESS (evf0 ET evfr) 'TITR' 'Fonction objectif F0(x) VS Iterations' 'LEGE' tl ;
  184. evi = EVOL 'VERT' 'MANU' 'Iteration' lit 'Inf' li ;
  185. tl . 'TITRE' . 1 = 'Infaisabilite' ;
  186. DESS evi 'TITR' 'Infaisabilite VS Iterations' 'LEGE' tl ;
  187. evx1 = EVOL 'ROUG' 'MANU' 'Iteration' lit 'x' lx1 ;
  188. evx1r = EVOL 'ROUG' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x1ref x1ref) ;
  189. evx2 = EVOL 'ORAN' 'MANU' 'Iteration' lit 'x' lx2 ;
  190. evx2r = EVOL 'ORAN' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x2ref x2ref) ;
  191. evx3 = EVOL 'JAUN' 'MANU' 'Iteration' lit 'x' lx3 ;
  192. evx3r = EVOL 'JAUN' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x3ref x3ref) ;
  193. evx4 = EVOL 'JAUN' 'MANU' 'Iteration' lit 'x' lx4 ;
  194. evx4r = EVOL 'VERT' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x4ref x4ref) ;
  195. evx5 = EVOL 'BLEU' 'MANU' 'Iteration' lit 'x' lx5 ;
  196. evx5r = EVOL 'BLEU' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x5ref x5ref) ;
  197. tl . 4 = 'TIRR' ;
  198. tl . 6 = 'TIRR' ;
  199. tl . 8 = 'TIRR' ;
  200. tl . 10 = 'TIRR' ;
  201. tl . 'TITRE' . 1 = 'x1 calcule' ;
  202. tl . 'TITRE' . 2 = 'x1 ref.' ;
  203. tl . 'TITRE' . 3 = 'x2 calcule' ;
  204. tl . 'TITRE' . 4 = 'x2 ref.' ;
  205. tl . 'TITRE' . 5 = 'x3 calcule' ;
  206. tl . 'TITRE' . 6 = 'x3 ref.' ;
  207. tl . 'TITRE' . 7 = 'x4 calcule' ;
  208. tl . 'TITRE' . 8 = 'x4 ref.' ;
  209. tl . 'TITRE' . 9 = 'x5 calcule' ;
  210. tl . 'TITRE' . 10 = 'x5 ref.' ;
  211. DESS (evx1 ET evx1r ET evx2 ET evx2r ET evx3 ET evx3r ET evx4 ET evx4r ET evx5 ET evx5r) 'TITR' 'Valeurs x VS Iterations' 'LEGE' tl ;
  212. FINSI ;
  213.  
  214. * Sortie en erreur si l'écart aux valeurs de références est trop important
  215. SI (errmax > 1.E-4) ;
  216. ERRE 'Erreur dans le calcul d''optimisation' ;
  217. SINON ;
  218. MESS 'Cas test passe avec succes !' ;
  219. FINSI ;
  220.  
  221.  
  222. FIN ;
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales