# Adaptive Node Clustering Technique for Smart Ocean under Water Sensor Network (SOSNET)
## 4 SOSNET-Proposed Methodology
7.FOR\(i\) where \(i\) starts from 1 to total number of search agents

1.FOR\(j\) where \(j\) starts from 1 to total number of dimensions
2.Update moth position MP(i,j) = (Upper Bound(i) \(-\) Lower Bound(i))/rand( ) + Lower Bound
3.END FOR
8.END FOR
9.WHILE Simulation is not end or stall iteration, i.e., 20 iterations

1.FOR\(\;\)Moth\(i\) where \(i\) starts from 1 to Swarm Size

1.Calculate fitness of each moth position MP (Fitness_of_Moth = FitnessFunction (MP));
2.WHILE list nodes available for clustering is not empty
3.IF for each Moth cluster fitness is less than Best Solution cluster fitness then allocate that Moth to Best Solution END WHILE
2.END FOR
3.Sort the fitness values of moths; Sorted_Fitness();
4.Sort the population; Population_Sorted(); w.r.t\(\;\)Sorted_Fitness();
5.Update the position of best flame obtained so far

1.Score of best flame is equal to Sorted_Fitness(1);
2.Position of best flame is equals to Population_Sorted(1,;)
6.Update the position of the moth w.r.t its corresponding flame
7.FOR\(i\) where \(i\) starts from 1 to total number of search agents

1.FOR\(j\) where \(j\) starts from 1 to total number of dimensions

1.Calculate Distance of the \(i\)th Moth for the \(j\)th flame using distance to flame, which is equal to absolute (Population_Sorted (\(i\),\(j\)) - MP (\(i\),\(j\)))
2.Update the position of moth
3.END FOR
4.END FOR
5.IF convergence curve Iteration is equal to convergence curve Iteration-1

1.stall iteration++;
6.ELSE stall iteration = 0;
7.END IF
8.END IF
9.Iteration++;
10.END WHILE
11.Total number of clusters is equal to best solution (from search space)
12.ENDRecent research has shown that if the criteria of selection of CHs is static, then there are high chances that a single parameter may bias the fitness function and thus result in selection of an inappropriate CH [21; 22; 23; 38]. To counter this problem, SOSNET uses dynamic assignment of weights to its parameters, based on negative impact on the fitness function, depending on the scenario. It first normalizes the value of each parameter in the range from 0 to 10. Then the deviation, which shows the negative impact of the parameter, is calculated for each parameter from its mean by using the following Equation (3):

\[\text{Dev (p)}=\text{ABS (mean}-\text{parameter (p))}. \tag{3}\]

In addition to the above-mentioned equation, another equation is used to penalize outlier parameters, and some penalty is added depending upon the parameter deviation from its mean value. The following Equation (4) is used for this purpose and it computes value for each parameter:

\[w\;(p)=\;\frac{1}{dev\;(p)}. \tag{4}\]

The sum of all the weights must be equal to \"1\". The fitness value for each node is calculated by using the values and their parameters through Equation (1). ## 5 Experimental Setup

The experimentation was carried out using MATLAB version 2018a (The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760, USA), and tested on a corei5, 7 th generation system with 8 GB of RAM. Various experiments were carried out using different values of grid size ranging from 500 to 2000 m. Similarly, the number of nodes used in experiments ranged from 20 to 200. The transmission range for each node was also varied from 25 to 200 m. It was assumed that nodes remained in fixed positions or moved very slowly in the presence of water currents. SOSNET was compared with other state of the art evolutionary clustering protocols: ACO, gray wolf optimization (GWO), and comprehensive learning particle swarm optimization (CLPSO). Table 1 provides the parameters used for simulation. ## 6 Results and Discussion

For measuring the performance of each algorithm, fifty-six simulations were performed, and their results are depicted in Figures 3-7. Two basic parameters, transmission range of nodes and node density, were evaluated with different values for checking the effectiveness of SOSNET. The results show the flexibility and superiority of SOSNET. Figure 3a shows node density of forty nodes with the transmission range set to 25 meters.