Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
=======================================
Coverage ? 53.71%
=======================================
Files ? 5
Lines ? 229
Branches ? 0
=======================================
Hits ? 123
Misses ? 106
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kellertuer
left a comment
There was a problem hiding this comment.
The finalise is an interesting idea!
For now I modelled one of the aspects here the other way around:
Usually my Manopt.solve! would always end in returning get_iterate(state),
but Manopt has a ReturnSolverState <: State type (which wraps a state) and if that is present the corresponding solve! dispatch returns the state wrapped.
I think with finaliser this is a bit more generic and nicer so I like the idea.
|
Ah and thanks for coming back to this, I still think, having such a package would be very nice, And yes, the design here is a bit cleaner than the “grown over time” design of Manopt, but it is still a major rework that someone(tm) has to find time for. Maybe I will give it a try once we finish the 0.6 rework we currently do, which is by itself also adapting to 2-3 new solvers actually. |
|
No worries, I think I will gradually keep trying stuff out when I have time as well, also because I just really value your feedback on this and it is a fun project, even though the priority isn't the highest :)
I was thinking of that too, I would be totally fine with defaulting to |
|
I think I would prefer to default it to an access function |
|
I think this is coming down to some discussions we were having earlier (which I am happy to revisit), but since it's been such a long time let me repeat some of my thoughts: I tend to not like wrapper structs too much, mostly because these things often don't combine very well. If we are using the For the distinction between AlgorithmsInterface.jl/src/interface/state.jl Lines 11 to 17 in b50c25d While we can obviously revisit that topic, we should probably not mix that in here. (I also still quite like this decision though) In summary, I now changed the default to just return |
at least in Manopt that works well (Debug, Record, Return are all states), one mainly has to be strict in accessors being functions. In the end it is a matter of taste and maybe I am just too used (and wired in thought) to using wrappers and doing that carefully – at least I feel it works well in Manopt. Ah I remember, that we agreed to have the property to be overwritten then, ok For the solution. you went with, I think that is a good one. |
|
I think in that case this PR can probably be merged, and we can go from there. Do you mind approving? I set up some branch protection rules as well in the meantime. [edit] Unless there were some specific things I still should change, feel free to let me know |
kellertuer
left a comment
There was a problem hiding this comment.
Surfe, just forgot to do that since it is already 10.30pm here and I just came home form a nice dinner. Here you are.
And sure having those PR approval rules is a good idea!
This is a (long overdue) follow-up on some of the things that had been discussed but rejected in #9. The approach here is different, and I'm happy to hear some feedback.
Changes
The first thing I changed here is that I added a
finalize_state!function, which is called at the end of thesolve(!)routines. The main point is to just have a hook that provides the option of returning something different than thestatefrom those calls. For example, it might be reasonable thatsolve(problem, algorithm) -> solution, instead of returning astatethat still has all of the internal details. Additionally this function allows for doing some clean-up, for example it might be used for releasing some resources or caches that were acquired, or maybe to write the result to disk, ...The second thing relates more to the previous closed PR, where I think one of the main comments was that
solveends up first callinginitialize_state, and then callssolve!, which ends up callinginitialize_state!. Sinceinitialize_stateandinitialize_state!should probably do the same thing, this effectively means thatsolvedoes that work twice, which isn't necessary. Here, I bypassed that in the most simple way I could come up with: just duplicate the body ofsolve!. We might wish to discuss a bit more about this though, since this effectively means that if anyone decides to overloadsolve!, they must also overloadsolvefor these to remain consistent. I think we should probably aim for it never really being necessary to overloadsolve(!)in the first place, so this might be fine, but I could be missing something.