MATLAB: Supplied Hessian of fmincon

fminconhessianoptimizationOptimization ToolboxStatistics and Machine Learning Toolbox

Hi,
I have a question and would be happy if anyone can answer. I have a simple optimization problem with only 2 variables and 2 equality constraints. When I compare the Hessian of the Lagrangian function computed by hand with that supplied by fmincon, I observe a huge difference. I know that fmincon uses the SQP algorithm and the BFGS formula to compute the Hessian and this Hessian is an approximation to the Hessian of Lagrangian. However, since this is an approximation, it seems to be close to the accurate value.
Please see the difference :
Hessian provided by fmincon =
[2.2313 8.7213
8.7213 60.3726]
Hessian solved by hand =
[-0.3666 0
0 -0.0046]
Please note that the optimal value for x and obj function are same just different in Hessian. I got the same thing for another problem. I am wondering what this difference is for?
Thanks in advance, Mary

Best Answer

As you stated, fmincon provides a BFGS approximation to the Hessian of the Lagrangian. However, the BFGS matrix is a positive definite matrix based on the local curvature of the problem.
But note, it's always positive definite and your Hessian (from the looks of it) is not necessarily so. This matrix should not be used for any comparisons or computations outside of the optimization.