<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<br><br>Thanks for the quick reply! The problem turned out to be my function for evaluating<br>the Lagrangian. A bit simplified, the following is the original code:<br><br>adouble L = obj_factor*obj_fun(x);<br>for (unsigned int i=0; i<nconstr; i++)<br> L += lambda[i]*constr[i];<br><br>This code worked fine with lambda as doubles, but when using lambda as adoubles,<br>i.e. as variables, additional non-zeros appeared in H_{xx}. However, when changing <br>the code to<br><br>adouble L = obj_factor*obj_fun(x);<br>for (unsigned int i=0; i<nconstr; i++)<br> L = L + lambda[i]*constr[i];<br><br>everything worked fine, with all additional non-zeros ending up in columns>dim(x). <br>Not sure why though, perhaps someone could explain?<br><br>Kind regards<br><br>Ingrid<br><br><br><br><br><br><br><div><div id="SkyDrivePlaceholder"></div>> Date: Thu, 2 May 2013 15:54:28 +0200<br>> From: kshitij@math.upb.de<br>> To: ingridhallen@hotmail.com<br>> CC: awalther@math.uni-paderborn.de; adol-c@list.coin-or.org<br>> Subject: Re: [ADOL-C] Evaluating Hessian of Lagrangian<br>> <br>> Hello,<br>> <br>> the sequence of rows or columns in the hessian is exactly the same as of<br>> the execution of the <<= operators that define independents between<br>> trace_on() and trace_off(). So as long as the <<= operator was executed<br>> for all x variables before all lagrange multipliers, the H_{xl}<br>> components should have column indices larger than dim(x).<br>> <br>> Sincerely<br>> Kshitij Kulshrestha.<br>> <br>> As on 2013-05-02 15:28h, Ingrid Hallen did write:<br>> > Hi,<br>> > <br>> > I finally got time to start implementing the alternative method for<br>> > computing the Hessian of<br>> > the Lagrangian to do some benchmarking. However, I have come across the<br>> > following difficulty:<br>> > <br>> > Using also the Lagrange multipliers as variables yields an Hessian of<br>> > the Lagrangian in the<br>> > form of a block matrix:<br>> > <br>> > H = / H_{xx} H_{xl} \<br>> > \ H_{xl} 0 /<br>> > <br>> > Here H_{xx} is the Hessian wrt to the original variables x\inR^n that we<br>> > are interested in. After calling<br>> > sparse_hess(tag,n,repeat,x,&nnz,&rind,&cind,&values,&options) I thought<br>> > that it should be<br>> > straightforward to identify the parts of rind, cind and values<br>> > pertaining to H_{xx}. For instance,<br>> > say we want to count the non-zeros in the first row of H_{xx}, nnz_xx,<br>> > using the following code:<br>> > <br>> > int k = 0<br>> > int nnz_xx = 0<br>> > while rind[k]==0<br>> > if cind[k]<n<br>> > nnz_xx++;<br>> > end<br>> > k++;<br>> > end<br>> > <br>> > This of course only works provided the non-zeros of H_{xl} are found in<br>> > the columns>n, but that<br>> > appears not to be the case.<br>> > <br>> > Am I missing something really simple here, or how can I extract H_{xx}?.<br>> > <br>> > Kind regards<br>> > Ingrid<br>> > <br>> > <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > From: ingridhallen@hotmail.com<br>> > To: awalther@math.uni-paderborn.de<br>> > Date: Thu, 11 Apr 2013 09:26:23 +0200<br>> > CC: adol-c@list.coin-or.org<br>> > Subject: Re: [ADOL-C] Evaluating Hessian of Lagrangian<br>> > <br>> > Thanks for your reply!<br>> > <br>> > I think I will do some benchmarking then, to see which<br>> > of the two approaches works best for my problem.<br>> > <br>> > The approach suggested by Norm is certainly interesting,<br>> > but I think I have to little experience with optimization<br>> > to implement it successfully. At least for the moment.<br>> > <br>> > Sincerely,<br>> > <br>> > Ingrid<br>> > <br>> > <br>> >> Date: Wed, 10 Apr 2013 22:51:22 +0200<br>> >> From: awalther@math.uni-paderborn.de<br>> >> To: ingridhallen@hotmail.com<br>> >> CC: normvcr@telus.net; adol-c@list.coin-or.org<br>> >> Subject: Re: [ADOL-C] Evaluating Hessian of Lagrangian<br>> >><br>> >> Hi<br>> >><br>> >> sorry for entering the discussion so late but I was on travel<br>> >> the last days and most of the time offline.<br>> >><br>> >> If you can exploit the minor size of the reduced Hessian<br>> >> the approach proposed by Norm is certainly the best way to go<br>> >> since it requires the least number of Hessian vector product<br>> >> which determines the cost of the derivative calculation.<br>> >><br>> >> However, I am not sure whether Ipopt can really exploit this.<br>> >> Regarding the other approaches discussed so far:<br>> >><br>> >> We made the experience that it really depends on the application<br>> >> whether<br>> >><br>> >> * tracing the Lagrangian once with x and lambda as inputs<br>> >> and evaluating only a part of the Hessian reusing the trace<br>> >> in all iterations<br>> >><br>> >> or<br>> >><br>> >> * retracing the Lagrangian with x as adoubles and lambda as doubles<br>> >> in each iteration and computing then the whole Hessian<br>> >><br>> >> performs better in terms of runtime. You could give both approaches<br>> >> a try and see what works better for you. Both approaches have their<br>> >> pros and cons with respect to efficiency.<br>> >><br>> >> Best regards<br>> >><br>> >> Andrea<br>> >><br>> >> --<br>> >> Prof. Dr. Andrea Walther<br>> >> Lehrstuhl fuer Mathematik und ihre Anwendungen<br>> >> Institut fuer Mathematik<br>> >> Universitaet Paderborn<br>> >> Warburger Str. 100<br>> >> 33098 Paderborn<br>> >><br>> >> Email: andrea.walther@uni-paderborn.de<br>> >> Phone: ++49 5251 602721<br>> >> ++49 5251 602724 (sekr.)<br>> >> Fax: ++49 5251 603728<br>> >><br>> >> **********<br>> >><br>> >><br>> >><br>> > <br>> > _______________________________________________ ADOL-C mailing list<br>> > ADOL-C@list.coin-or.org http://list.coin-or.org/mailman/listinfo/adol-c<br>> > <br>> > <br>> > _______________________________________________<br>> > ADOL-C mailing list<br>> > ADOL-C@list.coin-or.org<br>> > http://list.coin-or.org/mailman/listinfo/adol-c<br>> > <br>> <br>> -- <br>> Dr. Kshitij Kulshreshtha<br>> <br>> Institut für Mathematik,<br>> Universität Paderborn,<br>> Warburger Straße 100,<br>> 33098 Paderborn.<br>> <br>> Büro: A3.235<br>> <br>> Privatanschrift:<br>> Arnikaweg 62<br>> 33100 Paderborn.<br></div>                                            </div></body>
</html>