[scilab-Users] fminsearch function question

Michaël Baudin michael.baudin at scilab.org
Fri Dec 3 11:51:22 CET 2010


Hi,

Thank you for asking this question. As a workaround, you may use a 
global variable:

// An example NOT to follow
function y=banana(x)
   global a
   y = 100*(x(2)-x(1)^2)^2 + (a-x(1))^2
endfunction
a = sqrt(2);
global a;
x = fminsearch ( banana , [-1.2 1] )
expected = [a a^2];


As this should be described in the help page of fminsearch, I created 
the bug report :

http://bugzilla.scilab.org/show_bug.cgi?id=8552

Another solution is to use the -costfargument option in neldermead.

But global variables can lead to issues, so that it is really a 
temporary workaround. A better solution is to provide the extra 
parameters as a list. This is not in the Matlab/fminsearch (but Matlab 
has anonymous functions to handle this). I created the following bug 
report to fix this issue in fminsearch :

http://bugzilla.scilab.org/show_bug.cgi?id=8553

Best regards,

Michaël Baudin


Le 02/12/2010 09:44, Carrico, Paul a écrit :
> dear all,
> I'm using either fminsearch function of nmplot one following the 
> scheme hereafter :
> level 1- call of the fminsearch function
> level 2 - cost function
> level 3 - call of sub-function
> As you can see herebellow I would like to link constant parameters 
> from the level 1 to the level 3 (i.e. nu1 and nu2 values) => how can I 
> do this ?
> I had a look in optimset/optimget function but It not seems to be the 
> write ones !
> I hope it's clear enough
> Regards
> Paul
> ### level 1
> optimized_parameters = fminsearch(optimization,initial_parameters);
> poisson = 0.495;
> mu1 = 0.0438055;
> alpha1 = 2.86504;
> mu2 = 0.061838;
> alpha2 = 1.34878;
> nu1 = poisson;
> nu2 = poisson;
> initial_parameters = [mu1 alpha1 mu2 alpha2];
> ### level 2
> function SSE = optimization(x)
> nu1 = 0.495;
> nu2 = 0.495;
> ADDITIONAL = [nu1 nu2];
> printf("#########################################################\n");
> printf("            * mu1 = %g\n",x(1));
> printf("            * alpha1 = %g\n",x(2));
> printf("            * mu2 = %g\n",x(3));
> printf("            * alpha2 = %g\n",x(4));
> printf("            * nu1 = %g\n",nu1);
> printf("            * nu2 = %g\n",nu2);
> ### level 3
> status = write_ccx_file(PATH_DATA,INPUT_FILE_NAME,x,ADDITIONAL);
> --------------------------------------------------------------------------------
>
>
> 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.
>
>


-- 
Michaël Baudin
Ingénieur de développement
michael.baudin at scilab.org
-------------------------
Consortium Scilab - Digiteo
Domaine de Voluceau - Rocquencourt
B.P. 105 - 78153 Le Chesnay Cedex
Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20101203/3282a562/attachment.htm>


More information about the users mailing list