[Coin-ipopt] Hessian of the constraints
Stefan Vigerske
stefan at math.hu-berlin.de
Tue Nov 6 10:38:03 EST 2007
Hi,
> 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
(0,0)=2*lambda[0],
(1,1)=2*lambda[0],
(2,2)=2*lambda[0],
(3,3)=2*lambda[0],
(0,4)=1*lambda[1],
(1,5)=1*lambda[1],
(2,6)=1*lambda[1],
(3,7)=1*lambda[1].
(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
http://www.coin-or.org/Ipopt/documentation/node37.html
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
--
Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics
http://www.math.hu-berlin.de/~stefan
More information about the Coin-ipopt
mailing list