Skip to main content
. 2019 Sep 2;5:e217. doi: 10.7717/peerj-cs.217

Algorithm 2. GWRA.

1: Input: CS matrix φM × N, measurement vector y and sparsity level K.
2: Output: estimated solution set x′:
Initialization phase:
3: R ≜ {indices of the q largest magnitude entries in φTy}.
4: Initialize the grey wolf population matrix Xi × K with random integers between [1, N].
5: Xα = zeros (1, K), Xβ = zeros (1, K), Xδ = zeros (1, K).
6: best = Secbest = thirbest = ∞.
7: x′ = ø, ε = 10−5 and t = 1.
Reconstruction phase:
8: while (t < tmax||best > ε)
9:  for each row i of the matrix Xi × K do
10:   C = Union(R, Row #i of Xi × j)
11:   I ≜ {indices of the K largest magnitude entries in φc y}.
12:   L = φI.
13:   Calculate the fitness value f(L) using Equation 12.
14.   If(best > f(L)), then
15:     Xα = I,
16:   Else If (best < f(L) && Secbest > f(L)), then
17:     Secbest = f(L) and Xβ = I.
18:   Else If (best < f(L) && Secbest < f(L) && thirbest > f(L)), then
19:     thirbest = f(L) and Xδ = I.
20:   End If
21:   Set R = I.
22:   end for
23: Wolf positions updating step:
24:    Update a, A, and C
25:   for each search agent
26:     Update the position of the current search agent by Equation (13).
27:    end for
28:    t = t + 1
29: End while
30: return x′ where x′I = Ly and x′S−I = Ly where S = [1, 2… N].