-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: Change Hessian function signature? #593
Comments
I think we should change the call to be |
SGTM. If we do this change, then I would change also the
to
|
…unction calls We need a better way to express the Hessian function call so that sparse Hessians can be provided. This change updates the Problem function definitions to allow an arbitrary Symmetric matrix. With this change, we need to change how Location is used, so that we do not allocate a SymDense. Once this location is changed, we no longer need Needser to allocate the appropriate memory, and can shift that to initialization, further simplifying the interfaces. A 'fake' Problem is passed to Method to continue to make it impossible for the Method to call the functions directly. Fixes #727, #593.
#779) * optimize: Change initialization, remove Needser, and update Problem function calls We need a better way to express the Hessian function call so that sparse Hessians can be provided. This change updates the Problem function definitions to allow an arbitrary Symmetric matrix. With this change, we need to change how Location is used, so that we do not allocate a SymDense. Once this location is changed, we no longer need Needser to allocate the appropriate memory, and can shift that to initialization, further simplifying the interfaces. A 'fake' Problem is passed to Method to continue to make it impossible for the Method to call the functions directly. Fixes #727, #593.
Is this closed by #955? |
Yes. The dream is dead |
Are there other approaches you could use to get what you want? |
Not within the current design of optimize, that I see. The problem is that anything that uses the Hessian but wants to stay sparse needs to know more than just that it's a Symmetric. It needs more specialized things, like There are a couple ways to fix this. One is to add a lot of fields to Problem containing all the methods one might want. This of course does not scale. The second is to ditch the idea of A third solution, and my current thoughts on the matter, is to generalize the "back-end" of optimize, and then provide different front ends (for which
it's own If there is a different way of doing this that I'm missing, let me know. It would be great to just have one entry point for everything, but I don't see the design. |
Yes, I think the solution is to step back a little bit from the current abstraction if you can (I don't know enough about this to know if this is possible). |
What do you mean by "step back"? |
Try to find a more abstracted description of the work to be done. At the moment, you have the Func, Grad and the Hess functions, but the Hess function ties you to a specific implementation. What I understood from what you have above is that you might have an approach to abstracting that away to a greater degree). |
OK |
(but again, if there is an alternate design I'm missing) |
Now that the |
|
I was thinking that it would go in
Since I really don't know enough about how optimize works to be able to make any kind of necessarily sensible suggestions, but this seemed plausible, I don't know whether this suggestion would be better or worse than an alternative. The last point, 3., is outside the scope of this. If you think it's worth expanding things to handle that, then maybe it's not worth trying to shoehorn this in. |
It's difficult to comment on all of the recent discussion, so I'll just cherry-pick a couple of points.
I don't think this would work. First, it pushes work to the user that they shouldn't be doing because it's an algorithmic detail of the modified Newton. Second, there would have to be a feedback to Method to indicate whether the value of
Maybe it's because I don't see far enough but I'd like to first have a couple of concrete implementations that use different storage type for the Hessian (or the Jacobian or the constraints) before generalizing into a backend and frontend for optimize. How would this separation do away with the tension between the types that Methods use and the types that the users fill in?
I don't think that the Hessian creation should go into Settings. The way I see it is that Methods dictate what type the Hessian should be. Current I haven't thought about the details but at least conceptually it follows that |
I've been thinking for a while that we might want to change the signature for the Hessian method. The current signature forces the Hessian to be a
*SymDense
, while for many problems the Hessian is sparse, or block structured, or something. Directly, this limits the size of problems that can be solved due to memory constraints. Indirectly, this also significantly limits optimizations available. For instance, right nowNewton
calls Solve, which means the matrix is always using aDense
routine. There could be simplifications available. For instance,Newton
really only requires aSolveGradToer
, something likewhich is easily implemented by
SymDense
, but also enables taking advantage of sparse structure (or approximate solves).cc @vladimir-ch
The text was updated successfully, but these errors were encountered: