supplied Hessian of fmincon

4 views (last 30 days)
Mary dkh
Mary dkh on 1 Apr 2011
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
  2 Comments
Andrew Newell
Andrew Newell on 3 Apr 2011
@Mary, how can we know the reason if you don't tell us what the function is and how you are calculating the Hessian by hand?
Mary dkh
Mary dkh on 3 Apr 2011
Andrew!
You are right, but I suppose this difference has a general reason which happens to all kind of optimization problems.
However, my problems is as follow:
X0 = [50; 50]; %Initialize
a = [3;5]
b = [7;11]
c = [15;19]
obj: f = (a1*X(1)^2 + a2*X(2)^2);
constraints:
g1 = b1 *X(1)^2 + b2 *X(2)^2 - 300;
g2 = c1 *X(1) + c2 *X(2) - 100;
I wrote the problem in MATLAB and by using fmincon, I got the following optimum solutions:
X =
5.1924e-002
5.2222e+000
I also have computed my hessian of lagrangian function with respect to X and lambda(lambda is lagrangian multipliers for equality constraints) and write in a general format in Matlab after calling fmincon as following:
Hessian = [ [ [2*a1-2*b1*LM(1)] [0] [-2*b1*X(1)] [-c1] ];
[ 0] [2*a2-2*b2*LM(1)] [-2*b2*X(2)] [-c2] ];
[ [-2*b1*X(1)] [-2*b2*X(2)] [0] [0] ];
[ [-c1] [-c2] [0] [0] ]; ];
so by applying the optimal solution to this Hessian matrix and compare that with the one obtained by fmincon we observe that difference.
Please note that we should compare only Hessian(1:2,1:2) with that of fmincon.
Now can anyone tell me what this difference is for?
Thanks

Sign in to comment.

Accepted Answer

Steve Grikschat
Steve Grikschat on 18 Apr 2011
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.
  2 Comments
Mary dkh
Mary dkh on 22 Apr 2011
Thanks for the answer. However, by the term of "approximation" I did not expect that large differennce between two hessians.
Steve Grikschat
Steve Grikschat on 22 Apr 2011
That's understandable. Maybe it should be called an "iteration matrix" or some other term to avoid confusion.

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!