[Ipopt] Hessian, gradient, and objective function have common terms
Stefan Vigerske
stefan at math.hu-berlin.de
Wed Nov 28 03:30:10 EST 2018
Hi,
On 11/27/18 11:31 PM, Filip Jorissen wrote:
> This suggestion makes sense to me, although it may cause additional overhead in case IPOPT wants to e.g. evaluate the Jacobian only. This could however be indicated by IPOPT using some flag.
>
> Another option would be to set up your functions such that they internally cache the computed common variables and communicate them to each other, somehow.. But that sounds cumbersome.
This one. And making use of the new_x flag that Ipopt passes to the
evaluation functions.
See Ipopt documentation.
Stefan
>
> Filip
>
> Op 27 nov. 2018, om 22:39 heeft R zu <rzu512 at gmail.com<mailto:rzu512 at gmail.com>> het volgende geschreven:
>
> Sorry, I typed that in haste (~ 1 minute). I was doing derivative over products. Product rule means terms repeated.
>
> I wish Ipopt allow me to provide a function that provides the hessian, objective, and gradient in the same function.
> That means I only need to calculate the common term for once, and plug it into formula of all three (hessian...).
>
> However, currently I need to provide a function for each of the hessian, objective, and gradient.
> Within each of the 3 functions, I need to calculate the common term for once.
>
> That means the common term is probably calculated for 3 times. I worry that compiler optimization might not be that good and floating point operations are not exactly commutative.
>
>
>
> On Tue, Nov 27, 2018 at 2:15 PM R zu <rzu512 at gmail.com<mailto:rzu512 at gmail.com>> wrote:
> The difficulty is in programming. But here is an example.
>
> Example objective function f:
>
> f(vector x) = g(vector x)h(vector x)
>
> where:
> N N
> g(vector x) = Sum sum c_n c_m x_n
> n=1 m=1
> N
> h(vetor x) = Sum c_n c_m x_n
> n=1
>
> Gradient calculated by product rule:
>
> f ' (x) = g ' (x) h(x) + g(x) + h' (x)
>
> The function g(x) and h(x) are common between f and f '.
>
>
>
> On Tue, Nov 27, 2018 at 1:59 PM Chintan Pathak <cp84 at uw.edu<mailto:cp84 at uw.edu>> wrote:
> Dear R Zu,
>
> Might be helpful if you give a small example demonstrating your usecase. For example, are the common terms dependent on 'x', etc.
>
> Thanks
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__about.me_chintanpathak&d=DwIFAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BRcuJnQr5NAzU29t80hk2rsLc4vrlRySBDabuq0O1ZI&m=Sdq_lngLLgZ_DZS1es7fsXDGJm-xgVXeSRoHnXdV-JU&s=qWIayJ997apmCtOaM-nQgnt7KgKTXYa8dHlLHIbSSzg&e=
>
>
> On Tue, Nov 27, 2018 at 9:55 AM R zu <rzu512 at gmail.com<mailto:rzu512 at gmail.com>> wrote:
> Hi.
>
> - The hessian, gradient, and objective function have some common terms.
> - The common terms depends on the variables of the objective function.
>
> I calculate each common terms for three times because I need the term for Hessian, gradient, and objective function.
>
> Is it possible to only calculate each common term for only once in each step of optimization?
>
> Thank you.
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org<mailto:Ipopt at list.coin-or.org>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_ipopt&d=DwIFAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BRcuJnQr5NAzU29t80hk2rsLc4vrlRySBDabuq0O1ZI&m=Sdq_lngLLgZ_DZS1es7fsXDGJm-xgVXeSRoHnXdV-JU&s=GmqTpdPJNkgLD0s1Qi3EkJehfhwquv8OI8lk2xBW61g&e=
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org<mailto:Ipopt at list.coin-or.org>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_ipopt&d=DwIFAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BRcuJnQr5NAzU29t80hk2rsLc4vrlRySBDabuq0O1ZI&m=Sdq_lngLLgZ_DZS1es7fsXDGJm-xgVXeSRoHnXdV-JU&s=GmqTpdPJNkgLD0s1Qi3EkJehfhwquv8OI8lk2xBW61g&e=
>
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_ipopt&d=DwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BRcuJnQr5NAzU29t80hk2rsLc4vrlRySBDabuq0O1ZI&m=Sdq_lngLLgZ_DZS1es7fsXDGJm-xgVXeSRoHnXdV-JU&s=GmqTpdPJNkgLD0s1Qi3EkJehfhwquv8OI8lk2xBW61g&e=
>
More information about the Ipopt
mailing list