[Coin-ipopt] A problem using IPOPT with QT library

Yang Liu xueyuhanlang at gmail.com
Wed Jul 5 13:37:49 EDT 2006


Dear Andreas,

Thanks your reply.

I found it is not the problem of QT,  I also tried IPOPT in Windows-MFC program,
i.e.  Use visual studio to create a MFC program or a general Win32
program,  but not a console program.  I found IPOPT cannot work if I
linked the static library.

Currently I add all the IPOPT source into my project,  it works well.

So I want to know whether someone has integrated IPOPT into their
program (not a console problem) by linking IPOPT library.

Thanks.

Best,

Yang Liu

On 7/6/06, Andreas Waechter <andreasw at watson.ibm.com> wrote:
> Hi Yang,
>
> I have no experience with QT, and I don't know why the contructor would
> fail.  Maybe someone else reading this mailing list has an idea?
>
> Andreas
>
> On Tue, 4 Jul 2006, Yang Liu wrote:
>
> > Dear all,
> >
> > Does anyone use IPOPT in QT(Trolltech QT GUI library) program?
> >
> > My program always failed in the constructor of IpoptApplication.
> >
> > I traced back to ipipoptapplication.cpp,  and I found the variables
> > jnlst_, options_  are not created by new operator.
> >
> > IpoptApplication::IpoptApplication(bool create_console_out)
> >     :
> >     jnlst_(new Journalist()),
> >     options_(new OptionsList()),
> >     statistics_(NULL),
> >     alg_(NULL),
> >     nlp_adapter_(NULL)
> >
> >
> > The problem only occurs in QT environment.
> >
> > The following is my main code.
> >
> > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> > #include <QtGui/QApplication>
> > #include "qtest.h"
> > #include "IpIpoptApplication.hpp"
> > #include "IpSolveStatistics.hpp"
> > #include "MyNLP.hpp"  //The example from Itopt library using namespace Ipopt;
> >
> > int main(int argc, char *argv[])
> > {
> >
> >       // Create an instance of your nlp...
> >       SmartPtr<TNLP> mynlp = new MyNLP();
> >
> >       // Create an instance of the IpoptApplication
> >               //The program failed here
> >       SmartPtr<IpoptApplication> app = new IpoptApplication();
> >               // Initialize the IpoptApplication and process the options
> >       app->Initialize();
> >
> >       ApplicationReturnStatus status = app->OptimizeTNLP(mynlp);
> >
> >
> >   QApplication a(argc, argv);
> >   qtest w;
> >   w.show();
> >   a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
> >   return a.exec();
> > }
> >
> > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> >
> > Many thanks.
> >
> >
> > Best regards,
> >
> > Yang Liu
> > PhD Candidate
> > Department of Computer Science,
> > The University of Hong Kong
> > _______________________________________________
> > Coin-ipopt mailing list
> > Coin-ipopt at list.coin-or.org
> > http://list.coin-or.org/mailman/listinfo/coin-ipopt
> >
>



More information about the Coin-ipopt mailing list