[Ipopt] intermediate_callback

Stefan Vigerske stefan at vigerske.de
Thu Nov 27 10:07:37 EST 2008


> Thank you for your reply, 
> this seems to me very non intuitive ;-), can you give me an example so that I get an array back like in the eval_f function ( eval_f(... const Number* x ...) )

OK, you caught me. I forgot to mention that you get the vector of the
"transformed" problem, i.e., not the problem as you specify in TNLP, but
with slacks included and fixed variables removed.
It's a bit tricky to sort the vector back into the TNLP space, since you
need the TNLPAdapter. This is what Andreas once told me how to get the
1. Use IpoptCalculatedQuantities::GetIpoptNLP() to get a pointer to an
2. Cast this Ipopt::IpoptNLP to an Ipopt::OrigIpoptNLP
3. Use Ipopt::OrigIpoptNLP::nlp() to get the Ipopt::NLP
4. This Ipopt::NLP is actually the TNLPAdapter

In code, this would be
OrigIpoptNLP* orignlp =
TNLPAdapter* tnlp_adapter =

Then you could use curr()->x() from IpoptData and ResortX from
TNLPAdapter to sort it back:

double* my_x = new double[... dimension in TNLP problem ...];
tnlp_adapter->ResortX(data->curr()->x(), my_x);


More information about the Ipopt mailing list