JuliaFirstOrder / ProximalAlgorithms.jl

Proximal algorithms for nonsmooth optimization in Julia
Other
130 stars 21 forks source link

Reduce algorithms boilerplate #47

Closed lostella closed 3 years ago

lostella commented 3 years ago

This is a breaking change, mainly aiming at significantly reducing the boilerplate around algorithms (500+ lines are gone from the algorithms implementations), and making the iterable types more usable directly, by having docstrings and default parameters.

Please refer to the changes in tests to get a feeling for the level of breakage (but not everything is covered there).

Most relevant changes:

codecov[bot] commented 3 years ago

Codecov Report

Merging #47 (24b61a5) into master (263a83a) will increase coverage by 0.80%. The diff coverage is 89.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #47      +/-   ##
==========================================
+ Coverage   87.15%   87.96%   +0.80%     
==========================================
  Files          18       18              
  Lines         841      748      -93     
==========================================
- Hits          733      658      -75     
+ Misses        108       90      -18     
Impacted Files Coverage Δ
src/algorithms/primaldual.jl 64.40% <82.75%> (-2.02%) :arrow_down:
src/algorithms/davisyin.jl 94.73% <88.88%> (+2.73%) :arrow_up:
src/algorithms/lilin.jl 77.58% <88.88%> (-1.29%) :arrow_down:
src/algorithms/douglasrachford.jl 95.65% <90.00%> (+5.99%) :arrow_up:
src/algorithms/forwardbackward.jl 95.52% <91.66%> (+2.10%) :arrow_up:
src/algorithms/panoc.jl 94.94% <91.66%> (+1.19%) :arrow_up:
src/algorithms/zerofpr.jl 94.04% <91.66%> (+1.26%) :arrow_up:
src/algorithms/drls.jl 96.49% <94.73%> (+3.63%) :arrow_up:
src/utilities/iterationtools.jl 83.78% <100.00%> (+1.83%) :arrow_up:
src/compat.jl 0.00% <0.00%> (-100.00%) :arrow_down:
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 263a83a...24b61a5. Read the comment docs.

pylat commented 3 years ago

This is a breaking change, mainly aiming at significantly reducing the boilerplate around algorithms (500+ lines are gone from the algorithms implementations), and making the iterable types more usable directly, by having docstrings and default parameters.

Please refer to the changes in tests to get a feeling for the level of breakage (but not everything is covered there).

Most relevant changes:

  • iterable types implementing algorithms have been renamed <AlgorithmName>Iteration
  • iterable types have now a keyword-only constructor thanks to the Base.@kwdef macro
  • thanks to the same macro, default settings within iterables are now straightforward to read
  • the "solver" interface is now much simpler in its implementation (to the point where all look the same, we could almost have a macro defining them)
  • some fields have been renamed
  • some iterables where fixed to avoid in-place modifying the initial iterate (and this is now tested)
  • package version is bumped to 0.5.0 because of the breaking changes
  • Julia requirement is bumped to 1.1 (because of Base.@kwdef)
  • tests were updated

Very interesting macro. (Not to be found in the manual!) It looks good to me. Thanks Stella.