<div dir="ltr">Hi Stefan,<div><br></div><div>Thank you for your suggestion. It was found that the evaluation of jacobian of constraints took too much time, and it was due to the if-else used in the for-loop when forming the jacobian. Another version of jacobian was done without any if-else, then the evaluation of jacobian becomes much much quicker. For now, it was shown that the searching direction calculation take most of the time (which is supposed to be I guess?), all function and derivative evaluations take very little time.</div><div><br></div><div>May I ask is this simply due to the extra calls of if-else that costs much more time? Or some other mechanism related with C++ when including if-else in the for loop?</div><div><br></div><div>Moreover, is that possible to use automatic differentiation tools to generate source transformation codes for jacobian and hessian? I tried some AD tools using operator overloading, but with large number of variables these tools crash often. If possible, could you recommend AD tools with source transformation to be used with IPOPT C++ interface?</div><div><br></div><div>Thank you very much.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 29, 2019 at 4:36 AM Stefan Vigerske <<a href="mailto:stefan@math.hu-berlin.de">stefan@math.hu-berlin.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
loops are ok, as long as you use them efficiently.<br>
You can run Ipopt with option print_timing_statistics set to yes to get <br>
more information about where time is spend.<br>
<br>
Stefan<br>
<br>
On 4/28/19 8:15 PM, To To wrote:<br>
> Dear all,<br>
> <br>
> I'm using IPOPT 3.12.12 with the provided C++ interface under Ubuntu 18.04.<br>
> I formulated a relatively simple NLP and it works.<br>
> <br>
> I am totally new to C++, so I form my constraint and jacobian all with for<br>
> loop. May I ask is it the best way to formulate constraints and jacobian<br>
> using for loop? I tired to increase the number of NLP variables to around<br>
> 300000, and I have around 200000 constraints (very sparse). I found that it<br>
> is very slow when computing.<br>
> <br>
> Should I be careful when forming such a big problem with provided C++<br>
> interface? Or should I use some other libraries such as EIGEN to better<br>
> form the jacobian?<br>
> <br>
> Thank you very much.<br>
> <br>
> <br>
> _______________________________________________<br>
> Ipopt mailing list<br>
> <a href="mailto:Ipopt@list.coin-or.org" target="_blank">Ipopt@list.coin-or.org</a><br>
> <a href="https://list.coin-or.org/mailman/listinfo/ipopt" rel="noreferrer" target="_blank">https://list.coin-or.org/mailman/listinfo/ipopt</a><br>
> <br>
<br>
</blockquote></div>