[Ipopt] Wrapping two functions together in Ipopt API

Wijekoon, Manusha manusha.wijekoon at citi.com
Tue Jan 2 04:21:34 EST 2018


You can always share results of one calculation with others by using class variables (if you are using a class) or global variables.

From: Ipopt [mailto:ipopt-bounces at coin-or.org] On Behalf Of Hisham Abdulla
Sent: 29 December 2017 22:28
To: ipopt at list.coin-or.org
Subject: [Ipopt] Wrapping two functions together in Ipopt API


I'm a beginner in Ipopt as well as C++.

in Ipopt, I've to write implementations of the following functions, in a class.

virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);

virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);

In my problem, eval_grad_f share many calculations and results with eval_f. ( For example, without obj_value I cannot calculate grad_f). If the both functions were in a single wrapped function, that would have been much easy for me. I want to reuse results and computation of eval_f in the eval_grad_fun. Please suggest an efficient way to do this.



Hisham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20180102/a086eaf9/attachment.html>


More information about the Ipopt mailing list