-
Notifications
You must be signed in to change notification settings - Fork 18
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
Algorithms refactoring #18
Algorithms refactoring #18
Conversation
aren't these PR complementary somehow? |
I think this clashes with #17 since it modifies the algorithms code in many places; on the other hand, this includes #17, since it also removes the dependency on tuples. This said, it's perfectly fine for me to merge #17 (as soon as it works) and then I'll rebase this PR on top of that. I would just avoid doing unnecessary work, for example if making #17 work requires time and then this PR overwrites it almost completely. |
I see that you have the LBFGS operator here. Shouldn't we keep it in one place only? Personally I would prefer having it in AbstractOperators although I see that it belongs to this package as well. |
e1dc19f
to
eb85b0a
Compare
@nantonel it's ok to duplicate code in this case in my opinion (since here it's not really user-facing) in favor of having more compact code: anyone wanting to dig into L-BFGS-based algorithms only needs to explore this package. |
Codecov Report
@@ Coverage Diff @@
## master #18 +/- ##
==========================================
+ Coverage 92.41% 93.93% +1.52%
==========================================
Files 12 12
Lines 593 445 -148
==========================================
- Hits 548 418 -130
+ Misses 45 27 -18
Continue to review full report at Codecov.
|
6581d1b
to
f115ac0
Compare
I still need to finish up a bit with tests (it would be great to re-include tests using SeparableSum and ArrayPartition), but I'm fairly satisfied with the rest of the refactoring. I would kindly ask reviews from @nantonel (in particular: changes in the algorithms APIs and their implications on higher level packages, i.e. StructuredOptimization.jl) and @pylat (in particular: primal-dual algorithms and tests). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks quite nice and clean. I must confess, I didn't check thoroughly. Everything that I checked seems to be in order. I am annoyed by this ugly stepsize selection but I remember that it was inevitable.
Thanks, Puya. I think the default selection for gamma1 and gamma2 is fine, however complicated, as long as it's well separated from the rest of the code (interface, initialization, iteration). It's also much better than having people have to manually select gamma1 and gamma2, of course :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this hard work! I've made some minor comments: I suppose a couple of allocations could be reduced and some type instability fixed (especially in DRS family) but perhaps we can leave this to future PRs. I suppose we could enable verbose in some tests, should slightly improve coverage? Before tagging a new version, let's wait and fix StructOpt first.
src/algorithms/douglasrachford.jl
Outdated
|
||
struct DRS_iterable{R <: Real, C <: Union{R, Complex{R}}, T <: AbstractArray{C}} | ||
f | ||
g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f
and g
shouldn't be typed? of course this can be fixed on a later PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course they should. And I should be less lazy :-p
I'm adding all these to the TODO list on top, and will add the changes before merging
end | ||
|
||
function Base.iterate(iter::FBS_iterable{R}, state::FBS_state{R, Tx, TAx}) where {R, Tx, TAx} | ||
Az, f_Az, grad_f_Az, At_grad_f_Az = nothing, nothing, nothing, nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this could be initialised already when constructing state
in Base.iterate(iter::FBS_iterable{R})
?
Or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean having additional fields for these in the state
? Yes, that could be, that could save some allocations I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've addressed everything except for this: I would open a separate issue and leave it to a separate PR, from what I've seen algorithms perform already very good like this
end | ||
|
||
function Base.iterate(iter::PANOC_iterable{R}, state::PANOC_state{R, Tx, TAx}) where {R, Tx, TAx} | ||
Az, f_Az, grad_f_Az, At_grad_f_Az = nothing, nothing, nothing, nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
src/algorithms/primaldual.jl
Outdated
g | ||
h | ||
l | ||
L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as DRS
@nantonel I think coverage is OK now: one thing to do is removing Coveralls also here, since it is more confusing than useful. Of course we’ll wait before tagging: we first need to understand how package registration now works :D |
94a55c2
to
8e02008
Compare
This is a work in progress, but I thought it's better to open a CR already before we discuss about #17
Edit
Adding a bit of description. This PR is meant to:
Tuple{AbstractArray}
in favor of justAbstractArray
(with the idea of usingArrayPartition
in place ofTuple
, whenever this is needed)Todo list:
ArrayPartition
-related definitions in testsArrayPartition
REQUIRE
files, addProject.toml
(see here)FBS
andPANOC
Edit 2: this should fix #12, #16, and #19