# Enhancement of RWSN Lifetime via Firework Clustering Algorithm Validated by ANN
## 3 The Framework of the Present Study
### Proposed Method  
In this section, a wireless charging vehicle is employed to gather the information from different WSNs divisions. Therefore, the clustering and firework algorithm (FWA-ATF) methods are applied together while considering the whole WSNs performance regarding network lifetime, vacation time, energy consumption, etc. Sensor network deploys \(N\) sensors, and the network is subdivided into \(M\) clusters. The partition line for the network region calculated with the help of a firework algorithm (FWA-ATF). Fireworks algorithm (FWA) is a recently developed swarm intelligence algorithm, and it simulates the explosion process of fireworks in the sky at night [20]. Each location of fireworks represents a solution in the search space. There are two types of sparks, and they are \"explosion spark\" and \"gaussian spark\". In FWA-ATF, initially, objective values are normalized within the range (0,1) which has determined by the equation  
\[f_{i}^{\prime}=\frac{f(x_{i})-y_{min}}{y_{max}-y_{min}} \tag{3}\]  
\(f_{i}^{\prime}\) values are sorted in ascending order. \(y_{min}\) is minimum function value and \(y_{max}\) is maximum function value. The difference of normalized fitness values is calculated as  
\[d_{p+1}=|f_{p}^{\prime}-f_{p+1}^{\prime}|,\ p=1,2,3,\ldots,\ N-1\ \text{and}\ d_{p}=0 \tag{4}\]  
The following equation calculates the adaptive score value  
\[score_{n}=n+\sum_{i=1}^{n}d_{i},\ n=1,2,3,\ldots,N \tag{5}\]  
The adaptive score use in transfer based on the equation  
\[T(n)=\frac{1}{1+e^{(score_{n})}} \tag{6}\]  
The number of \"explosion sparks\" produced by the firework is evaluated by the equation  
\[S_{i}=M\times\frac{T(i)}{\sum_{i=1}^{N}T(i)} \tag{7}\]  
where \(M\), is designated the maximum number of sparks produced by a firework. The amplitude of the \"explosion sparks\" is determined as  
\[A_{i}=A\times\frac{T(N-i+1)}{\sum_{i=1}^{N}T(i)} \tag{8}\]  
where \(A\), represents the maximum amplitude generated by the explosion sparks, when the explosion sparks are generated, a randomly selected element of firework position oscillates with different displacement. The displacement \(\Delta x_{j}\) is determined as  
\[\Delta x_{j}=A_{n}\times rand(-1,1) \tag{9}\]  
Here, \(j\in[1,D]\), is an arbitrary index of the \(n\)th firework dimension. \(rand(-1,1)\) is the equally distributed arbitrary value within the range (\(-1,1\)). Subsequently, generation of explosion spark, arbitrary mutation operator applied to generate the mutated sparks from the fireworks. Initially, a firework is randomly chosen. Furthermore, the locations of the fireworks are arbitrarily chosen and individual chosen \(k\)th location in \(n\)th firework is mutated as  
\[x_{nk}=x_{min}+(x_{max}-x_{min})\times rand(0,1) \tag{10}\]  
Here, \(rand(0,1)\) is an equally dispersed arbitrary number within the range (0,1). The detailed information regarding FWA-ATF algorithm provided in the literature [21]. Cluster validity index Davis-Bouldin (\(DB\)) index [22] use as an objective function. The \(DB\)-index is a function of the ratio of the sum of intra-cluster scatter to the inter-cluster separation. The \(i\)th intra-cluster scatter defined as  
\[S_{i,q}=\left[\frac{1}{N_{i}}\sum_{\forall x\in C_{k}}|\overrightarrow{x}- \overrightarrow{m}_{i}|^{q}\right]^{\frac{1}{q}} \tag{11}\]The inter-cluster distance between the \(i\)th and the \(j\)th cluster defined as  
\[D_{ij}=\left[\sum_{p=1}^{d}|m_{i,p}-m_{j,p}|^{t}\right]^{\frac{1}{t}} \tag{12}\]  
where \(\overrightarrow{m_{i}}\) is the mid-point of the \(i\)th cluster, \(q\), \(t\geq 1\), \(q\), \(t\) an integer, \(N_{i}=|C_{i}|\) are the values present in the \(i\)th cluster \(C_{i}\). \(q\) and \(t\) set as to 2 in this current work. \(R_{i,\ qt}\) is calculated as  
\[R_{i,qt}= \begin{array}{c}\underset{j\in K}{\text{max}}\\ j\in K\\ j\
eq i\end{array}