I am trying to follow the paper describing a method to project a point x^0 onto the set C:=\{x : x\in kB_0 \cap x\in \Delta B_\infty\} where kB_0=\{x : ||x||_0\leq k\} and \Delta B_\infty=\{x:||x||_\infty\leq\Delta\}. It is said that such a method is implemented in the ShiftedProximalOperators
package, but I have not been able to find it. When I tried to implement the projection in the package as below, I wasn’t sure how to add the indicator of kB_0; below only seems to add regularization. I know that there is a regularization parameter that corresponds to the projection, but am I missing an easy way to use the package to do projection?
using ShiftedProximalOperators, Random
Random.seed!(12345)
# Parameters
n = 10 # dimension
k = 3 # sparsity
δ = 1.0 # infinity norm bound
x0 = randn(n) * 3 # input vector
# define ℓ₀ pseudo-norm
h = ShiftedProximalOperators.NormL0(1.0)
# create ShiftedNormL0Box
xk = zeros(n) # no shift
sj = zeros(n) # no shift
l = -δ*ones(n) # lower bound
u = +δ*ones(n) # upper bound
selected = sortperm(abs.(x0), rev=true)[1:k]
ψ = ShiftedProximalOperators.ShiftedNormL0Box(h, xk, sj, l, u, false, selected)
# project onto feasible set
xproj = similar(x0)
σ = 1.0
julia> prox!(xproj, ψ, x0, σ)
10-element Vector{Float64}:
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
-1.0
1.0
1.0
When if I repeat the above with h = ShiftedProximalOperators.NormL0(1.0e6)
, I get
julia> prox!(y, ψ, q, σ)
10-element Vector{Float64}:
-0.0
-1.0
1.0
1.0
-1.0
-0.0
1.0
-0.0
1.0
1.0
where the zeros correspond to the indices in selected
.