[Ipopt] Gradient estimation in IPOPT

Martijn Disse M.W.Disse at student.tudelft.nl
Fri Aug 24 05:06:05 EDT 2012


Dear all,

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.

I am running Ipopt 3.9stable with the default ma27 solver and the C interface IpStdCInterface.h. I have no problems with setting the Hessian and the Jacobian approximation (see below). Allthough I was not expecting I could use the Jacobian approximation with the ma27 solver, especially since it is not mentioned as an IPOPT option in the online documentation. (Documentation online is not clear and I can only find info on jacobian approximation at http://www.coin-or.org/Bonmin/option_pages/options_list_ipopt.html)

Hence 2 questions remain:

  1.  How can I implement a gradient estimation using finite-differences?
  2.  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?

Your help will be greatly appreciated!

Best regards,

-Martijn Disse

======================================================
Jacobian approximation (WORKS!)
AddIpoptStrOption(nlp, "jacobian_approximation", "finite-difference-values");

Bool eval_jac_g(Index n, Number *x, Bool new_x,
                Index m, Index nele_jac,
                Index *iRow, Index *jCol, Number *values,
                UserDataPtr user_data)
{
  if (values == NULL) {
    // return the structure of the Jacobian
    // this particular Jacobian is dense
    iRow[0] = 0; jCol[0] = 0;
    iRow[1] = 0; jCol[1] = 1;
    iRow[2] = 0; jCol[2] = 2;
    iRow[3] = 0; jCol[3] = 3;
    iRow[4] = 1; jCol[4] = 0;
    iRow[5] = 1; jCol[5] = 1;
    iRow[6] = 1; jCol[6] = 2;
    iRow[7] = 1; jCol[7] = 3;
  }
  return FALSE;
}



Hessian approximation (WORKS!)
AddIpoptStrOption(nlp, "hessian_approximation", "limited-memory");

I define the function as:
Bool eval_h(Index n, Number *x, Bool new_x, Number obj_factor,
            Index m, Number *lambda, Bool new_lambda,
            Index nele_hess, Index *iRow, Index *jCol,
            Number *values, UserDataPtr user_data)
{
  return FALSE;
}

======================================================



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


More information about the Ipopt mailing list