![]() |
SOPT
Sparse OPTimisation
|
L0-approximation algorithm, through reweighting. More...
#include <reweighted.h>
Classes | |
struct | ReweightedResult |
output from running reweighting scheme More... | |
Public Types | |
using | Algorithm = ALGORITHM |
Inner-loop algorithm. More... | |
using | Scalar = typename Algorithm::Scalar |
Scalar type. More... | |
using | Real = typename real_type< Scalar >::type |
Real type. More... | |
using | WeightVector = Vector< Real > |
Weight vector type. More... | |
using | XVector = typename Algorithm::t_Vector |
Type of then underlying vectors. More... | |
using | t_IsConverged = ConvergenceFunction< Scalar > |
Type of the convergence function. More... | |
using | t_Reweightee = std::function< XVector(const Algorithm &, const XVector &)> |
Type of the function that is subject to reweighting. More... | |
using | t_SetWeights = std::function< void(Algorithm &, const WeightVector &)> |
Type of the function to set weights. More... | |
using | t_DeltaUpdate = std::function< Real(Real)> |
Function to update delta at each turn. More... | |
Public Member Functions | |
Reweighted (Algorithm const &algo, t_SetWeights const &setweights, t_Reweightee const &reweightee) | |
Algorithm & | algorithm () |
Underlying "inner-loop" algorithm. More... | |
Algorithm const & | algorithm () const |
Underlying "inner-loop" algorithm. More... | |
Reweighted< Algorithm > & | algorithm (Algorithm const &algo) |
Sets the underlying "inner-loop" algorithm. More... | |
Reweighted< Algorithm > & | algorithm (Algorithm &&algo) |
Sets the underlying "inner-loop" algorithm. More... | |
t_SetWeights const & | set_weights () const |
Function to reset the weights in the algorithm. More... | |
Reweighted< Algorithm > & | set_weights (t_SetWeights const &setweights) const |
Function to reset the weights in the algorithm. More... | |
void | set_weights (Algorithm &algo, WeightVector const &weights) const |
Sets the weights on the underlying algorithm. More... | |
Reweighted< Algorithm > & | reweightee (t_Reweightee const &rw) |
t_Reweightee const & | reweightee () const |
Function that needs to be reweighted. More... | |
XVector | reweightee (XVector const &x) const |
Forwards to the reweightee function. More... | |
t_uint | itermax () const |
Maximum number of reweighted iterations. More... | |
Reweighted & | itermax (t_uint i) |
Real | min_delta () const |
Lower limit for delta. More... | |
Reweighted & | min_delta (Real min_delta) |
t_IsConverged const & | is_converged () const |
Checks convergence of the reweighting scheme. More... | |
Reweighted & | is_converged (t_IsConverged const &convergence) |
bool | is_converged (XVector const &x) const |
template<typename INPUT > | |
std::enable_if< not(std::is_same< INPUT, typename Algorithm::DiagnosticAndResult >::value or std::is_same< INPUT, ReweightedResult >::value), ReweightedResult >::type | operator() (INPUT const &input) const |
Performs reweighting. More... | |
ReweightedResult | operator() () const |
Performs reweighting. More... | |
ReweightedResult | operator() (typename Algorithm::DiagnosticAndResult const &warm) const |
Reweighted algorithm, from prior call to inner-algorithm. More... | |
ReweightedResult | operator() (ReweightedResult const &warm) const |
Reweighted algorithm, from prior call to reweighting algorithm. More... | |
Real | update_delta (Real delta) const |
Updates delta. More... | |
t_DeltaUpdate const & | update_delta () const |
Updates delta. More... | |
Reweighted< Algorithm > | update_delta (t_DeltaUpdate const &ud) const |
Updates delta. More... | |
L0-approximation algorithm, through reweighting.
This algorithm approximates \(min_x ||Ψ^Tx||_0 + f(x)\) by solving the set of problems \(j\), \(min_x ||W_jΨ^Tx||_1 + f(x)\) where the diagonal matrix \(W_j\) is set using the results from \(j-1\): \( δ_j W_j^{-1} = δ_j + ||W_{j-1}Ψ^T||_1\). \(δ_j\) prevents division by zero. It is a series which converges to zero. By default, \(δ_{j+1}=0.1δ_j\).
The algorithm proceeds needs three forms of input:
Definition at line 34 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::Algorithm = ALGORITHM |
Inner-loop algorithm.
Definition at line 37 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::Real = typename real_type<Scalar>::type |
Real type.
Definition at line 41 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::Scalar = typename Algorithm::Scalar |
Scalar type.
Definition at line 39 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::t_DeltaUpdate = std::function<Real (Real)> |
Function to update delta at each turn.
Definition at line 54 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::t_IsConverged = ConvergenceFunction<Scalar> |
Type of the convergence function.
Definition at line 47 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::t_Reweightee = std::function<XVector (const Algorithm &, const XVector &)> |
Type of the function that is subject to reweighting.
E.g. \(Ψ^Tx\). Note that l1-norm is not applied here.
Definition at line 50 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::t_SetWeights = std::function<void (Algorithm &, const WeightVector &)> |
Type of the function to set weights.
Definition at line 52 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::WeightVector = Vector<Real> |
Weight vector type.
Definition at line 43 of file reweighted.h.
using sopt::algorithm::Reweighted< ALGORITHM >::XVector = typename Algorithm::t_Vector |
Type of then underlying vectors.
Definition at line 45 of file reweighted.h.
|
inline |
Definition at line 70 of file reweighted.h.
|
inline |
Underlying "inner-loop" algorithm.
Definition at line 80 of file reweighted.h.
Referenced by sopt::algorithm::reweighted(), and sopt::algorithm::Reweighted< ALGORITHM >::reweightee().
|
inline |
|
inline |
Sets the underlying "inner-loop" algorithm.
Definition at line 89 of file reweighted.h.
|
inline |
Sets the underlying "inner-loop" algorithm.
Definition at line 84 of file reweighted.h.
|
inline |
Checks convergence of the reweighting scheme.
Definition at line 130 of file reweighted.h.
|
inline |
Definition at line 131 of file reweighted.h.
|
inline |
Definition at line 135 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::is_converged().
Referenced by sopt::algorithm::Reweighted< ALGORITHM >::is_converged().
|
inline |
Maximum number of reweighted iterations.
Definition at line 118 of file reweighted.h.
|
inline |
Definition at line 119 of file reweighted.h.
|
inline |
Lower limit for delta.
Definition at line 124 of file reweighted.h.
Referenced by sopt::algorithm::Reweighted< ALGORITHM >::min_delta().
|
inline |
Definition at line 125 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::min_delta().
Reweighted< ALGORITHM >::ReweightedResult sopt::algorithm::Reweighted< ALGORITHM >::operator() |
Performs reweighting.
This overload will compute an initial result without initial weights set to one.
Definition at line 190 of file reweighted.h.
std::enable_if< not(std::is_same< INPUT, typename ALGORITHM::DiagnosticAndResult >::value or std::is_same< INPUT, typename Reweighted< ALGORITHM >::ReweightedResult >::value), typename Reweighted< ALGORITHM >::ReweightedResult >::type sopt::algorithm::Reweighted< ALGORITHM >::operator() | ( | INPUT const & | input | ) | const |
Performs reweighting.
This overload will compute an initial result without initial weights set to one.
Definition at line 183 of file reweighted.h.
Reweighted< ALGORITHM >::ReweightedResult sopt::algorithm::Reweighted< ALGORITHM >::operator() | ( | ReweightedResult const & | warm | ) | const |
Reweighted algorithm, from prior call to reweighting algorithm.
Definition at line 206 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::algo, sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::good, sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::niters, SOPT_ERROR, SOPT_HIGH_LOG, SOPT_LOW_LOG, SOPT_MEDIUM_LOG, sopt::standard_deviation(), and sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::weights.
Reweighted< ALGORITHM >::ReweightedResult sopt::algorithm::Reweighted< ALGORITHM >::operator() | ( | typename Algorithm::DiagnosticAndResult const & | warm | ) | const |
Reweighted algorithm, from prior call to inner-algorithm.
Definition at line 197 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::algo, and sopt::algorithm::Reweighted< ALGORITHM >::ReweightedResult::weights.
|
inline |
Function that needs to be reweighted.
Definition at line 113 of file reweighted.h.
|
inline |
Function that needs to be reweighted
E.g. \(Ψ^Tx\). Note that l1-norm is not applied here.
Definition at line 108 of file reweighted.h.
|
inline |
Forwards to the reweightee function.
Definition at line 115 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::algorithm(), and sopt::algorithm::Reweighted< ALGORITHM >::reweightee().
Referenced by sopt::algorithm::Reweighted< ALGORITHM >::reweightee().
|
inline |
Function to reset the weights in the algorithm.
Definition at line 95 of file reweighted.h.
Referenced by sopt::algorithm::Reweighted< ALGORITHM >::set_weights().
|
inline |
Sets the weights on the underlying algorithm.
Definition at line 102 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::set_weights().
|
inline |
Function to reset the weights in the algorithm.
Definition at line 97 of file reweighted.h.
|
inline |
|
inline |
Updates delta.
Definition at line 153 of file reweighted.h.
References sopt::algorithm::Reweighted< ALGORITHM >::update_delta().
Referenced by sopt::algorithm::Reweighted< ALGORITHM >::update_delta().
|
inline |