# An Energy-Efficient Evolutionary Clustering Technique for Disaster Management in IoT Networks
## 3 Proposed Method
### Cluster Head Selection Phase
#### 3.3.4 Clustering Steps  
After the initialization of parameters, which is presented in the simulation setup (Section 4), the clustering phase consists of the following steps. * Setting the Location and Velocity of the Particles The location and velocity of the particles are placed randomly in the following intervals, respectively: \([x_{min},\ x_{max}]\) and \([v_{min},\ v_{max}]\).The particle swarm size and harmony memory size (HMS) are initialized under the title of particle harmony memory (PHM). The initial PHM matrix [29], as shown in Equation (19), includes the number of random solutions generated to reach the optimal or near-optimal solution. Each row in the \(HMS\times K\) matrix is a random solution, and the fitness function for each vector is calculated by Equation (18). \[ \begin{bmatrix}\text{I}_{1}^{\text{I}}&\text{I}_{2}^{\text{I}}&\dots&\text{I}_ {k}^{\text{I}}\\ \text{I}_{1}^{\text{I}}&\text{I}_{2}^{\text{I}}&\dots&\text{I}_{k}^{\text{I}} \\ \vdots&\vdots&\ddots&\vdots\\ \text{I}_{1}^{HMS}&\text{I}_{2}^{HMS}&\dots&\text{I}_{k}^{HMS}\\ \end{bmatrix}\begin{bmatrix}\text{\bf f}_{\text{clustering}\_1}\\ \text{\bf f}_{\text{clustering}\_2}\\ \vdots\\ \text{\bf f}_{\text{clustering}\_1}\\ \text{\bf f}_{\text{clustering}\_1}\\ \end{bmatrix} = \begin{bmatrix}\text{F}^{\text{I}}\\ \text{\bf f}^{\text{I}}\\ \text{\bf f}^{\text{I}}\\ \vdots\\ \text{\bf f}^{\text{I}}\\ \end{bmatrix} \] (19)
* Improving Harmony Vectors for PHM and Updating the Hybrid Matrix After PHM is defined, new harmony vectors \([I^{\prime}{}_{1},\ I^{\prime}{}_{2},\dots,\ I^{\prime}{}_{k}]\) should be produced to improve the harmony vectors of the PHM. Each component of the new harmony vectors is generated by harmony memory considering the rate (HMCR), and eventually an optimal candidate vector of PHM is modified by the pitch adjusting rate (PAR). In this step, the state-of-the-art method [29] uses the simple structure of HSA, but attention must be paid to variations in different stages of the search process. Additionally, the study in [34] demonstrated that HSA suffers from a slow convergence speed to achieve a global optimum; however, in [31], the dynamic version of HSA exhibited fast convergence at the start of the algorithm, converging to the global optimum in the near-final stages of the search process. Therefore, in this paper, each harmony vector (HV) of the PHM is obtained dynamically. The procedure of improving the harmony vectors for PHM is described in Algorithm 1[31]. where Nd1 and Nd2 are normal distribution functions with (\(\mu=0,\sigma=1\)), ri1 and ri2 are random integers between [1, HMS], ri3, ri4 and ri5 are random mutually exclusive integers between [1, HMS], the function \(randn()\) is a uniform random number in \([0,1]\), and parameter k is generated uniformly by a discreet random number in [1, K][31]. After method 1 in Algorithm 1, if \(randn()\)\(\leq\) PAR, the harmony vector (HV) should be tuned or pitched (a term in music) according to the PAR. \(\mathrm{I}_{x}^{n}\) is defined as the closest node with more energy than current CH is the cluster. It is necessary to clarify that parameter best in update 2 as the index of the best HV inspired by the GHS method [45]. Next, updating the PHM is the last step in the HS algorithm [29]. To do this, if the fitness function of the new harmony vector (\(\mathrm{I}_{x}^{n}\)) is better than the value of the fitness function of the worst harmony vector in PHM (\(f(\mathrm{I}_{x}^{n})>f(HV_{x}^{worst})\)), the new harmony is included in the matrix and the current worst harmony of the PHM is excluded. Thus, the PHM is updated with this condition, and this step is stopped If the iteration of HSA is bigger than the maximum iteration. * Updating the Location and Velocity of the Particles In this step, to reach the optimal location of the CHs, the PSO algorithm updates the location and velocity of the particles [2]. The best particle location (\(p\_b\)) is determined by the minimum cost of the fitness function in a swarm particle [29].