Line data Source code
1 : #pragma once 2 : 3 : #include <optional> 4 : 5 : #include "DataContainer.h" 6 : #include "LinearOperator.h" 7 : #include "Solver.h" 8 : #include "StrongTypes.h" 9 : #include "ProximalOperator.h" 10 : 11 : namespace elsa 12 : { 13 : /** 14 : * Linearized Bregman solves problems of form: 15 : * @f[ 16 : * \min_{x} \frac{1}{2\mu} || A x - b ||_2^2 + |x| 17 : * @f] 18 : * 19 : * by iteratively solving: 20 : * @f[ 21 : * \begin{aligned} 22 : * x^{k+1} & =\mu \cdot \operatorname{shrink}\left(v^k, 1\right) \\ 23 : * v^{k+1} & =v^k+\beta A^{\top}\left(b-A x^{k+1}\right) 24 : * \end{aligned} 25 : * @f] 26 : * 27 : * References: 28 : * - https://arxiv.org/pdf/1104.0262.pdf 29 : * - https://arxiv.org/pdf/1106.5413.pdf 30 : */ 31 : 32 : template <typename data_t = real_t> 33 : class LB : public Solver<data_t> 34 : { 35 : public: 36 : /// Construct Linearized Bregman 37 : LB(const LinearOperator<data_t>& A, const DataContainer<data_t>& b, 38 : const ProximalOperator<data_t>& prox, data_t mu = 5, 39 : std::optional<data_t> beta = std::nullopt, data_t epsilon = 1e-5); 40 : 41 : /// make copy constructor deletion explicit 42 : LB(const LB<data_t>&) = delete; 43 : 44 : /// default destructor 45 4 : ~LB() override = default; 46 : 47 : DataContainer<data_t> 48 : solve(index_t iterations, 49 : std::optional<DataContainer<data_t>> x0 = std::nullopt) override; 50 : 51 : protected: 52 : /// implement the polymorphic clone operation 53 : auto cloneImpl() const -> LB<data_t>* override; 54 : 55 : /// implement the polymorphic comparison operation 56 : auto isEqual(const Solver<data_t>& other) const -> bool override; 57 : 58 : private: 59 : /// The LASSO optimization problem 60 : std::unique_ptr<LinearOperator<data_t>> A_; 61 : 62 : DataContainer<data_t> b_; 63 : 64 : ProximalOperator<data_t> prox_; 65 : 66 : /// wage of fidelity term 67 : data_t mu_; 68 : 69 : /// step size 70 : data_t beta_; 71 : 72 : /// variable affecting the stopping condition 73 : data_t epsilon_; 74 : }; 75 : } // namespace elsa