[Ipopt] Where to find hs071_nlp.hpp?
Paul van Hoven
paul.van.hoven at googlemail.com
Wed Jun 8 07:10:42 EDT 2011
Ah, okay! Thanks for the hint. I completly missed that :)
2011/6/7 Andreas Waechter <andreasw at watson.ibm.com>:
> Hi Paul,
>
> hs071_nlp.hpp is the header file from the example in
> Ipopt/examples/hs071_cpp. At some point you will need to implement your
> version of the TNLP class (to be given to the app->OptimizeTNLP method), and
> create a header for that. That would be the replacement of hs071_nlp.hpp in
> your context.
>
> Andreas
>
> On Tue, 7 Jun 2011, Paul van Hoven wrote:
>
>> Hi!
>>
>> I successfully compiled and installed IPOpt and until now I used the
>> matlab interface to do my calculation. This works really fine!
>>
>> But now I need to use IPOpt in a C++ environment. To get familiar with
>> the C++ interface I wanted to understand the tutorial posted in the
>> ipopt documentation. So I started with the following piece of code:
>>
>>
>> #include "IpIpoptApplication.hpp"
>> #include "hs071_nlp.hpp"
>>
>> using namespace Ipopt;
>>
>> int main(int argv, char* argc[])
>> {
>>
>> SmartPtr<TNLP> mynlp = new HS071_NLP();
>>
>> SmartPtr<IpoptApplication> app = IpoptApplicationFactory();
>>
>> return 0;
>> }
>>
>> And here is my Makefile
>>
>> CXX = g++
>> CFLAGS =
>> IPOPT_HOME = /path/to/Ipopt/include/coin
>> THIRD_PARTY = /path/to/Ipopt/include/coin/ThirdParty
>>
>> LIBS = -lm -ldl -L/path/to/Ipopt/lib/coin -lipopt
>> -L/path/to/Ipopt/lib/coin/ThirdParty -lcoinblas -lcoinlapack -lcoinhsl
>> INCLUDE = -I$(IPOPT_HOME) -I$(THIRD_PARTY)
>>
>> TARGET = IPOptDemo
>>
>> all:$(TARGET)
>> $(TARGET): $(TARGET).o
>> $(CXX) $(LIBS) -o $(TARGET) $^
>> rm *.o
>>
>>
>> $(TARGET).o: $(TARGET).cpp
>> $(CXX) $(CFLAGS) $(INCLUDE) -c $^
>>
>> clean:
>> rm *.o $(TARGET)
>>
>> The problem is that I get the following error message when trying to
>> compile the code above:
>> make
>> g++ -I/hpath/to/Ipopt/include/coin
>> -I/path/to/Ipopt/include/coin/ThirdParty -c IPOptDemo.cpp
>> IPOptDemo.cpp:2:25: fatal error: hs071_nlp.hpp: No such file or directory
>> compilation terminated.
>> make: *** [IPOptDemo.o] Error 1
>>
>> But I can't find hs071_nlp.hpp anywhere. Can anybody tell me what I
>> have to do to get this running?
>>
>>
>>
>> BTW: This code here compiles fine
>> //#include "hs071_nlp.hpp"
>>
>> using namespace Ipopt;
>>
>> int main(int argv, char* argc[])
>> {
>> // Create a new instance of your nlp
>> // (use a SmartPtr, not raw)
>> //SmartPtr<TNLP> mynlp = new HS071_NLP();
>>
>> // Create a new instance of IpoptApplication
>> // (use a SmartPtr, not raw)
>> // We are using the factory, since this allows us to compile this
>> // example with an Ipopt Windows DLL
>> SmartPtr<IpoptApplication> app = IpoptApplicationFactory();
>>
>> return 0;
>> }
>>
>> _______________________________________________
>> Ipopt mailing list
>> Ipopt at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/ipopt
>>
>>
>
More information about the Ipopt
mailing list