help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bfgsmin iterations


From: Przemek Klosowski
Subject: Re: bfgsmin iterations
Date: Wed, 13 May 2009 09:40:20 -0400 (EDT)

   I used your bfgsmin implementation and I found that it evaluates the
   objective function unnessessarily many times.
   ...
   I'd like to know it if is normal and if so, isn't there an easy way of doing 
a caching
   instead of double calling.

As Michael said, bfgsmin algorithm could possibly be improved, but you can 
easily do caching
within your own function. 


   function y=f(x)
   global f_cache;
   global f_index;
   if (index=find(f_cache.x==x)) 
      y=f_cache.y(index)
   else
      f_index=mod(++f_index,100)+1;
      f_cache.x(f_index)=x;
      y= ..... % your own calculation 
      f_cache.y(f_index)=y; 
   endif
   endfunction

I am sure there are faster and more efficient/elegant ways of doing this, 
please feel free 
to suggest improvements.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]