<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 have got some difficulties concerning data extraction from the
      converged solution of my IPOPT problem.<br>
      I am extracting the forces on some dofs via (in
      finalize_solution):<br>
      <small><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></small><br>
      <br>
      Then I look at some "grad_values[x]". <br>
      The problem now is the following: If I write a file with the final
      coordinates and multipliers and start IPOPT again (after loading
      the files as starting point) , I occasionally get different
      grad_values[x], although the program converges in zero iterations
      and the final coordinates (and objective etc.) are exactly the
      same as before. <br>
      <br>
      This is my main:<br>
      <br>
      <i><small>int main(int argc, char** argv)<br>
          { <br>
          &nbsp; SystemState system ("vertices.txt", "springs.txt",
          "constraints.txt", "fixed.txt");<br>
          <br>
          &nbsp; SmartPtr&lt;TNLP&gt; mynlp = new WLCNLP(system);<br>
          &nbsp; <br>
          &nbsp; // Create a new instance of IpoptApplication<br>
          &nbsp; //&nbsp; (use a SmartPtr, not raw)<br>
          &nbsp; SmartPtr&lt;IpoptApplication&gt; app = new
          IpoptApplication();<br>
          &nbsp;<br>
          &nbsp; // Intialize the IpoptApplication and process the options<br>
          &nbsp; ApplicationReturnStatus status;<br>
          &nbsp; status = app-&gt;Initialize();<br>
          &nbsp; if (status != Solve_Succeeded) {<br>
          &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; std::endl &lt;&lt;
          "*** Error during initialization!" &lt;&lt; std::endl;<br>
          &nbsp;&nbsp;&nbsp; return (int) status;<br>
          &nbsp; }<br>
          <br>
          &nbsp; // Ask Ipopt to solve the problem<br>
          &nbsp; status = app-&gt;OptimizeTNLP(mynlp);<br>
          &nbsp; system.updateCoordinates("vertices.txt"); // load
          coordinates from preceding simulation<br>
          &nbsp;
          app-&gt;Options()-&gt;SetStringValue("warm_start_init_point",
          "yes"); // load initial lagrange multipliers from preceding
          simulation<br>
          &nbsp; mynlp = new WLCNLP(system);<br>
          &nbsp; status = app-&gt;OptimizeTNLP(mynlp);<br>
          <br>
          &nbsp; return 0;<br>
          }<br>
        </small></i><br>
      I cannot come up with a reasoning for this behavior.<br>
      Any hint would be tremendously appreciated.<br>
      <br>
      Best,<br>
      Knut.<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>