[SciPy-User] Access to objective function and gradient in minimize callback

Daπid davidmenhur at gmail.com
Wed Nov 18 09:20:40 EST 2015


On 18 November 2015 at 15:06, Mark vdw <markvanderw at gmail.com> wrote:

> Is there a way to get the fval and gradient that have already been
> computed inside the optimiser to the callback function?
>

This is what I did in a similar scenario: make your objective function a
callable class, and on each call save the value and the result. The
callback will check if the parameters passed are the same as the last time
it was called, and used the cached value.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20151118/af88c735/attachment.html>


More information about the SciPy-User mailing list