[Ipopt] IDX_STY and NEW_X in the Fortran sample (fwd)

Daniel Feenberg feenberg at nber.org
Wed Nov 14 14:28:11 EST 2018



On Wed, 14 Nov 2018, Stefan Vigerske wrote:

> Hi,
>
> On 11/14/18 6:56 PM, Daniel Feenberg wrote:
>> 
>> 2) I am unsure of how to handle NEW_X. Can I just add:
>>
>>     IF(NEW_X.EQ.1) return
>
> That would usually not give you what you want.
>
>> at the start of EV_G,EV_JACG,EV_F and EV_GRAD_F, after the
>> declarations and before any computations? Is the constant
>> 1 or 0? When I print NEW_X, it always seems to be zero.
>
> Yes, should be 0 or 1.
>
> NEW_X gives can additional information about the point to be evaluated: It is 
> 0 if any evaluation method was previously called with the same values in x, 
> and is 1 otherwise.
> So ignoring NEW_X would be fine, but it might help you to safe some 
> computations in your implementations of the callbacks, but eventually the 
> callbacks should still provide the function values, gradients, or Hessian.
>

I could use some more clarity - If NEW_X is 0 then I am safe returning 
from the subroutine without doing any calculations, but if it is 1 then I 
should do the calculations so that the values returned by the subroutine 
are correct for the value of x supplied to it. Is that right? Maybe I 
don't understand something fundamental since NEW_X is always 0 in my small 
test calculations when passed to all the ev* subroutines except for calls 
to ev_g, where NEW_X is always 1. Even if I have 1 and 0 mixed up, 
shouldn't ev_g need at least 1 actual evaluation?

Looking at the final result, it does appear to be a valid solution to the 
problem, but I am not using NEW_X to control anything yet.

Daniel Feenberg
NBER


More information about the Ipopt mailing list