[Coin-ipopt] Hessian of the constraints

Andreas Waechter andreasw at watson.ibm.com
Tue Nov 6 11:59:20 EST 2007


Hi,

I just want to add that you might want to consider working with a modeling 
tool first (AMPL or GAMS) before writing C/C++ code to formulate you 
optimization problem.  This way, you can just write down the mathematical 
formulation of your problem, and you don't need to worry about coding 
derivatives since the tools will compute those efficiently (and 
correctly!) for you.  It allows you to test Ipopt (and possibly other 
solvers that can be used from AMPL or GAMS) for your problem formulation, 
and you can also play easily with the formulation itself.

Both AMPL and GAMS have free versions that you can use for small problems 
and download from the web, just search for them.

You can find an example how Ipopt is used from AMPL in the Ipopt 
documentation, e.g. http://www.coin-or.org/Ipopt/documentation/node26.html

If you have questions regarding the usage of AMPL and how to write AMPL 
models, please refer to the AMPL website, read the AMPL book, or go to the 
AMPL newgroup http://groups.google.com/group/ampl.  We won't be able to 
answer AMPL modeling questions here.

A final remark: Your problem seems to be quite nonconvex and will probably 
have a number of different local solutions.  Just be aware that Ipopt is 
only guaranteed to find any local solution, while the true global solution 
might be different.  If you want to guarantee that you find the global 
optimum, you might want to look at global optimization codes, such as LaGO 
on COIN (https://projects.coin-or.org/LaGO).

Hope this helps,

Andreas


On Tue, 6 Nov 2007, Stefan Vigerske wrote:

> 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
> _______________________________________________
> Coin-ipopt mailing list
> Coin-ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-ipopt
>



More information about the Coin-ipopt mailing list