Check hessian with knitro solver or gjh

Hello folks,

I have a dynamic optimization problem. I was wondering how to numerically check if the hessian matrix of the optimization problem is positive or negative semi-definite? Can I do it with knitro solver? and how? I heard there is a “solver” gjh which could solve this problem as well, but I have no idea how can I get “Solver” gjh installed in my laptop. Currently, I have knitro solver installed in my ampl. Thanks in advance.



The gjh solver returns the hessian of the lagrangian, computed at the current values of the variables. Usually it is called after optimizing, so that it returns the hessian of the lagrangian at the indicated optimum.

However, gjh does not attempt to determine whether the hessian is positive or negative semi-definite. In general, determining whether a matrix is positive or negative semi-definite requires a numerical algorithm, which is beyond AMPL’s scope.

I am not aware of any way to get this information from Knitro, either. Knitro does indicate whether the local optimality conditions are satisfied at the solution that it returns.

Thanks for your quick reply. Just wondering how to call gjh solver after optimizing? Can you please elaborate " Knitro does indicate whether the local optimality conditions are satisfied at the solution that it returns"? When I ran the ampl optimization with knirto, it returned " Best locally optimal solution is returned" and " Knitro 13.1.0: Locally optimal or satisfactory solution", are these what you meant? Thanks a lot!

We used to include gjh in our full software bundles. It has been left out of more recent distributions, but since we are getting more requests for it, we will be restoring it soon. Are you using Windows or Linux? Then you can still get gjh from the following locations:

Instructions for using gjh can be found here:

Messages such as “Best locally optimal solution is returned” and “Locally optimal or satisfactory solution” do indicate that Knitro is returning a solution that satisfies a local optimality condition, to within specified tolerances. (Knitro’s default tolerances are normally used, but can be changed by setting certain options.)