<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Your test case allowed me to a bug with respect to the management of
    the output function in the case of Box's algorithm. I reported it at
    :<br>
    <br>
    <a href="http://bugzilla.scilab.org/show_bug.cgi?id=8805">http://bugzilla.scilab.org/show_bug.cgi?id=8805</a><br>
    <br>
    Regards,<br>
    <br>
    Michaël<br>
    <br>
    Le 18/01/2011 09:19, Michaël Baudin a écrit :
    <blockquote cite="mid:4D354D20.6050208@scilab.org" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      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 content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        <meta name="GENERATOR" content="MSHTML 8.00.6001.18999">
        <div><font face="Arial" size="2"><span
              class="307310710-17012011">Dear all</span></font></div>
        <div><font face="Arial" size="2"><span
              class="307310710-17012011"></span></font> </div>
        <div><font face="Arial" size="2"><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 face="Arial" size="2"><span
              class="307310710-17012011"></span></font> </div>
        <div><font face="Arial" size="2"><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 face="Arial" size="2"><span
              class="307310710-17012011"></span></font> </div>
        <div><font face="Arial" size="2"><span
              class="307310710-17012011">Paul</span></font></div>
        <div> </div>
        <div> </div>
        <div> </div>
        <div><span class="307310710-17012011"><font face="Arial"
              size="2">#################################################################"</font></span></div>
        <div><span class="307310710-17012011"></span><font face="Arial"
            size="2"><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 moz-do-not-send="true" 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>
    </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>