astro-informatics / sopt

Sparse OPTimisation using state-of-the-art convex optimisation algorithms.
http://astro-informatics.github.io/sopt/
GNU General Public License v2.0
8 stars 10 forks source link

Warm start for sdmm and padmm #84

Closed mdavezac closed 8 years ago

mdavezac commented 8 years ago

Quoting Rafael from astro-informatics/purify#29

Thisis a mistake in the code. Basically we are always initialising xsol as At(y)/nu. We should have the option to receive xsol and z as inputs. In the code right now xsol is initialised to At(y)/nu and z is always initialised to the zero vector. We never took that into account but for the reweighed scheme we need such warm starts.

mdavezac commented 8 years ago

This is needed for #85

mdavezac commented 8 years ago

Added to sdmm the ability to warm-start from its own output:

sopt::Vector<double> const input = sopt::Vector<double>::Random(10)
auto sdmm = sopt::algorithm::SDMM<double>().itermax(10);
// setup sdmm
// ...
// then run it a first time
auto const first_output = sopt::algorithm(input);
// and this will restart pretty much from where it left off
auto const second_output = sopt::algorithm(first_input);

Using the same approach for ADMM and a specialization for adding weights should make #85 fairly simple. It might mean that we need an specialization of SDMM to RI though.

mdavezac commented 8 years ago

There are Behaviour Driven Development test for the sdmm and padmm warm starts. See cpp/tests/*_warm_start.cc and run ./build/cpp/tests/test_sdmm_warm_start -s to see the scenarios. E.g.:

Scenario: SDMM with warm start
     Given An SDMM instance with its input
      When the algorithms runs
      When It is set to stop before convergence
      When A warm restart is attempted
      Then The warm restart is validated by the fast convergence
mdavezac commented 8 years ago

@Luke-Pratley, in order to get the warm start working, I've had to change the interface to ProximalADMM and friends. It now takes no input, or an tuple (x, residual) as an initial guess:

auto const result = padmm();
// or
auto const result = padmm(
  {t_Vector::Random(image.size()), t_Vector::Random(padmm.target().size())});
// or warm-start
auto const result = padmm(previous_result);

// the output and associated residuals are returned:
auto const x_output = result.x;
auto const residual_output = result.residual;

We will have to modify the calls to PADMM in purify when this is merged. Still no Legion, so I won't be merging until I can run the tests there.