<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi Andreas,<div><br></div><div>Thank you for your reply. In fact I used limited-memory as hessian_approximation because computing this with thousands variables by hand is hard.</div><div>I felt also that there was a wrong information... I set the number of constraints m as zero and the functions were like this:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">Bool eval_g(Index n, Number* x, Bool new_x,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Index m, Number* g, UserDataPtr user_data)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">{</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">return</font><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">TRUE</font><font face="Arial" size="4" style="font: 13.0px Arial">;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">}</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Arial; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" color="#236e25" style="font: 13.0px Arial; color: #236e25">//-------------------------------------------------------------------------------------- jacobian of constraint functions</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">Bool eval_jac_g(Index n, Number *x, Bool new_x,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Index m, Index nele_jac,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Index *iRow, Index *jCol, Number *values,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> UserDataPtr user_data)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">{ </span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">return</font><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">TRUE</font><font face="Arial" size="4" style="font: 13.0px Arial">;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">}</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Arial; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" color="#236e25" style="font: 13.0px Arial; color: #236e25">//-------------------------------------------------------------------------------------- hessian of lagrangian</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">Bool eval_h(Index n, Number *x, Bool new_x, Number obj_factor,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Index m, Number *lambda, Bool new_lambda,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Index nele_hess, Index *iRow, Index *jCol,</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> Number *values, UserDataPtr user_data)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">{</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">return</font><font face="Arial" size="4" style="font: 13.0px Arial"> </font><font face="Arial" size="4" color="#760f50" style="font: 13.0px Arial; color: #760f50">FALSE</font><font face="Arial" size="4" style="font: 13.0px Arial">; </font><font face="Arial" size="4" color="#236e25" style="font: 13.0px Arial; color: #236e25">// use quasi-Newton approximation in options</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial">}</font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">I set also:</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Arial" size="4" style="font: 13.0px Arial"> AddIpoptStrOption(nlp, </font><font face="Arial" size="4" color="#891315" style="font: 13.0px Arial; color: #891315">"check_derivatives_for_naninf"</font><font face="Arial" size="4" style="font: 13.0px Arial">, </font><font face="Arial" size="4" color="#891315" style="font: 13.0px Arial; color: #891315">"yes"</font><font face="Arial" size="4" style="font: 13.0px Arial">);</font></div><div><br></div><div>but nothing appeared.</div><div><br></div><div>Could you tell me how to set correctly some parameters ? Or a simple example of such kind of optimization without constraints.</div><div><br></div><div>Thanks again,</div></span></font></div></div><div><br><div><div>On 24 Mar 2009, at 3:33 PM, Andreas Waechter wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">If you don't provide the Hessian for a nonlinear problem, you will have to choose the quasi-Newton approximation option</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">hessian_approximation limited-memory</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Maybe you are already doing this...?<span class="Apple-converted-space"> </span>What options are you setting?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">You say that you are solving a QP, so I assume that you already have the Hessian matrix somewhere.<span class="Apple-converted-space"> </span>Why do you not provide it to Ipopt? Convergence would probably quite a bit faster, unless the Hessian is dense.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The error you describe looks like there is some wrong information provided to Ipopt (e.g., if NaN ends up in Hessian entries and you didn't choose a Hessian approximation).<span class="Apple-converted-space"> </span>Did you run your code through a memory checker (like valgrind)?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Andreas</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On Tue, 24 Mar 2009, Tran Minh Tuan wrote:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> <blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi all,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I am using Ipopt to solve a quadratic optimization problem without</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">constraints (but only bound constraints on variables).</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">In this case, the constraint number is set to zero, the gradient of</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">the objective function is computed but the hessain is not.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">So the result is like that all the time:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">====</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">iter<span class="Apple-converted-space"> </span>objective<span class="Apple-converted-space"> </span>inf_pr <span class="Apple-converted-space"> </span>inf_du lg(mu)<span class="Apple-converted-space"> </span>||d||<span class="Apple-converted-space"> </span>lg(rg) alpha_du</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">alpha_pr<span class="Apple-converted-space"> </span>ls</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space"> </span>0<span class="Apple-converted-space"> </span>2.0416444e+01 0.00e+00 5.95e+00 <span class="Apple-converted-space"> </span>0.0 0.00e+00<span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>0.00e+00</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">0.00e+00 <span class="Apple-converted-space"> </span>0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space"> </span>1<span class="Apple-converted-space"> </span>1.6443076e+01 0.00e+00 1.21e+01<span class="Apple-converted-space"> </span>-6.2 5.95e+00<span class="Apple-converted-space"> </span>-4.0 1.00e+00</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">4.06e-01f<span class="Apple-converted-space"> </span>1</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ERROR: Problem in step computation, but emergency mode cannot be</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">activated.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">.....</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Number of inequality constraint Jacobian evaluations = 0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Number of Lagrangian Hessian evaluations <span class="Apple-converted-space"> </span>= 0</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Total CPU secs in IPOPT (w/o function evaluations) <span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span>0.009</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Total CPU secs in NLP function evaluations <span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span>0.000</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">EXIT: Error in step computation (regularization becomes too large?)!</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Objective value</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">f(x*) = 1.644308e+01</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">====</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I am wondering that in this kind of optimization, we MUST provide the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">hessain matrix ? ou there is something wrong somewhere ?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Your experience would help me much,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Ipopt mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:Ipopt@list.coin-or.org">Ipopt@list.coin-or.org</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://list.coin-or.org/mailman/listinfo/ipopt">http://list.coin-or.org/mailman/listinfo/ipopt</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> </blockquote></blockquote></div><br></div></body></html>