[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bfgsmin iterations
From: |
Jaroslav Hajek |
Subject: |
Re: bfgsmin iterations |
Date: |
Thu, 14 May 2009 09:45:22 +0200 |
On Wed, May 13, 2009 at 10:27 AM, Levente Torok <address@hidden> wrote:
> Dear Michael Creel,
>
> I used your bfgsmin implementation and I found that it evaluates the
> objective function unnessessarily many times.
> I have recorded the points at which my function was evaluated
>
> Please find the enclosed png file. x axis - iteration, y - value of my 1
> dimensional obj.func parameter.
> And this is the array in which I recorded the location of the evaluations
> z=[
> 3.00000000000000e+02
> 6.00000000000000e+02
> 1.00000000000000e-01
> 4.50000000000000e+02
> 4.50000000000000e+02
> 1.50000000000000e+02
> 1.00000000000000e-01
> 1.00000000000000e-01
> 2.25000000000000e+02
> ...
>
> As I see it usually calles the obj.func two times with exactly the same
> argument.
> 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.
>
> Levente
>
Since I think exactly the same issue occurs in the new Octave's core
fsolve and fminunc codes,
you might be interested in how they cope with this:
If using finite difference derivatives, the duplicate evaluation is
avoided internally by the code.
However, if using user-supplied gradient/jacobian, this is not
technically possible, because the decision whether the derivatives are
needed is made *after* a function value request. So the user needs to
handle this if there's a significant redundancy to be exploited. The
fsolve help includes a nice example how this can be efficiently done
using a persistent variable holding the intermediate state.
cheers
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz