* NELDMEAD PROCEDUR FD218221 26/09/22 21:15:06 12654 DEBP NELDMEAD proc1*'PROCEDUR' ; *---------------- V A L E U R S P A R D E F A U T -----------------* * D E S P A R A M E T R E S * maxit = 200 ; *------------- L E C T U R E D E S A R G U M E N T S --------------* * Simplexe initial (obligatoire, mais 2 manieres possibles) icas = 1 ; * cas 1 : donnee d'un LISTREEL * dimension np1 = n + 1 ; SINON ; * cas 2 : donnee d'un LISTOBJE de LISTREEL icas = 2 ; * test du type d'objets (doit etre LISTREEL) FINSI ; * dimension n = np1 - 1 ; * test de la dimension des LISTREELs REPE b1 np1 ; FINSI ; FIN b1 ; FINSI ; * Nombre d'iterations (facultatifs) maxit = i1 ; FINSI ; * Parametres utilisateur (tous facultatifs) SI (pos > 0) ; REMP valpar pos val1 ; FINSI ; SINON ; QUIT b1 ; FINSI ; FIN b1 ; *-------------------- I N I T I A L I S A T I O N ---------------------* * Si cas 1 (donnee d'un LISTREEL + pas), calcul automatique du simplexe * initial selon le point initial et le pas d'initialisation * (Spendley 1962) SI (EGA icas 1) ; p = tau * ((np1 ** 0.5) + n - 1) / (n * (2. ** 0.5)) ; q = tau * ((np1 ** 0.5) - 1) / (n * (2. ** 0.5)) ; s = ENUM x0 ; REPE b1 n ; x1 = x0 + xq ; s = s ET x1 ; FIN b1 ; FINSI ; ** Evaluation de la fonction aux points du simplexe REPE b1 np1 ; fi = PROC1 xi ; fs = fs ET fi ; FIN b1 ; *-------------- B O U C L E D' O P T I M I S A T I O N --------------* * Parametres d'evolution du simlexe * Boucle REPE b1 maxit ; * Tri des points du simplexe selon les valeurs de fs * Points utiles pour decider de l'evolution * Centre de gravite de {x1 x2 ... xn} REPE b2 n ; FIN b2 ; x0 = x0 / n ; * Reflexion de xnp1 par rapport a x0 xr = x0 + (alpha * (x0 - xnp1)) ; fr = PROC1 xr ; * Si f(x1) <= f(xr) < f(xn), remplacement de xnp1 par xr SI ((f1 <EG fr) ET (fr < fn)) ; REMP fs np1 fr ; REMP s np1 xr ; SINON ; * Si f(xr) < f(x1), expansion du simplexe SI (fr < f1) ; xe = x0 + (beta * (xr - x0)) ; fe = PROC1 xe ; * Si f(xe) <= f(xr), remplacement de xnp1 par xe SI (fe <EG fr) ; REMP fs np1 fe ; REMP s np1 xe ; * Sinon, remplacement de xnp1 par xr SINON ; REMP fs np1 fr ; REMP s np1 xr ; FINSI ; * Si f(xn) < f(xr) : contraction du simplexe SINON ; xc = x0 + (gamma * (xnp1 - x0)) ; fc = PROC1 xc ; * Si f(xc) <= f(xnp1), remplacement de xnp1 par xc SI (fc < fnp1) ; REMP fs np1 fc ; REMP s np1 xc ; * Sinon, homothetie du simplexe autour de x1 SINON ; REPE b2 np1 ; xi = x1 + (delta * (xi - x1)) ; fi = PROC1 xi ; FIN b2 ; FINSI ; FINSI ; FINSI ; * Critere d'arret : dispersion des valeurs de la fonction objectif * aux sommets du simplexe crit1 = AGRE 'ECTY' fs ; SI (crit1 < crit0) ; QUIT b1 ; FINSI ; FIN b1 ; ** On rend le dernier simplexe trie et les valeurs de la fonction associees FINP s fs ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales