<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> SmartPtr<const DenseVector> curr_grad =
dynamic_cast<const
DenseVector*>(GetRawPtr(ip_cq->curr_grad_f()));</i><i><br>
</i><i> const double* grad_values = curr_grad->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>
SystemState system ("vertices.txt", "springs.txt",
"constraints.txt", "fixed.txt");<br>
<br>
SmartPtr<TNLP> mynlp = new WLCNLP(system);<br>
<br>
// Create a new instance of IpoptApplication<br>
// (use a SmartPtr, not raw)<br>
SmartPtr<IpoptApplication> app = new
IpoptApplication();<br>
<br>
// Intialize the IpoptApplication and process the options<br>
ApplicationReturnStatus status;<br>
status = app->Initialize();<br>
if (status != Solve_Succeeded) {<br>
std::cout << std::endl << std::endl <<
"*** Error during initialization!" << std::endl;<br>
return (int) status;<br>
}<br>
<br>
// Ask Ipopt to solve the problem<br>
status = app->OptimizeTNLP(mynlp);<br>
system.updateCoordinates("vertices.txt"); // load
coordinates from preceding simulation<br>
app->Options()->SetStringValue("warm_start_init_point",
"yes"); // load initial lagrange multipliers from preceding
simulation<br>
mynlp = new WLCNLP(system);<br>
status = app->OptimizeTNLP(mynlp);<br>
<br>
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<DenseVector> curr_grad = dynamic_cast<const
<br>
DenseVector*>(GetRawPtr(ip_cq->curr_grad_f()));
<br>
const double* grad_values = curr_grad->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"><heidemannknut@gmail.com></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>