<p dir="ltr">Hi, <br>
At least one thing even if you don&#39;t have constraints the Hessian is not empty. You still have to give second derivatives for your objective function.<br>
Then are you sure you are also giving correctly the gradient of the objective? <br>
Good luck, <br>
Pierre</p>
<div class="gmail_quote">On Nov 5, 2014 6:14 PM, &quot;Ramesh, Ujwal (rameshul)&quot; &lt;<a href="mailto:rameshul@mail.uc.edu">rameshul@mail.uc.edu</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
<br>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span style="font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi All,</p>
<p><br>
</p>
<p>Sorry for the delayed response. I was trying to debug using valgrind. Also apologize for the log detailed mail.
<br>
</p>
<p><br>
</p>
<p>Let me first a give a little background. </p>
<p><br>
</p>
<p>I was originally using wnnlp (Will Naylor Non linear solver) to solve my non linear problem. As I wanted to include Mixed integer variables, I am migrating my problem to Bonmin.
</p>
<p><br>
</p>
<p>To start with I am not including my mixed integer variables and setting up Bonmin to run the nonlinear part like in wnnlp.  (I have reused functions from my wnnlp and hence I know that there are no errors in calculating objective and gradients).
<br>
</p>
<p><br>
</p>
<p>Also, I am first trying to solve an unconstrained optimization problem and eventually include constraints.</p>
<p><br>
</p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif">I am looking at
<span style="font-family:&#39;Courier New&#39;,monospace"> ~/Bonmin-1.7/Bonmin/examples/CppExample </span>to build my application. </span></p>
<p><br>
<span style="font-family:Calibri,Arial,Helvetica,sans-serif"></span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif">Likewise, The below are the snippets of my code for an unconstrained NLP minimization.</span></p>
<p><br>
</p>
<p>The belew describes the hierarchy I have used to interface the solver:</p>
<p><br>
<span style="font-family:Calibri,Arial,Helvetica,sans-serif"></span></p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">using namespace Ipopt;<br>
using namespace Bonmin;<br>
class Design : public TMINLP { <br>
 private:<br>
</span></p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">... </span></p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">..</span></p>
<p><br>
</p>
<p>The below is the get_nlp_info subroutine for my unconstrained problem</p>
<p><br>
</p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">bool Design::get_nlp_info(Index&amp; n, Index&amp;m, Index&amp; nnz_jac_g,Index&amp; nnz_h_lag, TNLP::IndexStyleEnum&amp; index_style){</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">std::vector&lt;Cell *&gt; cellsToSolve;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">getNLPCellsToSolveNew ((*this),cellsToSolve);</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">int size = 2*(cellsToSolve.size());</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">n = size;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">m=0;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">nnz_jac_g = 0;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">nnz_h_lag = 0;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">index_style = TNLP::FORTRAN_STYLE;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">return true;</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">}</span><br>
<br>
</p>
<p>The below are the functions for constraints. As I am trying the unconstrained optimization first, i am not initializing anything: (
<strong>I need more insight here as to whether this could be the cause of my memory leak</strong>)
<br>
</p>
<p><br>
</p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">bool Design::eval_g(Index n, const Number* x, bool new_x, Index m, Number* g){return true;}<br>
<br>
bool Design::eval_jac_g(Index n, const Number* x, bool new_x,<br>
                        Index m, Index nele_jac, Index* iRow, Index *jCol,<br>
                        Number* values){return true;}<br>
<br>
bool Design::eval_h(Index n, const Number* x, bool new_x,<br>
                        Number obj_factor, Index m, const Number* lambda,<br>
                        bool new_lambda, Index nele_hess, Index* iRow,<br>
                        Index* jCol, Number* values){return true;}<br>
<br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif">The below snippet is of the error and valgrind report:</span></p>
<p><br>
</p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">Cbc3007W No integer variables - nothing to do
<br>
<br>
******************************************************************************<br>
This program contains Ipopt, a library for large-scale nonlinear optimization.<br>
 Ipopt is released as open source code under the Eclipse Public License (EPL).<br>
         For more information visit <a href="http://projects.coin-or.org/Ipopt" target="_blank">http://projects.coin-or.org/Ipopt</a><br>
******************************************************************************</span></p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">NLP0014I             3      FAILED 1.2952534e+08     3000 291.55422</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">Problem status: 5</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">Objective value: 1.79769e+308</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">*** glibc detected *** ./../../code/the_exec-g: double free or corruption (out): 0x00007fff63b1f3d0 ***</span><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>and the valgrind report has the kind of errors like below:</p>
<p><br>
</p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">==26498== Conditional jump or move depends on uninitialised value(s)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    at 0x5F2E414: Ipopt::OptimalityErrorConvergenceCheck::CurrentIsAcceptable() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5ED04E1: Ipopt::BacktrackingLineSearch::FindAcceptableTrialPoint() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5EEC8C0: Ipopt::IpoptAlgorithm::Optimize(bool) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7A1F3: Ipopt::IpoptApplication::call_optimize() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7DF6C: Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr&lt;Ipopt::NLP&gt; const&amp;, Ipopt::SmartPtr&lt;Ipopt::AlgorithmBuilder&gt;&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7EF17: Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr&lt;Ipopt::NLP&gt; const&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E79D59: Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtr&lt;Ipopt::TNLP&gt; const&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EF5E84: Bonmin::IpoptSolver::OptimizeTNLP(Ipopt::SmartPtr&lt;Ipopt::TNLP&gt; const&amp;) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EDA733: Bonmin::OsiTMINLPInterface::solveAndCheckErrors(bool, bool, char const*) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EDC126: Bonmin::OsiTMINLPInterface::initialSolve(char const*) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x51E82D6: CbcModel::initialSolve() (in /usr/lib/libCbc.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4E6FE69: Bonmin::Bab::branchAndBound(Bonmin::BabSetupBase&amp;) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==  Uninitialised value was created by a stack allocation</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    at 0x4690E1: Design::eval_grad_f(int, double const*, bool, double*) (DesignTMINLP.cxx:185)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace"></span></p>
<p><br>
<span style="font-family:&#39;Courier New&#39;,monospace"></span></p>
<p><span style="font-family:&#39;Courier New&#39;,monospace">==26498== Use of uninitialised value of size 8</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    at 0x5FC6D10: Ipopt::DenseVector::AmaxImpl() const (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5ECCBF1: Ipopt::BacktrackingLineSearch::DetectTinyStep() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5ED0575: Ipopt::BacktrackingLineSearch::FindAcceptableTrialPoint() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5EEC8C0: Ipopt::IpoptAlgorithm::Optimize(bool) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7A1F3: Ipopt::IpoptApplication::call_optimize() (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7DF6C: Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr&lt;Ipopt::NLP&gt; const&amp;, Ipopt::SmartPtr&lt;Ipopt::AlgorithmBuilder&gt;&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E7EF17: Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr&lt;Ipopt::NLP&gt; const&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x5E79D59: Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtr&lt;Ipopt::TNLP&gt; const&amp;) (in /usr/lib/libipopt.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EF5E84: Bonmin::IpoptSolver::OptimizeTNLP(Ipopt::SmartPtr&lt;Ipopt::TNLP&gt; const&amp;) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EDA733: Bonmin::OsiTMINLPInterface::solveAndCheckErrors(bool, bool, char const*) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x4EDC126: Bonmin::OsiTMINLPInterface::initialSolve(char const*) (in /usr/lib/libbonmin.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    by 0x51E82D6: CbcModel::initialSolve() (in /usr/lib/libCbc.so.0)</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==  Uninitialised value was created by a stack allocation</span><br style="font-family:&#39;Courier New&#39;,monospace">
<span style="font-family:&#39;Courier New&#39;,monospace">==26498==    at 0x4690E1: Design::eval_grad_f(int, double const*, bool, double*) (DesignTMINLP.cxx:185)</span><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>As per the above report, the uninitialized value is created by the function eval_grad_f() , but I am using the same function for wnnlp and it works just fine. I tried stepping into the program using gdb but as I am interfacing using *.so files, gdb is not
 letting me do it.<br>
</p>
<p> </p>
<p>Any inputs will definitely help.</p>
<p><br>
</p>
<p>Thanks in advance.</p>
<p><br>
</p>
<p>Regards,</p>
<div>
<div style="font-family:Tahoma;font-size:13px"><font face="Verdana" size="4">Ujwal Ramesh</font>
<div><font face="Verdana">Graduate Student,</font></div>
<div><font face="Verdana">University Of Cincinnati</font></div>
<div><font face="Verdana">Ph: <a href="tel:%2B1-513-302-4771" value="+15133024771" target="_blank">+1-513-302-4771</a></font></div>
</div>
</div>
<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Ramesh, Ujwal (rameshul)<br>
<b>Sent:</b> Wednesday, October 29, 2014 2:45 PM<br>
<b>To:</b> Tony Kelman; <a href="mailto:bonmin@list.coin-or.org" target="_blank">bonmin@list.coin-or.org</a><br>
<b>Subject:</b> Re: [Bonmin] Unconstrained MINLP</font>
<div> </div>
</div>
<div>
<p>Sure Tony,</p>
<p><br>
</p>
<p>I will provide that soon.</p>
<p><br>
</p>
<p>Thanks and regards,</p>
<div>
<div style="font-family:Tahoma;font-size:13px"><font face="Verdana" size="4">Ujwal Ramesh</font>
<div><font face="Verdana">Graduate Student,</font></div>
<div><font face="Verdana">University Of Cincinnati</font></div>
<div><font face="Verdana">Ph: <a href="tel:%2B1-513-302-4771" value="+15133024771" target="_blank">+1-513-302-4771</a></font></div>
</div>
</div>
<div dir="ltr" style="font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;color:#000000;background-color:#ffffff">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Tony Kelman &lt;<a href="mailto:kelman@berkeley.edu" target="_blank">kelman@berkeley.edu</a>&gt;<br>
<b>Sent:</b> Wednesday, October 29, 2014 2:43 PM<br>
<b>To:</b> Ramesh, Ujwal (rameshul); <a href="mailto:bonmin@list.coin-or.org" target="_blank">bonmin@list.coin-or.org</a><br>
<b>Subject:</b> Re: [Bonmin] Unconstrained MINLP</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div style="font-size:12pt;font-family:&#39;Calibri&#39;;color:#000000">
<div>I think you’ll have to provide some simple example code of what you’re trying to do, and the error message in its entirety, for anyone to be able to tell exactly where the problem lies.</div>
<div> </div>
<div style="font-size:small;text-decoration:none;font-family:&quot;Calibri&quot;;font-weight:normal;color:#000000;font-style:normal;display:inline">
<div style="font:10pt tahoma">
<div> </div>
<div style="background:#f5f5f5">
<div><b>From:</b> <a title="rameshul@mail.uc.edu" href="mailto:rameshul@mail.uc.edu" target="_blank">
Ramesh, Ujwal (rameshul)</a> </div>
<div><b>Sent:</b> Wednesday, October 29, 2014 11:39 AM</div>
<div><b>To:</b> <a title="bonmin@list.coin-or.org" href="mailto:bonmin@list.coin-or.org" target="_blank">
bonmin@list.coin-or.org</a> </div>
<div><b>Subject:</b> [Bonmin] Unconstrained MINLP</div>
</div>
</div>
<div> </div>
</div>
<div style="font-size:small;text-decoration:none;font-family:&quot;Calibri&quot;;font-weight:normal;color:#000000;font-style:normal;display:inline">
<p>Hi All,</p>
<p> </p>
<p>I am trying to run Bonmin for my application which is an unconstrained MINLP. I am calling Bonmin through a C++ interface. 
</p>
<p> </p>
<p>To invoke Bonmin, I need to define a few virtual functions inm y code. </p>
<p> </p>
<p>As my application is an unconstrained MINLP, I will not be defining the constraint variables, constraint functions,function to compute jacobian and the function to compute the hessian of the
<span>Lagrangean ( eval_g, eval_jac_g,eval_h etc. ).</span></p>
<p><br>
<span></span></p>
<p>By not defining the above function I am initializing the respective vectors, matrices and the variables (number of non zeros in jacobian and hessian ) to NULL but this is causing the solver to fail with a length error.</p>
<p> </p>
<p>I am a rookie to optimization and any inputs as to what I am missing is much appreciated. I guess I am missing something conceptually as I have double checked syntactical/logical correctness of code. 
</p>
<p> </p>
<p>Thanks a lot in advance.</p>
<p> </p>
<p>Regards,</p>
<div>
<div style="font-size:13px;font-family:tahoma"><font face="Verdana" size="4">Ujwal Ramesh</font>
<div><font face="Verdana">Graduate Student,</font></div>
<div><font face="Verdana">University Of Cincinnati</font></div>
<div><font face="Verdana">Ph: <a href="tel:%2B1-513-302-4771" value="+15133024771" target="_blank">+1-513-302-4771</a></font></div>
</div>
</div>
<p></p>
<hr>
_______________________________________________<br>
Bonmin mailing list<br>
<a href="mailto:Bonmin@list.coin-or.org" target="_blank">Bonmin@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/bonmin" target="_blank">http://list.coin-or.org/mailman/listinfo/bonmin</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span></div>
</div>
</div>

<br>_______________________________________________<br>
Bonmin mailing list<br>
<a href="mailto:Bonmin@list.coin-or.org">Bonmin@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/bonmin" target="_blank">http://list.coin-or.org/mailman/listinfo/bonmin</a><br>
<br></blockquote></div>