<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18999"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial>Dear Michaël,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial>I understand now ... effectively the -maxfunevals number has
to be increase to 1000 to find the good solution ..</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial>... May I suggest to add a warning in the macro either if the
-maxiter parameter or the -maxfunevals one is reach so that the user is
conscious the solution is not necessary optimized.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial>Thanks for your help</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011><FONT color=#0000ff
size=2 face=Arial>Paul</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039382408-18012011></SPAN><SPAN
class=039382408-18012011><FONT color=#0000ff size=2
face=Arial>##################################################<BR>
- X1 optimized = 1<BR> - X2 optimized =
1<BR> - Number of iteration(s) = 362<BR> -
Number of function evaluation(s) = 609<BR> - CPU =
0.90625<BR>##################################################
</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV><BR>
<DIV dir=ltr lang=fr class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>De :</B> Michaël Baudin
[mailto:michael.baudin@scilab.org] <BR><B>Envoyé :</B> mardi 18 janvier
2011 09:20<BR><B>À :</B> users@lists.scilab.org<BR><B>Cc :</B>
Carrico, Paul<BR><B>Objet :</B> Re: [scilab-Users] false results in
Rosenbrock equation<BR></FONT><BR></DIV>
<DIV></DIV>Hi Paul,<BR><BR>The status of the optimization is not good when the
parameters are left to the default values
:<BR><BR>-->neldermead_get(nm,"-status")<BR> ans
=<BR>maxfuneval <BR><BR>This means that the maximum number of
function evaluations where reached before the convergence was attained. All we
need to do is to increase the maximum number of function evaluations. In order
to get even closer to the optimum, we must also increase the number of
iterations.<BR><BR>nm = neldermead_configure(nm,"-maxfunevals",200);<BR>nm =
neldermead_configure(nm,"-maxiter",200);<BR><BR>Once done, I get
:<BR><BR>-->xopt = neldermead_get(nm,"-xopt")<BR> xopt
=<BR> 1.0035954 <BR> 1.0073491
<BR><BR>This is quite a difficult case for Nelder-Mead's algorithm. The simplex
has to go through a long curved valley before reaching the zone where the
function begins to behave as a quadratic function.<BR><BR>Rosenbrock's function
has only one global minimum, at x=[1,1]. The point x=[-1,1] is not a
minimum.<BR><BR>This is easy to check with Scilab. First, let us define the
function.<BR><BR> function [f,G,H] =
rosenbrock(x)<BR> f = 100*(x(2) -
x(1)^2)^2 + (1 - x(1))^2;<BR>
<BR> // Calculation of the gradient G
vector<BR> G(1) = -400*x(1)*(x(2) -
x(1)^2) - 2*(1 - x(1));<BR> G(2) =
200*(x(2) - x(1)^2);<BR>
<BR> // Calculation of the Hessian
matrix<BR> H(1,1) = -400*x(2) +
1200*x(1)^2 + 2;<BR> H(1,2) =
-400*x(1);<BR> H(2,1) =
-400*x(1);<BR> H(2,2) =
200;<BR> endfunction<BR><BR>We get at x= [1,1]
:<BR><BR>-->[f,G,H] = rosenbrock([1,1])<BR> H
=<BR> 802. - 400. <BR> -
400. 200. <BR> G =<BR>
0. <BR> 0. <BR> f
=<BR> 0. <BR><BR>This means that the gradient is zero,
implying that the first order conditions for unconstrained optimality are
satisfied. Moreover, the eigenvalues of the Hessian matrix are positive, as
shown below :<BR><BR>-->spec(H)<BR> ans =<BR>
0.3993608 <BR> 1001.6006 <BR><BR>This implies that
the local curvature of the Rosenbrock function is positive : x* is indeed a
minimum.<BR><BR>Now, at x=[-1,1], we get :<BR><BR>-->[f,G,H] =
rosenbrock([-1,1])<BR> H =<BR>
802. 400. <BR> 400.
200. <BR> G =<BR> - 4. <BR>
0. <BR> f =<BR> 4. <BR><BR>The gradient
is nonzero, which means that the first order optimality conditions are not
satisfied at x=[-1,1]. Rosenbrock's function is a sum of squares.<BR><BR>Best
regards,<BR><BR>Michaël<BR><BR><BR>Le 17/01/2011 11:18, Carrico, Paul a
écrit :
<BLOCKQUOTE cite=mid:55A12CBC06A8C9459DCE0BBEF8122FDC0498B09D@exchsrv.AUXITROL1
type="cite">
<META name=GENERATOR content="MSHTML 8.00.6001.18999">
<DIV><FONT size=2 face=Arial><SPAN class=307310710-17012011>Dear
all</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=307310710-17012011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=307310710-17012011>In the Rosenbrock
equation it is well known the 2 minima are (1,1) and (-1,1) ; in the
attached where I want to test several optimization macros (and basic
&particular functions) I've a different result as descibed herebellow : is
there a mistake in the input file or does something go wrong
?</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=307310710-17012011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=307310710-17012011>Please note the
functions inputs are as general as possible to be used with the different
macros (fminsearch, optim and so on)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=307310710-17012011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=307310710-17012011>Paul</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><SPAN class=307310710-17012011><FONT size=2
face=Arial>#################################################################"</FONT></SPAN></DIV>
<DIV><SPAN class=307310710-17012011></SPAN><FONT size=2 face=Arial><SPAN
style="FONT-SIZE: 12pt"><FONT size=2> - X1 optimized =
0.229978<BR> - X2 optimized =
0.0240434</FONT><BR></SPAN></FONT></DIV>
<DIV> </DIV><PRE>--------------------------------------------------------------------------------
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.
</PRE></BLOCKQUOTE><BR><BR><PRE class=moz-signature cols="72">--
Michaël Baudin
Ingénieur de développement
<A class=moz-txt-link-abbreviated href="mailto:michael.baudin@scilab.org">michael.baudin@scilab.org</A>
-------------------------
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
</PRE></BODY></HTML>
<pre>--------------------------------------------------------------------------------
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.