Skip to main content
. 2018 Feb 10;18(2):545. doi: 10.3390/s18020545
Algorithm 2: The minimum inter-cluster interference strategy based on improved virtual force and motion.
Input: AP={ap1,ap2,,apz} and NAP, APPosition_old={ apPositon_old1,apPositon_old2,}, FTH
Output: APPositon_new
1 Initialization: Max_interation; C; apPositon_old
2 While (h < Max_interation)
3 if |Fh| |Fh1|
4   for j = 1; j ≤ |AP|; j++ do
5    Calculate the virtual force Fj of apj according to Equations (15)–(18);
6    if Fj > 0
7    Calculate the maximum move distance dp according to Equation (20);
8     if dp > dmove_step // Ensure that the cluster head covers its target points
9      din ← dmove_step
10     else
11      din ← dp
12     end if
13     Update the new position of apPositon_old according to Equation (22)
14     if apposition_newA // Evaluate whether the new position is in A
15      apposition_newchposition_new
16     else
17      apposition_old ← the corresponding boundary value of A
18     end if
19    Move the cluster head to the new position
20    apposition_newchposition_new
21    end if
22    Compute the total virtual force of the entire network F
23   end for
24 end if
25 end while
26 Return APPosition_new // Return the new position of the cluster heads