[Ipopt] Extract Objective Function Gradient in finalize_solution(...)

Knut Heidemann heidemannknut at gmail.com
Fri Jan 18 06:10:11 EST 2013

I tried the code snippet below and get the following error:

/In member function 'virtual void 
WLCNLP::finalize_solution(Ipopt::SolverReturn, Ipopt::Index, const 
Number*, const Number*, const Number*, Ipopt::Index, const Number*, 
const Number*, Ipopt::Number, const Ipopt::IpoptData*, 
//error: invalid use of incomplete type 'struct 
//error: forward declaration of 'struct Ipopt::IpoptCalculatedQuantities'/

Can this be due to further missing #includes or what kind of problem do 
I face here?


Am 17.01.2013 19:21, schrieb Hans Pirnay:
> this should work:
> SmartPtr<DenseVector> curr_grad = dynamic_cast<const
> DenseVector*>(GetRawPtr(ip_cq->curr_grad_f()));
> const double* grad_values = curr_grad->Values();
> You'll probably have to #include "IpDenseVector.hpp" and maybe some
> other dependencies.
> Hans
> On Thu, Jan 17, 2013 at 6:30 PM, Knut Heidemann <heidemannknut at gmail.com> wrote:
>> Hi,
>> I am trying to access the objective function gradient information after my
>> problem has been solved.
>> I assume that this is done in finalize_solution(...).
>> Unfortunately, I do not manage to use "ip_cq" for this purpose. Can anybody
>> tell me how the appropriate line of code would look like?
>> Best regards,
>> Knut Heidemann.
>> _______________________________________________
>> Ipopt mailing list
>> Ipopt at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/ipopt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20130118/f81fe3bf/attachment.html>

More information about the Ipopt mailing list