<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      I access the gradient values of my final objective function via<br>
      <br>
      <i>&nbsp; SmartPtr&lt;const DenseVector&gt; curr_grad =
        dynamic_cast&lt;const
        DenseVector*&gt;(GetRawPtr(ip_cq-&gt;curr_grad_f()));</i><i><br>
      </i><i>&nbsp; const double* grad_values = curr_grad-&gt;Values();</i><br>
      <br>
      Unfortunately, this does not agree with the values calculated in
      the last call of "eval_grad_f". <br>
      The first few entries do agree, but then I get values that are not
      related to the actual results. <br>
      Furthermore, the values are not reproducable.<br>
      For me, this looks like I am accessing values that have not been
      set?<br>
      <br>
      Might there be something wrong with the code above, or even the
      methods used therein?<br>
      <br>
      Kind regards,<br>
      Knut.<br>
      <br>
      <br>
      <br>
      <br>
      Am 18.01.2013 16:29, schrieb Stefan Vigerske:<br>
    </div>
    <blockquote cite="mid:50F96A46.9020102@math.hu-berlin.de"
      type="cite">Hi,
      <br>
      <br>
      On 01/18/2013 12:10 PM, Knut Heidemann wrote:
      <br>
      <blockquote type="cite">I tried the code snippet below and get the
        following error:
        <br>
        <br>
        /In member function 'virtual void
        <br>
        WLCNLP::finalize_solution(Ipopt::SolverReturn, Ipopt::Index,
        const
        <br>
        Number*, const Number*, const Number*, Ipopt::Index, const
        Number*,
        <br>
        const Number*, Ipopt::Number, const Ipopt::IpoptData*,
        <br>
        Ipopt::IpoptCalculatedQuantities*)'://
        <br>
        //error: invalid use of incomplete type 'struct
        <br>
        Ipopt::IpoptCalculatedQuantities'//
        <br>
        //error: forward declaration of 'struct
        Ipopt::IpoptCalculatedQuantities'/
        <br>
        <br>
        Can this be due to further missing #includes or what kind of
        problem do
        <br>
        I face here?
        <br>
      </blockquote>
      <br>
      Yes.
      <br>
      You need to include the header file where the
      IpoptCalculatedQuantities class is defined.
      <br>
      <br>
      Stefan
      <br>
      <br>
      <blockquote type="cite">
        <br>
        Best,
        <br>
        Knut.
        <br>
        <br>
        Am 17.01.2013 19:21, schrieb Hans Pirnay:
        <br>
        <blockquote type="cite">this should work:
          <br>
          <br>
          SmartPtr&lt;DenseVector&gt; curr_grad = dynamic_cast&lt;const
          <br>
          DenseVector*&gt;(GetRawPtr(ip_cq-&gt;curr_grad_f()));
          <br>
          const double* grad_values = curr_grad-&gt;Values();
          <br>
          <br>
          You'll probably have to #include "IpDenseVector.hpp" and maybe
          some
          <br>
          other dependencies.
          <br>
          <br>
          Hans
          <br>
          <br>
          On Thu, Jan 17, 2013 at 6:30 PM, Knut Heidemann
          <br>
          <a class="moz-txt-link-rfc2396E" href="mailto:heidemannknut@gmail.com">&lt;heidemannknut@gmail.com&gt;</a> wrote:
          <br>
          <blockquote type="cite">Hi,
            <br>
            <br>
            I am trying to access the objective function gradient
            information
            <br>
            after my
            <br>
            problem has been solved.
            <br>
            I assume that this is done in finalize_solution(...).
            <br>
            Unfortunately, I do not manage to use "ip_cq" for this
            purpose. Can
            <br>
            anybody
            <br>
            tell me how the appropriate line of code would look like?
            <br>
            <br>
            Best regards,
            <br>
            Knut Heidemann.
            <br>
            _______________________________________________
            <br>
            Ipopt mailing list
            <br>
            <a class="moz-txt-link-abbreviated" href="mailto:Ipopt@list.coin-or.org">Ipopt@list.coin-or.org</a>
            <br>
            <a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/ipopt">http://list.coin-or.org/mailman/listinfo/ipopt</a>
            <br>
          </blockquote>
        </blockquote>
        <br>
        <br>
        <br>
        <br>
        _______________________________________________
        <br>
        Ipopt mailing list
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:Ipopt@list.coin-or.org">Ipopt@list.coin-or.org</a>
        <br>
        <a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/ipopt">http://list.coin-or.org/mailman/listinfo/ipopt</a>
        <br>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>