Line data Source code
1 : #pragma once 2 : 3 : #include "Constraint.h" 4 : #include "L0PseudoNorm.h" 5 : #include "L1Norm.h" 6 : #include "WLSProblem.h" 7 : #include "LASSOProblem.h" 8 : 9 : namespace elsa 10 : { 11 : /** 12 : * @brief Class representing a splitting problem 13 : * 14 : * @author Andi Braimllari - initial code 15 : * 16 : * @tparam data_t data type for the domain and range of the problem, defaulting to real_t 17 : * 18 : * This class represents a splitting problem i.e. 19 : * 20 : * - minimize @f$ f(x) + g(z) @f$ subject to @f$ Ax + Bz = c @f$. 21 : * 22 : * in which @f$ A @f$ and @f$ B @f$ are linear operators, @f$ c @f$ is a data vector. 23 : * 24 : * References: 25 : * https://stanford.edu/~boyd/papers/pdf/admm_distr_stats.pdf 26 : */ 27 : template <typename data_t = real_t> 28 : class SplittingProblem : public Problem<data_t> 29 : { 30 : public: 31 : /** 32 : * @brief Constructor for SplittingProblem, accepting a functional, regularization terms and 33 : * a constraint 34 : * 35 : * @param[in] f the functional from the problem statement 36 : * @param[in] g the regularization terms from the problem statement 37 : * @param[in] constraint the constraint from the problem statement 38 : */ 39 : SplittingProblem(const Functional<data_t>& f, 40 : const std::vector<RegularizationTerm<data_t>>& g, 41 : const Constraint<data_t>& constraint); 42 : 43 : /** 44 : * @brief Constructor for SplittingProblem, accepting a functional, a regularization term 45 : * and a constraint 46 : * 47 : * @param[in] f the functional from the problem statement 48 : * @param[in] g the regularization term from the problem statement 49 : * @param[in] constraint the constraint from the problem statement 50 : */ 51 : SplittingProblem(const Functional<data_t>& f, const RegularizationTerm<data_t>& g, 52 : const Constraint<data_t>& constraint); 53 : 54 : /// default destructor 55 24 : ~SplittingProblem() override = default; 56 : 57 : /// return the constraint 58 : auto getConstraint() const -> const Constraint<data_t>&; 59 : 60 : /// return the f problem 61 : auto getF() const -> const Functional<data_t>&; 62 : 63 : /// return the g problem 64 : auto getG() const -> const std::vector<RegularizationTerm<data_t>>&; 65 : 66 : protected: 67 : /// implement the polymorphic clone operation 68 : auto cloneImpl() const -> SplittingProblem<data_t>* override; 69 : 70 : /// the evaluation method of the splitting problem 71 : auto evaluateImpl() -> data_t override; 72 : 73 : /// the getGradient method for the splitting problem 74 : void getGradientImpl(DataContainer<data_t>& result) override; 75 : 76 : /// the getHessian method for the splitting problem 77 : auto getHessianImpl() const -> LinearOperator<data_t> override; 78 : 79 : /// the getLipschitzConstant method for the splitting problem 80 : auto getLipschitzConstantImpl(index_t nIterations) const -> data_t override; 81 : 82 : private: 83 : std::unique_ptr<Functional<data_t>> _f; 84 : 85 : std::vector<RegularizationTerm<data_t>> _g; 86 : 87 : std::unique_ptr<Constraint<data_t>> _constraint; 88 : }; 89 : } // namespace elsa