[Coin-ipopt] Hessian of the constraints
Andreas Waechter
andreasw at watson.ibm.com
Wed Nov 7 13:14:11 EST 2007
Dime,
Please send messages regarding Ipopt to the Ipopt mailing list and not my email
address.
Please make sure you read the Ipopt documentation carefully, as well as the
Ipopt web site, since a number of your questions are already answered there.
The 'ipopt.exe' file will be compiled when you install Ipopt - it will be in
the subdirectory 'bin' of where you ran 'make install'. This assumes that you
downloaded the ASL third party package before running configure. You need to
make sure that it is in your path. If you don't know how to do that, I'm sure
that someone at your university can help you.
If you have trouble getting Ipopt to run on your computer and you have an AMPL
model, you can just submit the AMPL model to the NEOS server, which allows you
to solve AMPL models remotely, see
http://neos.mcs.anl.gov/neos/solvers/nco:Ipopt/AMPL.html
If other NLP solver can solve the problem, Ipopt should usually also be able to
do that.
The fact that you computed the direvatives with Maple doesn't mean that you
wrote the programming code correctly, you might have made mistakes regarding
indices etc. Stefan had suggest to you to use the derivative checker, which
the first thing you should try if you want to get your C implementation
working.
I suggest as a start you work with AMPL models and use the NEOS solver, see
above. If at some point you wanted to run Ipopt with AMPL locally on your
computer, please try to follow the instructions carefully, and if you believe
you found a bug, please report a ticket at the Ipopt website.
Regards,
Andreas
On Wed, 7 Nov 2007, Dime Vitanovski wrote:
> Hi Mr. Waechter,
>
> first of all I want to thanks you for giving me such a good answer.
> I try this morning to use AMPL and I rewrite the hole function with AMPL
> syntax, but the solve command require ipopt.exe and I don't have the exe.
> However, since I'm not computing the derivatives per hand but with maple, I
> know that there are correct. And I also now that my optimization problem is
> feasible because later I found the same problem described in one paper and
> this paper was accepted in the conference :)
> In this paper they war using the "Trust Region Optimization" and comparing
> this approach with the Levenberg-Marquardt optimization, where they are also
> computing the first and the second derivatives. So do you thing that if the
> problem can be solved with "Levenberg-Marquardt" optimization, can be also
> solved with IPopt ? And today I let the IPopt to compute my hessian and then
> I got the error: Search direction is becoming too small
>
> I'll write one more line, and show you how my problem is looking (sorry for
> boring you with this)
> for i = 1 to 4
> f(r,s) += ( transpose(r)*Ai*r )^2 + ( transpose(r)*Bi*r + transpose(r)*Ci*s
> )^2 with constraints transpose(r)*r = 1 and transpose(r)*s=0
>
> where r = (r0,r1,r2,r3), s = (s0,s1,s2,s3) unknowns vecotors (r,s are dual
> quaternion's if this has some meaning for you)
> and A,B,C are 4x4 Matrix - known
>
> Do you thing that this can be solved with IPopt ?
> I would appreciate your answer
>
> Thanks a lot,
> Dime Vitanovski (Student)
>
>
>
>> Date: Tue, 6 Nov 2007 11:59:20 -0500> From: andreasw at watson.ibm.com> To:
>> stefan at math.hu-berlin.de> Subject: Re: [Coin-ipopt] Hessian of the
>> constraints> CC: coin-ipopt at list.coin-or.org> > 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> >>
>> _______________________________________________> Coin-ipopt mailing list>
>> Coin-ipopt at list.coin-or.org>
>> http://list.coin-or.org/mailman/listinfo/coin-ipopt
> _________________________________________________________________
> Invite your mail contacts to join your friends list with Windows Live Spaces.
> It's easy!
> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
More information about the Coin-ipopt
mailing list