Skip to main content
. 2022 Dec 12;22(24):9731. doi: 10.3390/s22249731
Algorithm 2: The vice cluster-head election
Input: all member nodes and their primary cluster-heads within K clusters
Output: all vice cluster-heads in the set C2
-----------------------------------------------------------------------------------------------------------------
(1) For each cluster
(2)     For member nodes in the same cluster except the primary cluster-head
(3)          Calculate the residual energy objective function f1(i) and the distance function f3(i) of each node, respectively
(4)               If the sum of residual energy of all nodes is greater than half of the initial energy of the network (0.5 * nE0)
(5)                 Calculate the node adaptation function value according to Q(i) = 1/2 *f1(i) + ½ * f3(i)
(6)               Else
(7)                   Calculate the node adaptation function value according to Q(i) = Eres(i)E0*f1(i) + (1 − Eres(i)E0)/2 * f3(i)
(8)      Find the node with the largest fitness function value and save this node in formation in the set C2
(9) End