<!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">
    Hi,<br>
    <br>
    Indeed, the Nelder-Mead algorithm is rather slow, as can be expected
    from an algorithm which does not rely on neither the gradient nor
    the Hessian (or any approximation to it).<br>
    <br>
    You can use the optim function to solve your problem. In the optim
    help page :<br>
    <br>
    <a href="http://www.scilab.org/product/man/optim.html">http://www.scilab.org/product/man/optim.html</a><br>
    <br>
    search for "Example: Optimizing with numerical derivatives".<br>
    <br>
    The function does not have to be analytic : the only thing that is
    required is that the function can be evaluated.<br>
    <br>
    Of course, the function should be smooth for the function to work
    better. <br>
     * If f and its gradient are continuous, optim with the quasi-Newton
    and the limited BFGS algorithms should work well (i.e. try the "qn"
    and "cg" options).<br>
     * If f is discontinuous, only Nelder-Mead can work (but is likely
    to have some problems to converge).<br>
     * If f is continous but its gradient is discontinous, you may try
    the "nd" option. It is a special algorithms for functions in this
    class (e.g. min max_i f_i). Lemaréchal is an expert on this topic.<br>
    <br>
    Try it and you will see !<br>
    <br>
    Best regards,<br>
    <br>
    Michaël<br>
    <br>
    <br>
    Le 25/01/2011 12:38, Carrico, Paul a écrit :
    <blockquote
      cite="mid:55A12CBC06A8C9459DCE0BBEF8122FDC0498B0CC@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">
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">Dear All,<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">For some times I’m testing Scilab macros for
                  optimization purposes ; “optimization” has to be
                  intended here as an inverse method for fitting
                  parameters (i.e. so that finite element analysis fit
                  test measurements).<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">I tested basic macros such as fminsearch for
                  unbounded fitting as well as Nelder-Mead one for
                  bracketed parameters fitting. Basically the “cost
                  function” is the normalized Sum of the Square errors
                  SSE from the FEA to the measurements.<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font face="Times New Roman"><font
                  size="3">In my FEA<span class="516203511-25012011">'s</span> <span
                    class="516203511-25012011">the </span><span
                    class="516203511-25012011">variables </span>can be
                  material parameters, spring stiffness’s, damping ratio
                  and so on : the simplex method is well adapted since
                  the former <span class="516203511-25012011">variables
                  </span>are not analytically described in the cost
                  function and since it’s not necessary to calculate the
                  gradient vector nor the Hessian matrix …<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p></o:p></span> </p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">If this method is robust nevertheless it
                  remains rather slow !<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">Is there a way or another macro I can use to
                  reduce the number of loops and the time consuming
                  consequently ?<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font
              face="Times New Roman"><font size="3"><i style=""><span
                    style="" lang="EN-GB"><u>Nota</u></span></i><span
                  style="" lang="EN-GB"> : I was thinking in OPTIM macro
                  but from my understanding the cost function need to be
                  twice differentiable at least <span
                    class="516203511-25012011"> </span>(for the <span
                    class="516203511-25012011">G</span>radient and the
                  Hessian ) i.e. analytically link to the parameters …
                  isn’t it ?<o:p></o:p></span></font></font></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">Thanks in advance for any advice (for a better
                  understanding)<o:p></o:p></font></font></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><o:p><font face="Times New Roman"
                  size="3"> </font></o:p></span></p>
          <p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
              style="" lang="EN-GB"><font size="3"><font face="Times New
                  Roman">Paul<o:p></o:p></font></font></span></p>
        </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>