# [Ipopt] Question about CPU time in NLP function evaluations

Stefan Vigerske stefan at math.hu-berlin.de
Fri Mar 22 06:02:19 EDT 2013

```Hi,

On 03/21/2013 08:23 PM, Ahn, Tae-Hyuk wrote:
> Hello All,
>
> I am a new user and fan of IPOPT.

Welcome.

> I have a question about CPU time for NLP function evaluations.
>
> My problem has dynamic variables with complex objective function. Below is the variable info of one example.
>
> ---------------------------------------------------------------------------
> Number of nonzeros in equality constraint Jacobian...:     1291
> Number of nonzeros in inequality constraint Jacobian.:        0
> Number of nonzeros in Lagrangian Hessian.............:   833986

So your hessian is indeed completely dense (all elements are sometimes
nonzero)?

> Total number of variables............................:     1291
>                       variables with only lower bounds:        0
>                  variables with lower and upper bounds:     1291
>                       variables with only upper bounds:        0
> Total number of equality constraints.................:        1
> Total number of inequality constraints...............:        0
>          inequality constraints with only lower bounds:        0
>     inequality constraints with lower and upper bounds:        0
>          inequality constraints with only upper bounds:        0
> ---------------------------------------------------------------------------
>
> After IPOPT solves the problem, I satisfy the results. The problem is, however, elapsed time.
>
> ---------------------------------------------------------------------------
> Number of Iterations....: 22
> Total CPU secs in IPOPT (w/o function evaluations)   =     60.527
> Total CPU secs in NLP function evaluations           =  12798.083
> ---------------------------------------------------------------------------
>
> As you see that, it took 3-4 hours to solve this problem. Especially, "NLP function evaluations" tool all of time.
>
> Let's assume that f, grad_f, g, jac_g, and h are already optimized (that means I don't want to change them). How can I reduce the elapsed time? Can I "turn off" the step "NLP function evaluation"?

If you mean that you want to keep objective and constraints fixed, then
there isn't much left to optimize. That would indeed remove the need to
evaluate your functions, but it raises the question why to run Ipopt at all.

The time spend in function evaluations is in the users responsibility.
You may want to check where your code spends so much time. If not done
yet, then you may want to make use of the new_x flag that is passed to
the evaluation routines.

Stefan

>
> If you have any suggestion, please let me know.
>
> Thank you very much!
>
> Sincerely,
>
> Ted
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>

```