[scilab-Users] Nelder-Mead optimization

michael.baudin at contrib.scilab.org michael.baudin at contrib.scilab.org
Mon Jul 16 22:22:27 CEST 2012


 Dear Paul,

 There were several changes in Scilab v5.4 which simplify the use
 of the neldermead component.

 For the first warning, you get this message because you use
 the -costfargument option, which is now obsolete.

 Tagged -costfargument option of optimbase as obsolete: will be 
 maintained for backward compatibility until 5.4.1. The -fun option can 
 now be a list, where the element #1 is a function, and the elements #2 
 to the end are automatically appended to the calling sequence. To update 
 your code, replace:

       nm = neldermead_configure(nm,"-function",myfun);
       nm = neldermead_configure(nm,"-costfargument",mystuff);
 
 with

       nm = neldermead_configure(nm,"-function",list(myfun,mystuff));

 You will find the required details in the "Changes in Scilab 5.4" 
 section of :

 http://help.scilab.org/docs/5.4.0-beta-1/en_US/neldermead.html

 See also the "Example #6: Passing extra parameters" section for extra 
 arguments.

 Does this fix the error too ?

 Best regards,

 Michaël

 On Mon, 16 Jul 2012 16:22:52 +0200, "Carrico, Paul" 
 <paul.carrico at esterline.com> wrote:
> Dear All,
>
> I would like to re-use an routine written more than a year ago ... 
> but
> it failed ;
>
> I can understand thinks have been done in order to improve the
> function, but :
> - I don't remember what's optimbase_configure ...
> - what's wrong ?
>
> Any advice ?
>
> Regards
>
> Paul
>
> The main routine is something like :
>
> // 8 parameters
> lower_bounds = [0.22 2.337 18.72 14.859 19.05 14.5 1.85 0.];
> upper_bounds = [0.28 2.388 18.771 15.0119 19.075 14.6 1.95 0.68];
> data = list(lower_bounds,upper_bounds);
>
> printf("n The initial parameters are the following :n");
> thickness = 0.28;
> height = 2.380;
> D_ext = 18.771;
> D_int = 14.859;
> groove_ext_radius = 19.075;
> groove_int_radius = 14.50;
> housing_deepth = 1.85;
> COEF_FRICTION = 0.4;
>
> initial_parameters = [thickness height D_ext D_int groove_ext_radius
> groove_int_radius housing_deepth COEF_FRICTION];
>
> // CPU time : start
> time_start = tic();
>
> // Nelder-mead optimization
> nm = neldermead_new ();
> nm = neldermead_configure(nm,"-numberofvariables",8); // Number of
> variables
> nm = neldermead_configure(nm,"-function",optimization_nm);
> nm = neldermead_configure(nm,"-x0",initial_parameters'); // BE 
> CAREFUL
> : nitial_parameters' = transposed matrix
> nm = neldermead_configure(nm,"-method","box"); // box => brackets are
> taken into account
> nm = neldermead_configure(nm,"-maxiter",10000);
> nm = neldermead_configure(nm,"-boundsmin",lower_bounds);
> nm = neldermead_configure(nm,"-boundsmax",upper_bounds);
> nm = neldermead_configure(nm,"-costfargument",data);
> nm = neldermead_configure(nm,"-simplex0method","randbounds");
> [nm,SSE] = neldermead_function(nm,initial_parameters');
> nm = neldermead_search(nm); // start optimization process
> optimized_parameters = neldermead_get(nm,"-xopt"); // extract of the
> results
> nm = neldermead_destroy(nm);
>
> The error message is :
>
> AVERTISSEMENT : La fonctionnalité optimbase_configure est obsolète.
> AVERTISSEMENT : Veuillez utiliser -function à la place.
> AVERTISSEMENT : Cette fonctionnalité va être définitivement
> supprimée dans Scilab 5.4.1
>
> #########################################################
>  * Iteration No : 1
>  * thickness = 0.28
>  * height = 2.38
>  * D_ext = 18.771
>  * D_int = 14.859
>  * groove_ext_radius = 19.075
>  * groove_int_radius = 14.5
>  * housing_deepth = 1.85
>  * COEF_FRICTION = 0.4
> !--error 58
> Nombre erroné d'arguments d'entrée.at line 73 of function
> __optimbase_f__ called by :
> at line 66 of function optimbase_function called by :
> at line 7 of function neldermead_function called by :
> [nm,SSE] = neldermead_function(nm,initial_parameters');
> at line 65 of exec file called by :
>
> 
> --------------------------------------------------------------------------------
> Le présent mail et ses pièces jointes sont confidentiels et
> destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous
> avez reçu cet e-mail par erreur, veuillez contacter immédiatement
> l'expéditeur et effacer le message de votre système. Toute
> divulgation, copie ou distribution de cet e-mail est strictement
> interdite. This email and any files transmitted with it are
> confidential and intended solely for the use of the individual or
> entity to whom they are addressed. If you have received this email in
> error, please contact the sender and delete the email from your
> system. If you are not the named addressee you should not 
> disseminate,
> distribute or copy this email.



More information about the users mailing list