[Ipopt] IPOpt in C++: incorporating data into MyNLB ....

Andreas Baumgart Andreas.Baumgart at elbe-domizil.de
Thu Nov 11 14:41:17 EST 2010


  Dear All,

I am employing IPOpt for larger problems and have to read data from a 
file to be passed to IPOpt.
However, I have not managed to do it properly yet. Here is what I would 
like to do:

I have included a class CData in your MyNLP (see snippet c) below),
which has an Initialize()-method (see snippet b)).

The compiler comes back with the message "no member named 'Data' (see 
snippet a)).
I have only found examples with explicit direct declaration of problems.
What am I doing wrong? Is it related to the public / private part (which 
I don't understand)?
And then: how do I get my data into your mynlp instance?

Best regards and many thanks,

Andreas


a)
begin 
snippet:++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In function "int main(int, char**)":
[...]: error: class Ipopt::SmartPtr<Ipopt::TNLP> has no member named "Data"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++:end 
snippet

b)
begin 
snippet:++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   SmartPtr<TNLP> mynlp = new MyNLP();
   mynlp.Data.Initialize(job, model);   // I also tried 
mynlp->Data.Initialize(job, model);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++:end 
snippet

c)
begin 
snippet:++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// $Id: MyNLP.hpp 949 2007-03-27 00:41:26Z andreasw $
// Authors:  Carl Laird, Andreas Waechter     IBM    2004-11-05
  [...]
class MyNLP : public TNLP
{
public:

   /* data */
   CData Data;

   /** default constructor */
   MyNLP();

  [...]
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++:end 
snippet



More information about the Ipopt mailing list