[SciPy-user] [OpenOpt] evaluation of f(x) and df(x)

dmitrey dmitrey.kroshko@scipy....
Mon Jul 21 11:08:52 CDT 2008


Sorry, I re-read your letter once again and seems now I understand the 
question.

Emanuele Olivetti wrote:
> Dear All and Dmitrey,
>
> in my code the evaluation of f(x) and df(x) shares many
> intermediate steps. I'd like to re-use what is computed
> inside f(x) to evaluate df(x) more efficiently, during f(x)
> optimization. Then is it _always_ true that, when OpenOpt
> evaluates df(x) at a certain x=x^*, f(x) too was previously
> evaluated at x=x^*?
No, this is not guarantied.
>  And in case f(x) was evaluated multiple
> times before evaluating df(x), is it true that the last x at
> which f(x) was evaluated (before computing df(x=x^*))
> was x=x^*?
>   
No, this is not guarantied.

I can only guarantee the code
f = user_obj_fun(x)
f2 = user_obj_fun(x)
will not call user-supplied objective func for twice. Same for df, c, 
dc, dh etc.

> If these assumptions holds (as it seems from preliminary
> tests on NLP using ralg), the extra code to take advantage
> of this fact is extremely simple.
>   
It is what oofun is intended for (constructing f,c,h from lots of 
pieces, some of which can be used for several times, including 
cross-cases, for example same part of code used by c and f). Currently I 
continue my work on them. See the file (committed some minutes ago, 
still require more detailed docstrings):
http://projects.scipy.org/scipy/scikits/browser/trunk/openopt/scikits/openopt/examples/oofun_input.py
Still there is much more work to be done (including recursive 1st 
derivatives, conception of oovar that I intend to add etc).

Regards, D.
> Best,
>
> Emanuele
>
> P.S.: if the previous assumptions are false in general, I'd
> like to know it they are true at least for the NLP case.
>
>   



More information about the SciPy-user mailing list