<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Dear all,
<div><br>
</div>
<div>I am working on the HS071 optimization problem. I want to replace the explicit expressions for the Gradient, Hessian and Jocabian with a finite-difference approxiamation. Once I know how to do this, I will implement this on a more complex problem.</div>
<div><br>
</div>
<div>I am running Ipopt 3.9stable with the default ma27 solver and the C interface <span style="font-family: monospace; font-size: medium; ">IpStdCInterface.h</span>. I have no problems with setting the Hessian and the Jacobian approximation (see below). Allthough
I was not expecting I could use the <u>Jacobian approximation</u> with the ma27 solver, especially since it is
<u>not mentioned as an IPOPT option in the online documentation</u>. (Documentation online is not clear and I can only find info on jacobian approximation at <a href="http://www.coin-or.org/Bonmin/option_pages/options_list_ipopt.html">http://www.coin-or.org/Bonmin/option_pages/options_list_ipopt.html</a>)</div>
<div><br>
<b>Hence 2 questions remain:</b></div>
<div>
<ol style="font-family: Tahoma; font-size: 10pt; ">
<li>How can I implement a gradient estimation using finite-differences?</li><li>How can I be sure that my jacobian estimation actually is correct? I can solve the HS071 problem with finite-differences jacobian, and get good results. Is this enough proof?</li></ol>
</div>
<div>Your help will be greatly appreciated!</div>
<div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>-Martijn Disse</div>
<div><br>
</div>
<div>======================================================</div>
<div><b>Jacobian approximation (WORKS!)</b></div>
<div>
<div><i>AddIpoptStrOption(nlp, "jacobian_approximation", "finite-difference-values");
</i></div>
<div><i><br>
</i></div>
<div>
<div>Bool eval_jac_g(Index n, Number *x, Bool new_x,</div>
<div> Index m, Index nele_jac,</div>
<div> Index *iRow, Index *jCol, Number *values,</div>
<div> UserDataPtr user_data)</div>
<div>{</div>
<div> if (values == NULL) {</div>
<div> // return the structure of the Jacobian</div>
<div> // this particular Jacobian is dense</div>
<div> iRow[0] = 0; jCol[0] = 0;</div>
<div> iRow[1] = 0; jCol[1] = 1;</div>
<div> iRow[2] = 0; jCol[2] = 2;</div>
<div> iRow[3] = 0; jCol[3] = 3;</div>
<div> iRow[4] = 1; jCol[4] = 0;</div>
<div> iRow[5] = 1; jCol[5] = 1;</div>
<div> iRow[6] = 1; jCol[6] = 2;</div>
<div> iRow[7] = 1; jCol[7] = 3;</div>
<div> }</div>
<div> return FALSE;</div>
<div>}</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><b>Hessian approximation (WORKS!)</b></div>
<div><i>AddIpoptStrOption(nlp, "hessian_approximation", "limited-memory");</i></div>
<div><i><br>
</i></div>
<div>I define the function as:</div>
<div>
<div>Bool eval_h(Index n, Number *x, Bool new_x, Number obj_factor,</div>
<div> Index m, Number *lambda, Bool new_lambda,</div>
<div> Index nele_hess, Index *iRow, Index *jCol,</div>
<div> Number *values, UserDataPtr user_data)</div>
<div>{</div>
<div> return FALSE;</div>
<div>}</div>
</div>
<div><br>
</div>
<div>====================================================== </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</body>
</html>