Skip to main content
. 2021 Jun 30;21(13):4514. doi: 10.3390/s21134514
Algorithm 1. Dragon Fly Optimization based algorithm for UWSNs
1: procedure
2:     Install all nodes in 2D net randomly
3:     Set the direction of each node randomly
4:     Set the velocity of each node
5:     Create MESH topology between all nodes
6:     Calculate the distance between nodes and associate these values to edges
7:     Create search space and initialize dragonflies
8:     Initialize Cmin and Cmax
9:     Compute fitness of early swarm
10:        for iterations = 1 to stall iteration (stall iteration is set to 10)
12:            while (Nodes! = empty)
13:              Nodes clustering = All Node
14:           end while
15:            while I ≤ iterations
16:              for 1 to Population size = 100 (Dragonflies)
17:               Standardize distances Amid Search agents
18:               Update Location of current Search Agent
19:               Bring all Agents with in Upper Bound (UB) and lower bound (LB)
20:             end for
18:              Update Best cost
19:              Iteration+1
20:            end while
21:          Best cost
22:        end for
20: end procedure