Dan,<div><br></div><div>you seem to define an option called "jacobian" somewhere. Is there a file "ipopt.opt" in the directory you are executing the problem in? Ipopt will look for a file with that name and try to read option definitions from it. If there is such a file, move/rename it.</div>
<div><br></div><div>About your jacobian: With the option </div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">app->Options()->SetStringValue( "jacobian_approximation","finite-difference-values" );</div>
<div>you let Ipopt construct the jacobian from finite differences. Any code in your Ipopt::TNLP::eval_jac_g implementation will not be called. Try commenting all options except for the derivative checker.</div><div><br></div>
<div>If you are just running a model, it is generally a better idea to define the options in the separate ipopt.opt file - that way you don't have to recompile your problem just to change the parameters or turn the derivative checker off. Read about it here: <a href="http://www.coin-or.org/Ipopt/documentation/node55.html">http://www.coin-or.org/Ipopt/documentation/node55.html</a></div>
<div>If you read options from a file, make absolutely sure, that there is a new line at the end of the file. </div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>hope this helps</div>
<div><br></div><div>Hans<br><br><div class="gmail_quote">On Wed, Feb 9, 2011 at 2:01 PM, Dan <span dir="ltr"><<a href="mailto:yanndan@yahoo.com">yanndan@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><font face="arial" size="2">Thank you Hans for your answer.</font><div style="font-family:arial;font-size:10pt"><br></div>
<div style="font-family:arial;font-size:10pt">I am running this program under ubuntu 10.04 coding with CodeBlocks 8.02.</div><div style="font-family:arial;font-size:10pt">I tried your idea of using Valgrind. Code::Blocks does not seem to redirect all the printings to the terminal. Thanks to valgrind, I was able to see an error message I was missing for a long time.</div>
<div><div><font face="arial" size="2">:</font></div><div><font face="arial" size="2">**********************************************************************</font></div><div><font face="arial" size="2">Exception of type: OPTION_INVALID in file
"../../../../Ipopt/src/Common/IpOptionsList.cpp" at line 638:</font></div><div><font face="arial" size="2"> Exception message: Read Option: "jacobian". It is not a valid option. Check the list of available options.</font></div>
<div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2">*** Error during initialization!</font></div><div style="font-family:arial;font-size:10pt">
*********************************************************************</div></div><div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">This error seems to come from the piece of code below. I now have an exit error if initialization does not suceed. It is strange this error occurs in this code. </div>
<div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">When I coded my example in hs_071 way, the same piece of code does not return any error.</div><div style="font-family:arial;font-size:10pt">
***********************************************************************</div><div><div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2">// Create an instance of the IpoptApplication</font></div>
<div><font face="arial" size="2">//</font></div><div><font face="arial" size="2">// We are using the factory, since this allows us to compile this</font></div><div><font face="arial" size="2">// example with an Ipopt Windows DLL</font></div>
<div><font face="arial" size="2">SmartPtr<IpoptApplication> app = IpoptApplicationFactory();</font></div><div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2">// Change some options</font></div>
<div><font face="arial" size="2">// Note: The following choices are only examples, they might not be</font></div><div><font face="arial" size="2">// suitable for your optimization problem.</font></div><div><font face="arial" size="2">app->Options()->SetNumericValue("tol", 1e-7);</font></div>
<div><font face="arial" size="2">app->Options()->SetStringValue("mu_strategy", "adaptive");</font></div><div><font face="arial" size="2">app->Options()->SetStringValue("output_file", "ipopt.out");</font></div>
<div><font face="arial" size="2">app->Options()->SetStringValue(
"jacobian_approximation","finite-difference-values" );</font></div><div><font face="arial" size="2">app->Options()->SetStringValue( "derivative_test","first-order" );</font></div>
<div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2">// Intialize the IpoptApplication and process the options</font></div><div><font face="arial" size="2">ApplicationReturnStatus status;</font></div>
<div><font face="arial" size="2">status = app->Initialize();</font></div><div><font face="arial" size="2">if (status != Solve_Succeeded) {</font></div><div><font face="arial" size="2">printf("\n\n*** Error during initialization!\n");</font></div>
<div><font face="arial" size="2">exit(-1);</font></div><div><font face="arial" size="2">}</font></div><div style="font-family:arial;font-size:10pt"><br></div></div><div style="font-family:arial;font-size:10pt">*******************************************************************************************</div>
<div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">I do not understand why there is an initialization problem in this case. I run valgrind to see if there was any memory leak. The code previous at this step of initialization does not seem to have any. </div>
<div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">If you have any idea how to solve this initialization bug, I will be glad to know them.</div><div style="font-family:arial;font-size:10pt">
<br></div><div style="font-family:arial;font-size:10pt">Best Regards, </div><div style="font-family:arial;font-size:10pt">Dan</div><div style="font-family:arial;font-size:10pt"><br></div><div><font face="arial" size="2"><br>
</font><br><font face="arial" size="2">--- En date de : </font><b style="font-family:arial;font-size:10pt">Mer 9.2.11, Hans Pirnay <i><<a href="mailto:hans.pirnay@rwth-aachen.de" target="_blank">hans.pirnay@rwth-aachen.de</a>></i></b><font face="arial" size="2"> a écrit :</font><br>
<blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16, 16, 255);margin-left:5px;padding-left:5px;font-family:arial;font-size:10pt"><br>De: Hans Pirnay <<a href="mailto:hans.pirnay@rwth-aachen.de" target="_blank">hans.pirnay@rwth-aachen.de</a>><br>
Objet: Re: [Ipopt] Problems in models in C++<br>À: "Dan" <<a href="mailto:yanndan@yahoo.com" target="_blank">yanndan@yahoo.com</a>><br>Cc: <a href="mailto:ipopt@list.coin-or.org" target="_blank">ipopt@list.coin-or.org</a><br>
Date: Mercredi 9 février 2011, 11h37<br><br><div>If you are on linux: use valgrind to figure out if your problems may be due to uninitialized values<br><br><div>On Wed, Feb 9, 2011 at 10:57 AM, Dan <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=yanndan@yahoo.com" target="_blank">yanndan@yahoo.com</a>></span> wrote:<br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><font face="arial" size="2">Dear all,</font><div style="font-family:arial;font-size:10pt">
<br></div><div style="font-family:arial;font-size:10pt">I have a problem with the C++ Interface. I am currently coding some network models. I tried to model a small instance like the hs_071 example and it went well.</div>
<div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">I coded my network in term of functions that my TNLP class will called if needed. </div><div style="font-family:arial;font-size:10pt">
When I run it, it does not find a solution and it goes into a loop.I caught this message run by IPOPT:</div><div style="font-family:arial;font-size:10pt">"WARNING : Problem in step computation; switching to emergency code."</div>
<div style="font-family:arial;font-size:10pt"><br></div><div style="font-family:arial;font-size:10pt">In order to solve my problem, I tried several thing including the derivative checker and two weird things appears:</div>
<div><ul><li><font face="arial" size="2">my jacobian is not dense. I can not figure why. I checked at almost step and I can not find why the derivative checker of my jacobian is dense.</font></li><li><font face="arial" size="2">the value found by the derivative checker are eccentric. It says mine are wrong while they are not. It is a adjacency matrix so it is only 1 and -1.</font></li>
</ul><div><font face="arial" size="2">If you have any ideas to solve my problem of ways to find my errors, I would greatly appreciate.</font></div></div><div><font face="arial" size="2"><br></font></div><div><font face="arial" size="2">Best
Regards,</font></div><div><font face="arial" size="2">Dan</font></div></td></tr></tbody></table><font color="#888888"><br>
</font><br>_______________________________________________<br>
Ipopt mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=Ipopt@list.coin-or.org" target="_blank">Ipopt@list.coin-or.org</a><br>
<a rel="nofollow" href="http://list.coin-or.org/mailman/listinfo/ipopt" target="_blank">http://list.coin-or.org/mailman/listinfo/ipopt</a><br>
<br></blockquote></div><br>
</div></blockquote></div></td></tr></tbody></table><br>
<br>_______________________________________________<br>
Ipopt mailing list<br>
<a href="mailto:Ipopt@list.coin-or.org">Ipopt@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/ipopt" target="_blank">http://list.coin-or.org/mailman/listinfo/ipopt</a><br>
<br></blockquote></div><br></div>