[Ipopt] Problems about derivative checker and iteration
Andreas Waechter
andreasw at watson.ibm.com
Fri Feb 26 15:29:18 EST 2010
Hi
> I don't understand the meaning of this section very cleary.I guess the
> meaning is that we can calculate the value,grandient,and hessian for my
> function in only one of the eval_* function.If so,how should I write my
> program? Would you please explain the new_x flag in detail?Thank you
> very much!
It doesn't mean you evaluate the value, grandient, and Hessian in one
specific eval_* method. Instead, you would write another (private) method
that does the evaluation of all these quantities and store the results in
data members of your class. And this method would be call by any of the
eval_* methods only if the new_x flag is true for a particular call. And
after that, for all calls to eval_* methods you can get the precomputed
values and derivatives from your data members.
The AmplInterface code in Ipopt does something similar, it you want to
have a look, it is in
Ipopt/src/Apps/AmplSolver/AmplTNLP.cpp
Regards,
Andreas
On Thu, 25 Feb 2010, lqc234 wrote:
> Hi Stefan,
Thank you for your help! I noticed the new_x flag after your advise.In every eval_* function,the document said about the new_x flag:
The boolean variable new_x will be false if the last call to any of the evaluation methods(eval_*) used
the same x values.This can be helpful when users have efficient implementations that calculate multiple
outputs at once. Ipopt internally caches results from the TNLP and generally,this ï¬ag can be ignored.
I don't understand the meaning of this section very cleary.I guess the meaning is that we can calculate the value,grandient,and hessian for my function in only one of the eval_* function.If so,how should I write my program? Would you please explain the new_x flag in detail?Thank you very much!
å¨2010-02-24 17:31:21ï¼"Stefan Vigerske" <stefan at math.hu-berlin.de> åéï¼
>Hi,
>
>you may use the new_x flag that Ipopt provides for all the eval_*
>functions. That is, if new_x is set to true in any of these routines,
>then you compute value, gradient, and hessian for your function and
>store these values in your TNLP object. As long as new_x is false, you
>can use return this evaluated data in all eval_* functions.
>
>Stefan
>
>lqc234Â wrote:
>> Hi everybody:
>> I have had a problem during using the Ipopt-3.6.1.And I have no idea about this problem for several days,I think that you might not think of this situation .
>> Suppose f(x)= x^2+2*x+1/x+3*x+4*x^3. This formula is very simple,however consider this situation: in my application,for example,1/x+3*x+4*x^3 is a very complicated part that I can't write this part of formula directly,in other words I must use some codes to describe this part,for exampleÂ
>> a set of "for" cycle codes with complicated processing. Now I thought there are two problem.
>> First , the direvative checker tools can't deal with this situation because the complicated part 1/x+3*x+4*x^3 is not described directly.Â
>> The second problem is not easily to describe somewhat.
>> The variable x changes in every iteration,while I can't write 1/x+3*x+4*x^3 directly.So in every iteration I have to describe the  1/x+3*x+4*x^3 part using some codes every time .However, I found that the excution sequence is "eval_jac_g,eval_grad_f,eval_g,eval_f,eval_h" sometime,sometimes it is not this sequence.Now I don't know which part I should write these codes in,it should be in the eval_f? or eval_g? or in eval_grad_f?eval_jac?eval_h?.
>> I don't know the processing procedure during one iteration in Ipopt,those codes should used only once,I can't used those codes in eval_f ,eval_g,eval_grad_f,eval_jac_g,eval_h all.
>> I don't know if I have described the problem clearly.I hope so.
>> Anyone can give some suggestion?Thank you very much in advance.Â
>>Â Â
>>Â Â
>>Â
>>Â
>>Â ------------------------------------------------------------------------
>>Â
>>Â _______________________________________________
>> Ipopt mailing list
>>Â Ipopt at list.coin-or.org
>>Â http://list.coin-or.org/mailman/listinfo/ipopt
>
>
>--Â
>Stefan Vigerske
>Humboldt University Berlin, Numerical Mathematics
>http://www.math.hu-berlin.de/~stefan
More information about the Ipopt
mailing list