ifopt icon indicating copy to clipboard operation
ifopt copied to clipboard

Adding Hessians to Component

Open mpowelson opened this issue 5 years ago • 6 comments

I notice that components only include values, bounds, and jacobians. Is there any reason Hessians are not stored in them as well, other than you just didn't need it?

We are considering using this library for a project, and a lot of the solvers we'd like to interface to accept hessians. I'm not entirely sure how this would look. I suppose it could actually go in CostTerm?

mpowelson avatar May 20 '19 13:05 mpowelson

Yes, I just didn't use them, mostly because it was quite difficult to determine their analytical values for the problem I was solving. But they could be included in ifopt as well.

From the structure I would add a function "GetHessian()", that's callable on a cost-term, as well as on a constraint-set. That would be the 2nd derivative (3 dimensional matrix, right?), just as the function "GetJacobian()" supplies the first derivative (2d). The image here at the bottom might help: http://docs.ros.org/api/ifopt/html/group__ProblemFormulation.html

awinkler avatar May 20 '19 13:05 awinkler

Ok that makes sense. I was not sure about the 3D matrix. I suppose for constraints it would have to be. I'm not an optimization guy. It seems like many of them only really care about the hessian of the objective function which could then just be 2D. But I could be completely wrong about that.

mpowelson avatar May 20 '19 14:05 mpowelson

Hi, any progress here?

My understanding of non-linear interior-point optimization is that you only reason on 2d order derivatives for the objective, which is a simple matrix. The jacobian of the objective would actually be just the transpose of the gradient, so a vector. The same should apply for SQP: "SQP methods solve a sequence of optimization subproblems, each of which optimizes a quadratic model of the objective subject to a linearization of the constraints" (cf. wikipedia).

To have exact Hessians passed in, what would one need to change to ifopt?

Thanks in advance.

jmainpri avatar Dec 16 '19 16:12 jmainpri

While I am still interested, I have not looked into implementing this any more.

mpowelson avatar Dec 16 '19 17:12 mpowelson

I went looking for this capability today since the problem I'm working on can efficiently compute an analytical Hessian matrix and I'm enjoying the ease of use ifopt provides. It seems like the current status is still open so I started to take a stab at it, naively searching for the word "Jacobian" and extending the code as needed. It will take some further investigation to make sure there aren't any nuances I skipped over.

This link indicates that the Hessian of the whole Lagrangian is need, that is the Hessian of the objective function and the constraints so both Components will need to be extended. From what I understand they should all be simple matrices (rank-2 tensors) as well.

graphitical avatar Oct 19 '20 20:10 graphitical

Hi all,

Any update on this? Did somebody implement this and wants to provide the code extensions needed?

IoannisDadiotis avatar Jun 08 '21 10:06 IoannisDadiotis