Supplying fmincon with Hessian
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. Although my problem has linear constraints and upper and lower bounds, 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?
P.S. I am following the instructions given here which works until I deliberately replace the nonlinear constraint with some random linear constraints and then I will have the same problem again (empty lambda structure).
lambda is not a direct value, but a structure in which you can access many information. Matlab is telling you that there are 2 values currently in lambda. Choose what you need by
Here is an example of using user-supplied hessian