Cannot supply fmincon with Hessian

1 view (last 30 days)
Ali Jamali
Ali Jamali on 9 Mar 2015
Edited: Matt J on 11 Mar 2015
I am trying to help fmincon to converge faster by supplying gradient vector and Hessian matrix. I am using interior-point algorithm and I realize that in such case, I have to supply Hessian using a call to another function which is assigned to HessFcn of my OPTIOINS. I also realize that the Hessian for fmincon is the second derivatives of the Lagrangian as described here in equation 14-1. I am supposed to use the following function definition to have access to my fitting parameters and lambda while calculating the hessian
hessian = hessianfcn(x, lambda)
From this point on I have some difficulties figuring out the procedure. First of all how should I calculate the second and third terms in equation 14-1? Also, although my problem is constrained, lambda structure is empty i.e. whenever I try to access it from hessianfcn, it returns:
lambda =
eqnonlin: [0x1 double]
ineqnonlin: [0x1 double]
Any idea how to fix this problem and also how to calculate second and third terms in equation 14-1?

Accepted Answer

Matt J
Matt J on 9 Mar 2015
Edited: Matt J on 9 Mar 2015
The second and third terms sum over the Hessians of your constraints (weighted by the corresponding lambda). Essentially, you need to be computing the Hessian of your ceq(i) and c(i) as well as the Hessian of your objective, f, inside the HessFcn. Then you need to apply the lambda(i) as weights to all those Hessians and sum them all up.
Why the lambda structure is empty is not something we can determine without seeing code. My guess is that you defined a nonlcon function for your nonlinear constraints, but neglected to actually pass it to fmincon. Or, your input arguments to fmincon are not in the proper sequence.
  5 Comments
Matt J
Matt J on 11 Mar 2015
Edited: Matt J on 11 Mar 2015
Yes. All linear constraints have a Hessian of zero. Therefore, if you have no nonlinear constraints, only the objective function contributes non-trivially to the total Hessian of the Lagrangian.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!