## 3 The Proposed System
### Intra-Cluster and Inter-Cluster  
The clustering procedure is optimized by attempting to determine both the CH nodes and the cluster member's ideal placements in each cluster to improve both intra-cluster \(f_{intra}\) and inter-cluster \(f_{inter}\) communications. To construct compact clusters, decreasing the distances among all of the sensor nodes and their corresponding CH is the key to improving intra-cluster communication. Improving inter-cluster communication requires reducing distances between the BS and CH nodes, while also increasing average distances between each CH node and other CH, effectively covering network regions. \(f_{intra}\) and \(f_{inter}\) are denoted can be represented as in Equations (24) and (25), respectively [29]:  
\[f_{intra}=\frac{1}{NN}\sum_{i=1}^{NN}dist(N_{i}.CH_{m}) \tag{24}\]\[f_{inter}=\frac{avgD}{\frac{1}{c}\sum_{m=1}^{c}\sum_{N=1.m<m}^{c}dist(CH_{m}.CH_{N})} \tag{25}\]  
where  
* \(c\): the number of clusters.
* \(avgD\): the average distance between the \(BS\) and the \(CHs\).
* \(dist(CH_{m}\). \(CH_{N})\): the distance between two cluster heads \(CH_{m}\) and \(CH_{N}\).  
Many relative parameters, such as the alive nodes number and energy consumption, are used to measure and compare the performance of algorithms in WSNs using Matlab 2017b and take into consideration the comparative analysis and protocols of both the dead and alive nodes. In this case, the system is introduced with different levels of energy represented by progressive and normal nodes. The individually progressive node energy is more than the energy of each normal node; the increasing factor for the progressive can be represented using energy factor (a) where the energy increased directly by (1 + a) times of the normal nodes, where a is the factor.  
The distribution of BS, cluster heads, and sensor nodes for some algorithms (LEACH, HHO, COYOA, and Genetics) are represented as shown in Figure 2a-c.  
Simulation parameters of the proposed algorithms and protocols are listed in Table 1. A scenario of the proposed algorithm is established in which the location of the BS will change according to the area dimension 100 \(\times\) 100. The implementation is based on three different scenarios. In the first scenario, BS is at (0,0) at the start of the area coordination. In the second scenario, BS is at the centre of the area (50,50). In the third scenario, BS is at the corner of the area coordination (100,100). The heterogeneous system is started with initiated energy of different levels for CHs and normal nodes. The CHs energy is equal to (1 + a) times more than the energy of each normal node, where (a) is the energy factor.  
Figure 2: Distribution of the network elements (BS, CHs, and SNs) in the network area. (**a**) Sensor BS Location (0,0). (**b**) Sensor BS Location (50,50). (**c**) Sensor BS Location (100,100).  
After the components of the wireless sensor network are distributed, the network elects the head clusters, which verify the condition of the communication range with the neighbour nodes. Black nodes represent the dead nodes that cannot verify the condition. The number of alive nodes per round shows the power of the proposed algorithms.