Dear Roy,<br>To solve an .nl using bonmin as a library, you have to include the two following headers:<br>#include &quot;BonminAmplInterface.hpp&quot;<br>#include &quot;CbcBonmin.hpp&quot;<br><br>You should then use the five following lines of code:
<br><br>&nbsp; &nbsp; nlpSolver = new BonminAmplInterface(argv);//this reads the nl file and <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //fill the data structures necessary to solve the problem.<br>&nbsp;&nbsp;&nbsp; BonminCbcParam par; //this initialize a strucutre which reads the parameter in the
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // bonmin.opt file<br>&nbsp;&nbsp;&nbsp; BonminBB bb; // This initialize the structure for the branch-and-bound (the b&amp;b is <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // driven by cbc.<br>&nbsp;&nbsp;&nbsp; par(*nlpSolver);// Read the parameters
<br>&nbsp;&nbsp;&nbsp; bb(*nlpSolver, par);//do branch and bound<br><br>You can then access the results of the branch-and-bound through the BonminBB class (you can see the .hpp file in Bonmin/src/CbcBonmin/ or the doxygen documentation for it).
<br><br>This is if you use the latest stable version of Bonmin (0.1).<br><br>For the integral I am not sure how it works with ampl. My guess is that if you code&nbsp; the function it would be in a dll file which has to be in the directory where you run the model. What I am sure is that you don&#39;t have to modify bonmin code to get it to work.
<br><br>Best regards,<br>Pierre<br><br><div><span class="gmail_quote">On 1/10/07, <b class="gmail_sendername">Roy Chen</b> &lt;<a href="mailto:ytboy0208@gmail.com">ytboy0208@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Hi, Pierre</div>
<div>&nbsp;</div>
<div>Thanks a lot for you helpful response. My question now is how to read an .nl file and solve it with Bonmin in a custom C++ application? Can integral be part of the .nl file after I import directly the integral function into AMPL?
</div>
<div>&nbsp;</div>
<div>Regards,</div><span class="sg">
<div>&nbsp;</div>
<div>Roy<br><br>&nbsp;</div></span><div><span class="e" id="q_1100f6667b5185ad_2">
<div><span class="gmail_quote">On 1/10/07, <b class="gmail_sendername">Pierre Bonami</b> &lt;<a href="mailto:pierre.bonami@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">pierre.bonami@gmail.com
</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Dear Roy,<br>Sorry I could not answer to your questions before.<br>The CppExample is just a small example of modeling an MINLP through the C++ interface to Bonmin but bonmin understands AMPL files an it is the simplest way to use it. When you build and install the program with make install, you will find an executable bonmin in the bin subdirectory which reads .nl files. 
<br><br>If what you want to do is read an .nl file and solve it with Bonmin in a custom C++ application it is also possible. <br><br>For your problem of integration. In theory Bonmin should be able to do something with your problem if you provide functions for computing first and second order derivatives for your integral. I think that the most simple way is to import directly the function into ampl (see for example funclink subdirectory in the ASL library and the readme file here 
<a href="http://www.netlib.org/ampl/solvers/funclink/README" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.netlib.org/ampl/solvers/funclink/README</a>).<br><br>I hope that this somewhat answer your question. If you want more details, please tell me.
<br><br>Best regards,<br>Pierre<br>
<div>
<div><span><span class="gmail_quote">On 1/10/07, <b class="gmail_sendername">Roy Chen</b> &lt;<a href="mailto:ytboy0208@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ytboy0208@gmail.com</a>&gt; wrote:</span></span></div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><span>
<div>Hello everyone</div>
<div>&nbsp;</div>
<div>
<div>I reviewed the C++ application named CppExample in Bonmin package. It&#39;s an application of a very small problem, and I noticed that detailed description and definition of this problem was used in C++ code. Since it will be so time consuming if you need to define every problem using that detailed way, therefore, can Bonmin accept kind of standard input file format such as .nl in C++ code application? 
</div>
<div>&nbsp;</div>
<div>Like what I asked you last time, for MINLP problem with integration in the objective function, can Bonmin handle it if I code those integration part by myself? Does Bonmin provide this kind of interface?</div>
<div>&nbsp;</div>
<div>Best</div><span>
<div>&nbsp;</div>
<div>Roy<br>&nbsp;</div></span></div></span></div><br>_______________________________________________<br>Bonmin mailing list<br><a href="mailto:Bonmin@list.coin-or.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Bonmin@list.coin-or.org</a><br><a href="http://list.coin-or.org/mailman/listinfo/bonmin" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://list.coin-or.org/mailman/listinfo/bonmin</a><br><br><br>

</blockquote></div><br></blockquote></div><br>

</span></div></blockquote></div><br>