* fichier : mma_03.dgibi ************************************************************************ * Section : Mathematiques Fonctions ************************************************************************ ************************************************************************ * Test de l'opérateur MMA : Méthode des Asymptotes Mobiles * * Globalement Convergente * * Reproduction d'un cas test de l'article originel de Svanberg * * * * Krister Svanberg: The method of moving asymptotes - a new method * * for structural optimization * * International Journal for Numerical Methods in Engineering, * * vol. 24, 359-373 (1987) * * https://doi.org/10.1002/nme.1620240207 * * * * * * * * Optimisation d'une poutre en flexion de section variable * * * * |‾‾‾‾‾‾‾‾‾‾‾‾|____________ * * | | |____________ * * | | | |____________ * * | | | | |____________ * * | | | | | | * * | 1 | 2 | 3 | 4 | 5 | * * | | | | |‾‾‾‾‾‾‾‾‾‾‾‾| * * | | | |‾‾‾‾‾‾‾‾‾‾‾‾ | * * | | |‾‾‾‾‾‾‾‾‾‾‾‾ | * * | |‾‾‾‾‾‾‾‾‾‾‾‾ \|/ * * ‾‾‾‾‾‾‾‾‾‾‾‾ v * * * * La poutre est divisée en 5 troncons de même longueur et de sections * * x1 x2 x3 x4 et x5 qui seront les variables de conception. * * Elle est encastrée à gauche et soumise à une force verticale à * * droite. * * * * Le problème d'optimisation est le suivant : * * - Trouver x=(x1 x2 x3 x4 x5) pour minimiser la masse de la poutre * * - tels que la flèche soit inférieure à une limite donnée * * * * Au final, le problème à résoudre se ramène à : * * Minimiser : f0(x) = c1 * (x1 + x2 + x3 + x4 + x5) * * sur x * * * * avec : f1(x) = 61/x1**3 + 37/x2**3 + 19/x3**3 * * + 7/x4**3 + 1/x5**3 < c2 * * 1 < xi < 10 * * * * Si on choisit c1 = 0.0624 et c2 = 1, alors la solution est : * * x1 = 6.0160 x2 = 5.3092 x3 = 4.4943 x4 = 3.5015 x5 = 2.1527 * ************************************************************************ * Options d'affichage OPTI 'ECHO' 0 ; itrac = FAUX ; * Procédure pour calculer f0, f1 ainsi que les dérivées partielles * df0/dxi, df1/dxi, df2/dxi pour i=1,2,3,4,5 DEBP FONC a*'LISTREEL' ; c1 = 0.0624 ; c2 = 1. ; f0 = c1 * (SOMM a) ; df0da = PROG (DIME a)*c1 ; ld = PROG 61. 37. 19. 7. 1. ; fval = PROG ((SOMM (ld / (a ** 3))) - c2) ; dfda = ENUM (-3. * ld / (a ** 4)) ; FINP f0 df0da fval dfda ; * Solution de référence x1ref = 6.0160 ; x2ref = 5.3092 ; x3ref = 4.4943 ; x4ref = 3.5015 ; x5ref = 2.1527 ; xref = PROG x1ref x2ref x3ref x4ref x5ref ; f0ref df0dxref fval0 dfdxref = FONC xref ; MESS ; MESS 'Solution de reference' ; MESS ' x1 x2 x3 x4 x5 f0' ; MESS (CHAI 'FORMAT' '(F12.8)' x1ref /7 x2ref >1 x3ref >1 x4ref >1 x5ref >1 f0ref >1) ; * Choix d'un point initial pour les inconnues x0 = PROG 5. 5. 5. 5. 5. ; * Calcul de f0(x0), df0dx(x0), fval(x0), dfdx(x0) f0 df0dx fval dfdx = FONC x0 ; * Initialisation de la table pour la MMA t = TABL ; t . 'X' = x0 ; t . 'XMIN' = 1. ; t . 'XMAX' = 10. ; t . 'F0VAL' = f0 ; t . 'DF0DX' = df0dx ; t . 'FVAL' = fval ; t . 'DFDX' = dfdx ; t . 'MOVE' = 1. ; t . 'C' = 1000. ; t . 'GC' = VRAI ; t . 'RAA0' = 0.01 ; t . 'RAA' = 0.01 ; * Itérations de la MMA x01 = EXTR x0 1 ; x02 = EXTR x0 2 ; x03 = EXTR x0 3 ; x04 = EXTR x0 4 ; x05 = EXTR x0 5 ; lx1 = PROG x01 ; lx2 = PROG x02 ; lx3 = PROG x03 ; lx4 = PROG x04 ; lx5 = PROG x05 ; lit = PROG 0. ; lf0 = PROG f0 ; f1 = EXTR fval 1 ; li = PROG (MAXI 0. f1) ; MESS ; MESS 'Optimisation par GC-MMA' ; MESS 'It sIt x1 x2 x3 x4 x5 f0 kktnorm' ; MESS (CHAI 'FORMAT' '(F12.8)' 0 0 /6 x01 >1 x02 >1 x03 >1 x04 >1 x05 >1 f0 >1) ; * Boucle d'optimisation REPE loop 20 ; * Appel à MMA lit = lit ET &loop ; * Boucle des sous itérations de la GCMMA REPE sloop 15 ; MMA t ; * Si le sous problème est conservatif * mise à jour des valeurs des fonctions et arret des sous itérations SI (t . 'CONSERV') ; xmma = t . 'X' ; f0 df0dx fval dfdx = FONC xmma ; t . 'F0VAL' = f0 ; t . 'DF0DX' = df0dx ; t . 'FVAL' = fval ; t . 'DFDX' = dfdx ; QUIT sloop ; * Sinon, mise à jour des valeurs des fonctions (pas besoin des gradients) * dans WTABLE et nouvelle sous itération SINON ; xmma = t . 'WTABLE' . 'X' ; f0 df0dx fval dfdx = FONC xmma ; t . 'WTABLE' . 'F0VALNEW' = f0 ; t . 'WTABLE' . 'FVALNEW' = fval ; FINSI ; FIN sloop ; * Calcul du résidu pour les conditions KKT res kkt2 kktinf = KKT_MMA t ; * Bilan de l'itération sit = t . 'WTABLE' . 'ITER' ; x1 = EXTR xmma 1 ; x2 = EXTR xmma 2 ; x3 = EXTR xmma 3 ; x4 = EXTR xmma 4 ; x5 = EXTR xmma 5 ; lx1 = lx1 ET x1 ; lx2 = lx2 ET x2 ; lx3 = lx3 ET x3 ; lx4 = lx4 ET x4 ; lx5 = lx5 ET x5 ; lf0 = lf0 ET f0 ; f1 = EXTR fval 1 ; li = li ET (MAXI 0. f1) ; MESS (CHAI 'FORMAT' '(F12.8)' &loop sit /6 x1 >1 x2 >1 x3 >1 x4 >1 x5 >1 f0 >1 kkt2 >1) ; FIN loop ; nit = (DIME lf0) - 1 ; MESS ; * Vérification du résultat errmax = MAXI 'ABS' ((xmma - xref) / xref) ; MESS 'Erreur relative max (sur x)' ; MESS errmax ; MESS ; * Évolutions temporelles de f, de l'infaisabilité et des variables * en fonction des itérations d'optimisation SI itrac ; lit = PROG 0. 'PAS' 1. nit ; evf0 = EVOL 'ROUG' 'MANU' 'Iteration' lit 'F0' lf0 ; evfr = EVOL 'ROUG' 'MANU' 'Iteration' (PROG 0. nit) 'F0' (PROG f0ref f0ref) ; tl = TABL ; tl . 2 = 'TIRR' ; tl . 'TITRE' = TABL ; tl . 'TITRE' . 1 = 'F0 calculee' ; tl . 'TITRE' . 2 = 'F0 ref.' ; DESS (evf0 ET evfr) 'TITR' 'Fonction objectif F0(x) VS Iterations' 'LEGE' tl ; evi = EVOL 'VERT' 'MANU' 'Iteration' lit 'Inf' li ; tl . 'TITRE' . 1 = 'Infaisabilite' ; DESS evi 'TITR' 'Infaisabilite VS Iterations' 'LEGE' tl ; evx1 = EVOL 'ROUG' 'MANU' 'Iteration' lit 'x' lx1 ; evx1r = EVOL 'ROUG' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x1ref x1ref) ; evx2 = EVOL 'ORAN' 'MANU' 'Iteration' lit 'x' lx2 ; evx2r = EVOL 'ORAN' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x2ref x2ref) ; evx3 = EVOL 'JAUN' 'MANU' 'Iteration' lit 'x' lx3 ; evx3r = EVOL 'JAUN' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x3ref x3ref) ; evx4 = EVOL 'JAUN' 'MANU' 'Iteration' lit 'x' lx4 ; evx4r = EVOL 'VERT' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x4ref x4ref) ; evx5 = EVOL 'BLEU' 'MANU' 'Iteration' lit 'x' lx5 ; evx5r = EVOL 'BLEU' 'MANU' 'Iteration' (PROG 0. nit) 'x' (PROG x5ref x5ref) ; tl . 4 = 'TIRR' ; tl . 6 = 'TIRR' ; tl . 8 = 'TIRR' ; tl . 10 = 'TIRR' ; tl . 'TITRE' . 1 = 'x1 calcule' ; tl . 'TITRE' . 2 = 'x1 ref.' ; tl . 'TITRE' . 3 = 'x2 calcule' ; tl . 'TITRE' . 4 = 'x2 ref.' ; tl . 'TITRE' . 5 = 'x3 calcule' ; tl . 'TITRE' . 6 = 'x3 ref.' ; tl . 'TITRE' . 7 = 'x4 calcule' ; tl . 'TITRE' . 8 = 'x4 ref.' ; tl . 'TITRE' . 9 = 'x5 calcule' ; tl . 'TITRE' . 10 = 'x5 ref.' ; 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 ; FINSI ; * Sortie en erreur si l'écart aux valeurs de références est trop important SI (errmax > 1.E-4) ; ERRE 'Erreur dans le calcul d''optimisation' ; SINON ; MESS 'Cas test passe avec succes !' ; FINSI ; FIN ;