|
Algorithm 1: Smart Ocean Under Water Sensor Network (SOSNET). |
1. START 2. Deploy nodes randomly in 2D grid 3. Each node broadcasts its position 4. Generate mesh topology among all nodes while keeping node IDs as vertex. 5. Calculate distance of each node from other nodes and associate these values to the edges in mesh topology. 6. Initialize Moth Position MP and create search space. 7. FOR i where i starts from 1 to total number of search agents
-
a.
FOR j where j starts from 1 to total number of dimensions
-
b.
Update moth position MP(i,j) = (Upper Bound(i) − Lower Bound(i))/rand( ) + Lower Bound
-
c.
END FOR
8. END FOR 9. WHILE Simulation is not end or stall iteration, i.e., 20 iterations
-
a.
FOR Moth i where i starts from 1 to Swarm Size
-
i.
Calculate fitness of each moth position MP (Fitness_of_Moth = FitnessFunction (MP));
-
ii.
WHILE list nodes available for clustering is not empty
-
iii.
IF for each Moth cluster fitness is less than Best Solution cluster fitness then allocate that Moth to Best Solution END WHILE
-
b.
END FOR
-
c.
Sort the fitness values of moths; Sorted_Fitness();
-
d.
Sort the population; Population_Sorted(); w.r.t Sorted_Fitness();
-
e.
Update the position of best flame obtained so far
-
i.
Score of best flame is equal to Sorted_Fitness(1);
-
ii.
Position of best flame is equals to Population_Sorted(1,:)
-
f.
Update the position of the moth w.r.t its corresponding flame
-
g.
FOR i where i starts from 1 to total number of search agents
-
i.
FOR j where j starts from 1 to total number of dimensions
Calculate Distance of the ith Moth for the jth flame using distance to flame, which is equal to absolute (Population_Sorted (i,j) – MP ( i,j))
Update the position of moth
-
ii.
END FOR
-
h.
END FOR
-
i.
IF convergence curve Iteration is equal to convergence curve Iteration-1
-
j.
ELSE stall iteration = 0;
-
k.
END IF
-
l.
Iteration++;
10. END WHILE 11. Total number of clusters is equal to best solution (from search space) 12. END |