On Fri, Aug 27, 2010 at 05:23:05PM -0400, Bob Walton wrote:
> The nmsmax.m function (Nelder-Mead maximization) in the Optim-1.0.12  
> package contains three coding errors.  Attached is a diff -c file with  
> fixes.  These fixes reduce the number of function evaluations for my  
> test functions by about 40% and also greatly reduces the number of times  
> the procedure gets "stuck" at non-optimum points.  The fixes conform the  
> function to the algorithm published by Nelder and Mead, and also cause  
> the routine's results to agree with other implementations of the 
> algorithm.
> -- 
> Bob Walton

> *** nmsmaxorig.m      Sun Aug 20 09:37:58 2006
> --- nmsmax.m  Thu Aug 26 12:36:46 2010
> ***************
> *** 154,160 ****
>              x(:) = ve;
>              fe = dirn*feval(fun,x,varargin{:});
>              nf = nf + 1;
> !            if fe > f(1)
>                 vk = ve; fk = fe;
>                 how = 'expand,  ';
>              end
> --- 154,160 ----
>              x(:) = ve;
>              fe = dirn*feval(fun,x,varargin{:});
>              nf = nf + 1;
> !            if fe > fr
>                 vk = ve; fk = fe;
>                 how = 'expand,  ';
>              end
> ***************
> *** 168,178 ****
>           x(:) = vc;
>           fc = dirn*feval(fun,x,varargin{:});
>           nf = nf + 1;
> !         if fc > f(n)
>              vk = vc; fk = fc;
>              how = 'contract,';
>           else
> !            for j = 2:n
>                  V(:,j) = (V(:,1) + V(:,j))/2;
>                  x(:) = V(:,j);
>                  f(j) = dirn*feval(fun,x,varargin{:});
> --- 168,178 ----
>           x(:) = vc;
>           fc = dirn*feval(fun,x,varargin{:});
>           nf = nf + 1;
> !         if fc > f(n+1)
>              vk = vc; fk = fc;
>              how = 'contract,';
>           else
> !            for j = 2:n+1
>                  V(:,j) = (V(:,1) + V(:,j))/2;
>                  x(:) = V(:,j);
>                  f(j) = dirn*feval(fun,x,varargin{:});

> ------------------------------------------------------------------------------

nmsmax.m seems to be "foreign" code, only slightly modified for usage
in Octave. If you know the nms algorithm well, I think we should just
accept your correction. But I think for verification you should post
one or more of your test-problems which work better with the
correction.

Olaf

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to