I'm working on a project that needs to solve a constraint optimization function. Currently, I'm using Knitro solver and it needs to calculate the the hessian of the lagrangian at x and lambda. I don't understand how to calculate the hessian. The constraint optimization problem is as follows:
$\text{minimize}_x 100 -(x_2 - x^2_1)^2 + (1-x_1)^2$
subject to $1\le x_1x_2$, $
0\le x_1,x_2$,$x_1\le0.5$.
The function to calculate the hessian is (it seems that lambda is given):
$ t = x_2 - x_1x_1;$
$        h_1 = (-400.0  t) + (800.0  x_1x_1) + 2.0$,
$        h_2 = (-400.0  x_1) + \lambda_1$,
$        h_3 = 200.0 + \lambda_2  2.0)$
Could you please tell me how to get $h_1,h_2,h_3$ ? Thank you very much.
The simplest way it to note that a basis transformation of a transformation $T$ is done via $ATA^{-1}$ where $A$ is an invertible matrix, and that the trace has the property $\operatorname{tr}(AB)=\operatorname{tr}(BA)$. Putting this together, you get $$\operatorname{tr}(ATA^{-1}) = \operatorname{tr}(A^{-1}AT) = \operatorname{tr}T$$