<DIV></DIV>
<DIV></DIV>
<P>Hi Stefan,</P>
<P>Thank you for your help! I noticed the new_x flag after your advise.In every eval_* function,the document&nbsp;said about the new_x flag:</P>
<P>The boolean variable new_x will be false if the last call to any of the evaluation methods(eval_*) used<BR>the same x values.This can be helpful when users have efficient implementations that calculate multiple<BR>outputs at once. Ipopt internally caches results from the TNLP and generally,this flag can be ignored.</P>
<P>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!<BR></P><PRE>在2010-02-24&nbsp;17:31:21,"Stefan&nbsp;Vigerske"&nbsp;&lt;stefan@math.hu-berlin.de&gt;&nbsp;写道:
&gt;Hi,
&gt;
&gt;you&nbsp;may&nbsp;use&nbsp;the&nbsp;new_x&nbsp;flag&nbsp;that&nbsp;Ipopt&nbsp;provides&nbsp;for&nbsp;all&nbsp;the&nbsp;eval_*
&gt;functions.&nbsp;That&nbsp;is,&nbsp;if&nbsp;new_x&nbsp;is&nbsp;set&nbsp;to&nbsp;true&nbsp;in&nbsp;any&nbsp;of&nbsp;these&nbsp;routines,
&gt;then&nbsp;you&nbsp;compute&nbsp;value,&nbsp;gradient,&nbsp;and&nbsp;hessian&nbsp;for&nbsp;your&nbsp;function&nbsp;and
&gt;store&nbsp;these&nbsp;values&nbsp;in&nbsp;your&nbsp;TNLP&nbsp;object.&nbsp;As&nbsp;long&nbsp;as&nbsp;new_x&nbsp;is&nbsp;false,&nbsp;you
&gt;can&nbsp;use&nbsp;return&nbsp;this&nbsp;evaluated&nbsp;data&nbsp;in&nbsp;all&nbsp;eval_*&nbsp;functions.
&gt;
&gt;Stefan
&gt;
&gt;lqc234&nbsp;wrote:
&gt;&gt;&nbsp;Hi&nbsp;everybody:
&gt;&gt;&nbsp;I&nbsp;have&nbsp;had&nbsp;a&nbsp;problem&nbsp;during&nbsp;using&nbsp;the&nbsp;Ipopt-3.6.1.And&nbsp;I&nbsp;have&nbsp;no&nbsp;idea&nbsp;about&nbsp;this&nbsp;problem&nbsp;for&nbsp;several&nbsp;days,I&nbsp;think&nbsp;that&nbsp;you&nbsp;might&nbsp;not&nbsp;think&nbsp;of&nbsp;this&nbsp;situation&nbsp;.
&gt;&gt;&nbsp;Suppose&nbsp;f(x)=&nbsp;x^2+2*x+1/x+3*x+4*x^3.&nbsp;This&nbsp;formula&nbsp;is&nbsp;very&nbsp;simple,however&nbsp;consider&nbsp;this&nbsp;situation:&nbsp;in&nbsp;my&nbsp;application,for&nbsp;example,1/x+3*x+4*x^3&nbsp;is&nbsp;a&nbsp;very&nbsp;complicated&nbsp;part&nbsp;that&nbsp;I&nbsp;can't&nbsp;write&nbsp;this&nbsp;part&nbsp;of&nbsp;formula&nbsp;directly,in&nbsp;other&nbsp;words&nbsp;I&nbsp;must&nbsp;use&nbsp;some&nbsp;codes&nbsp;to&nbsp;describe&nbsp;this&nbsp;part,for&nbsp;example&nbsp;
&gt;&gt;&nbsp;a&nbsp;set&nbsp;of&nbsp;"for"&nbsp;cycle&nbsp;codes&nbsp;with&nbsp;complicated&nbsp;processing.&nbsp;Now&nbsp;I&nbsp;thought&nbsp;there&nbsp;are&nbsp;two&nbsp;problem.
&gt;&gt;&nbsp;First&nbsp;,&nbsp;the&nbsp;direvative&nbsp;checker&nbsp;tools&nbsp;can't&nbsp;deal&nbsp;with&nbsp;this&nbsp;situation&nbsp;because&nbsp;the&nbsp;complicated&nbsp;part&nbsp;1/x+3*x+4*x^3&nbsp;is&nbsp;not&nbsp;described&nbsp;directly.&nbsp;
&gt;&gt;&nbsp;The&nbsp;second&nbsp;problem&nbsp;is&nbsp;not&nbsp;easily&nbsp;to&nbsp;describe&nbsp;somewhat.
&gt;&gt;&nbsp;The&nbsp;variable&nbsp;x&nbsp;changes&nbsp;in&nbsp;every&nbsp;iteration,while&nbsp;I&nbsp;can't&nbsp;write&nbsp;1/x+3*x+4*x^3&nbsp;directly.So&nbsp;in&nbsp;every&nbsp;iteration&nbsp;I&nbsp;have&nbsp;to&nbsp;describe&nbsp;the&nbsp;&nbsp;1/x+3*x+4*x^3&nbsp;part&nbsp;using&nbsp;some&nbsp;codes&nbsp;every&nbsp;time&nbsp;.However,&nbsp;I&nbsp;found&nbsp;that&nbsp;the&nbsp;excution&nbsp;sequence&nbsp;is&nbsp;"eval_jac_g,eval_grad_f,eval_g,eval_f,eval_h"&nbsp;sometime,sometimes&nbsp;it&nbsp;is&nbsp;not&nbsp;this&nbsp;sequence.Now&nbsp;I&nbsp;don't&nbsp;know&nbsp;which&nbsp;part&nbsp;I&nbsp;should&nbsp;write&nbsp;these&nbsp;codes&nbsp;in,it&nbsp;should&nbsp;be&nbsp;in&nbsp;the&nbsp;eval_f?&nbsp;or&nbsp;eval_g?&nbsp;or&nbsp;in&nbsp;eval_grad_f?eval_jac?eval_h?.
&gt;&gt;&nbsp;I&nbsp;don't&nbsp;know&nbsp;the&nbsp;processing&nbsp;procedure&nbsp;during&nbsp;one&nbsp;iteration&nbsp;in&nbsp;Ipopt,those&nbsp;codes&nbsp;should&nbsp;used&nbsp;only&nbsp;once,I&nbsp;can't&nbsp;used&nbsp;those&nbsp;codes&nbsp;in&nbsp;eval_f&nbsp;,eval_g,eval_grad_f,eval_jac_g,eval_h&nbsp;all.
&gt;&gt;&nbsp;I&nbsp;don't&nbsp;know&nbsp;if&nbsp;I&nbsp;have&nbsp;described&nbsp;the&nbsp;problem&nbsp;clearly.I&nbsp;hope&nbsp;so.
&gt;&gt;&nbsp;Anyone&nbsp;can&nbsp;give&nbsp;some&nbsp;suggestion?Thank&nbsp;you&nbsp;very&nbsp;much&nbsp;in&nbsp;advance.&nbsp;
&gt;&gt;&nbsp;&nbsp;
&gt;&gt;&nbsp;&nbsp;
&gt;&gt;&nbsp;
&gt;&gt;&nbsp;
&gt;&gt;&nbsp;------------------------------------------------------------------------
&gt;&gt;&nbsp;
&gt;&gt;&nbsp;_______________________________________________
&gt;&gt;&nbsp;Ipopt&nbsp;mailing&nbsp;list
&gt;&gt;&nbsp;Ipopt@list.coin-or.org
&gt;&gt;&nbsp;http://list.coin-or.org/mailman/listinfo/ipopt
&gt;
&gt;
&gt;--&nbsp;
&gt;Stefan&nbsp;Vigerske
&gt;Humboldt&nbsp;University&nbsp;Berlin,&nbsp;Numerical&nbsp;Mathematics
&gt;http://www.math.hu-berlin.de/~stefan
</PRE><br><br><span title="neteasefooter"/></span>