# Ipopt finds a better solution if I do not eliminate the zeros in the hessian matrix ?(we eliminate the zeros by defining the structure)

I use Ipopt to solve a problem with sparse hessian and jacobian matrices.

If I provide the hessian matrix: its structure, and the non zeros elements in the hessian matrix, it will be really fast.

If I do not define the hessian structure but provide the whole hessian matrix, which is almost zeros, the solver will be slow but converges to a better solution!

Does that mean the zeros help the solver find a better solution?

• Did you try with only one problem? It's not possible to draw any conclusion from the result of a solver on a single problem Dec 18, 2022 at 15:27
• If the problem is nonconvex, IPOPT may converge to any local solution. A reasonable approach to at least bypass very bad solutions, is to use different starting points. Dec 18, 2022 at 21:52
• Thank you. My question is why solver coverages to a different point if I am using the same starting point. Why does the solver coverage to another point if I provide the whole hessian matrix instead of the nonzeros only? I am not drawing a conclusion I just wanted to know how the solver works. Dec 18, 2022 at 23:31
• In addition to the previous comments describing what can happen even if everything is is done correctly, what have you done to verify that the sparse structured Hessian is correct? There is a second order derivative checker which uses finite differences to check the Hessian coin-or.github.io/Ipopt/SPECIALS.html . Dec 19, 2022 at 2:01