[Ipopt] Where to find hs071_nlp.hpp?
Paul van Hoven
paul.van.hoven at googlemail.com
Tue Jun 7 04:33:22 EDT 2011
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;
}
More information about the Ipopt
mailing list