[Ipopt] Trying to run IPOPT C++ example

Wendel Melo wendelalexandre at gmail.com
Wed Aug 23 22:50:46 EDT 2017


> Do I need AMPL for the example?

No.

> Am I linking the files correctly?

No. I think the best way to do it is using the Makefile in the directory
${your_ipopt_build_path}/Ipopt/examples/hs071_cpp/.

You just have to do simple changes (e.g. the EXE and OBJS definitions).
You can take advantage this Makefile to build all your applications using
C++ interface.

> Is there a 'bare bones' C++ example that doesn't use smart pointers or
the IpoptApplicationFactory?

I am not sure, but I think IpoptApplicationFactory is really necessary in
the C++ interface. I believe it is possible adopt no smart pointers.


Regards

Wendel





2017-08-23 23:26 GMT-03:00 Alexander Martinez-Marchese <
alex.martinezmarchese at outlook.com>:

> Hi,
>
>
>       I'm trying to run the C++ example described here:
>
>
> https://www.coin-or.org/Ipopt/documentation/node23.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.coin-2Dor.org_Ipopt_documentation_node23.html&d=DwMFAw&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=AEWIZiNSSlppb_jyQKA8GtHkg2N4WiI7Ya5btonYBgA&m=ZQeH40ZHG9NwfMsxzGOm9crFiwZNdbp1D-HraEXQENU&s=VQRxhgqUJI4BKSd1gNC312YC5Bio3XpnudRchOg1kaY&e=>
>
>
>
> So I copied the files myexample.cpp, hs071_nlp.cpp and hs071_nlp.cpp and I
> run the following in the terminal (within Ubuntu linux):
>
>
> c++ -std=c++11 myexample.cpp hs071_nlp.cpp -o myexample -I
> /home/alex/Ipopt-3.12.8/include/coin
>
>
> And I get the following error:
>
>
> /tmp/ccIUQtXB.o: In function `main':
> myexample.cpp:(.text+0x52): undefined reference to
> `IpoptApplicationFactory'
> collect2: error: ld returned 1 exit status
>
>
>
> I tested my IPOPT installation using 'make test' and I get this:
>
>
> Running unitTests...
> Testing AMPL Solver Executable...
>     no AMPL solver executable found, skipping test...
> Testing C++ Example...
>     Test passed!
> Testing C Example...
>     Test passed!
> Testing Fortran Example...
>     Test passed!
> make[2]: Leaving directory '/home/alex/Ipopt-3.12.8/Ipopt/test'
> make[1]: Leaving directory '/home/alex/Ipopt-3.12.8/Ipopt'
>
> Do I need AMPL for the example? Am I linking the files correctly? Is there
> a 'bare bones' C++ example that doesn't use smart pointers or the
> IpoptApplicationFactory?
>
>
> I am able to use IPOPT from pyipopt to solve l-bfgs-b problems. The IPOPT
> installation was installed with the HSL files:
> http://www.hsl.rl.ac.uk/ipopt/
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.hsl.rl.ac.uk_ipopt_&d=DwMFAw&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=AEWIZiNSSlppb_jyQKA8GtHkg2N4WiI7Ya5btonYBgA&m=ZQeH40ZHG9NwfMsxzGOm9crFiwZNdbp1D-HraEXQENU&s=qADmP8Rclh0Q6kTBikgNgeak4Pg5HZyeAGKJt2-o_M0&e=>
>
>
>
> Thank you,
>
> Alex
>
>
>
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.
> coin-2Dor.org_mailman_listinfo_ipopt&d=DwICAg&c=Ngd-
> ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=AEWIZiNSSlppb_
> jyQKA8GtHkg2N4WiI7Ya5btonYBgA&m=ZQeH40ZHG9NwfMsxzGOm9crFiwZNdb
> p1D-HraEXQENU&s=zTRKLH_Pb24IsUPAeBx1kZh0vYqZA9sfNBMwStyYqlA&e=
>
>


-- 
Wendel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20170823/492eba68/attachment.html>


More information about the Ipopt mailing list