Skip to main content
. 2021 Apr 9;7:e464. doi: 10.7717/peerj-cs.464

Algorithm 1. FindPUGS algorithm: finding (nearly-optimal) prototypes using greedy search.

Result: Two ordered lists, N and R, of the minimum number of prototypes required for each circle and their rotations relative to the previous circle.
T ← the number of circles
c ← the length by which radii should grow
Algorithm FindPUGS (T, c)
N ← [1]
R ← [0]
for t = 1,2,…,T – 1 do
  mN[−1];
  n ← m + 1;
  p ← 0;
  while True do
    da2t2c22t2c2cos(πm);
    db2(t+1)2c22(t+1)2c2cos(πn);
    for i = 0,1,…,4mn do
      θiπmn16
      if d1(t,c,m,n,θ) > db and d2(t,c,m,n,θ) > da then
        pn
        break
      end
    end
    if p>0 then
      N.append(p);
      R.append(θ);
      break;
    end
    nn+1
  end
end
return N, R;
Procedure d1 (t,c,m,n,θ)
 dists ← [];
for i = 0,…,m – 1 do
   for j = 0,…,n − 1 do
     dist t2c2+(t+1)2c22t(t+1)c2cos(2iπm2jπnπnθ);
     dists.append(dist);
   end
end
return min(dists);
Procedure d2 (t,c,m,n,θ)
 dists ← [];
for i = 0,…,m − 1 do
   for j = 0,…,n − 1 do
    dist t2c2+(t+1)2c22t(t+1)c2cos(2iπm2jπn+πmθ);
    dists.append(dist);
   end
 end
return min(dists);