# Function and gradient evaluation in same function Ipopt

**URL:** <https://discourse.julialang.org/t/function-and-gradient-evaluation-in-same-function-ipopt/9311>\
**Category:** General Usage\
**Tags:** optimization\
**Created:** [February 25, 2018, 8:13am UTC](https://discourse.julialang.org/t/function-and-gradient-evaluation-in-same-function-ipopt/9311 "2018-02-25T08:13:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 25, 2018, 8:44am UTC](https://discourse.julialang.org/t/function-and-gradient-evaluation-in-same-function-ipopt/9311/2 "2018-02-25T08:44:41Z")

</div>

> [@JuMP User-Defined Function, Value and Gradient At Once](https://discourse.julialang.org/t/jump-user-defined-function-value-and-gradient-at-once/8681/2):
>
> You can cache the evaluation point and last value/gradient. If the evaluation point doesn’t change, return the value that you’ve already computed. It sounds like your function has a nontrivial evaluation cost; in this case the extra time spent in this check should be negligible.

---

_[View the full topic](https://discourse.julialang.org/t/function-and-gradient-evaluation-in-same-function-ipopt/9311)._
