[Ipopt] intermediate_callback

Stefan Vigerske stefan at math.hu-berlin.de
Mon Jul 19 12:12:28 EDT 2010


Hi,

try adding
#include "IpIpoptData.hpp"

Stefan

Jochen Siehr wrote:
> Hi everybody:
> 
> I'm using IPOPT for my PhD project. For getting access to the primal
> variables after every iteration I'm using the method
> "intermediate_callback" (as suggested in earlier discussions in this
> mailing list) similar to
> 
> //----------------------
> OrigIpoptNLP* orignlp =
> dynamic_cast<OrigIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP()));
> TNLPAdapter* tnlp_adapter =
> dynamic_cast<TNLPAdapter*>(GetRawPtr(orignlp->nlp()));
> 
> double *x_current = new double[n];
> tnlp_adapter->ResortX(*(GetRawPtr(ip_data->curr()->x())), x_current);
> 
> for (Index i=0;i<n;i++)
> cout << x_current[i] << endl;
> 
> delete[] x_current;
> // ---------------------
> 
> 
> In IPOPT 3.6.0 everything works fine. But when I update to IPOPT 3.8.1
> the following error occurs during compilation
> 
> In member function 'virtual bool
> my_NLP::intermediate_callback(Ipopt::AlgorithmMode, Ipopt::Index,
> Ipopt::Number, Ipopt::Number, Ipopt::Number, Ipopt::Number,
> Ipopt::Number, Ipopt::Number, Ipopt::Number, Ipopt::Number,
> Ipopt::Index, const Ipopt::IpoptData*, Ipopt::IpoptCalculatedQuantities*)':
> my_problem.cpp:1510: error: invalid use of incomplete type 'const struct
> Ipopt::IpoptData'
> /home/jsiehr/Ipopt-3.8.1/include/coin/IpTNLP.hpp:23: error: forward
> declaration of 'const struct Ipopt::IpoptData'
> 
> which obviously means
> "tnlp_adapter->ResortX(*(GetRawPtr(ip_data->curr()->x())), x_current);"
> is not working anymore. I guess a change in ip_data causes the problem
> but I cannot figure out how to solve it.
> 
> Is there any short explanation and remedy, or even an easier way to the
> current variables by now?
> 
> Many thanks!
> Jochen
> 
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
> 


-- 
Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics
http://www.math.hu-berlin.de/~stefan



More information about the Ipopt mailing list