[Coin-ipopt] Hessian of the constraints

Stefan Vigerske stefan at math.hu-berlin.de
Tue Nov 6 10:38:03 EST 2007


> thanks for your answer.
>  > I'm not sure that I understand your question.
> The question is, should I add the lamda[1], or I can leave them, because the 
> second order derivatives are 1's.

If the hessian of your constraint would be zero, then you could leave 
them, otherwise you need to add the lambda[1]'s.

In your example,
 > > > x0*x0 + x1*x1 + x2*x2 + x3*x3 = 1 and
 > > > x0*x4 + x1*x5 + x2*x6 + x3*x7 = 0
the hessians of the constraints are, as you also said,
(0,0)=2, (1,1)=2, (2,2)=2 for the first constraint, and
(0,4)=1, (1,5)=1, (2,6)=1, (3,7)=1 for the second constraint.
where (i,j)=h mean that at positions (i,j) and (j,i) there is value h in 
the Hessian.

Since the Lagrangian is
obj_factor*objective(x) + sum_i lambda[i]*constraint_i(x)
the Hessian you need to give to Ipopt is

(I do not know you objective function, so I just assumed that it is linear.)

Note that Ipopt assumes that you give only lower or upper diagonal 
elements, not both. Thus, you should only provide (1,5), but not (5,1), 
and similar for (0,4), (2,6), and (3,7).

There is also a nice example at
Please read the manual! :-)

>  >If you set the option derivative_test to second-order then Ipopt performs some 
> numerical tests
> I try this option and I got a lot of errors :) but I don't now how to correct 
> them, because
> I calculate the derivatives with maple, so there are correct. And beside that, I 
> have optimizing another problem and
> the optimization was working fine, and there I try also the option: 
> derivative_test and there war also errors in the test but the optimization was 
> still working fine.
> That's why I don't understand much what is IPopt doing there and if there is 
> really an error how to correct that.

If Ipopt reports errors in the derivative check, and if these errors are 
not tiny (like 1e-4 or less), then it's very likely an error in your code.
Sometimes, Ipopt is also successfull with an incorrect Hessian.


Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics

More information about the Coin-ipopt mailing list