# GAFOR: Genetic Algorithm Based Fuzzy Optimized Re-Clustering in Wireless Sensor Networks
## 4 Proposed System Overview and Models
### System Overview
#### 4.1.5 Clustering and Re-Clustering  
With the passing of time, the number of nodes lowers, due to uneven energy usage, and some nodes are left unused in the communication due to the hot-spot problem or network partition. After a while, the average number of sensors declines before it reaches a predefined threshold time \(t\) in a cluster. It makes an adversary task easier, requiring less keys in order to compromise a node. Moreover, in addition to the increased probability of node compromise, it may also have undesirable effects on network lifetime. Aforementioned issues render it challenging to maintain the number of \(t\) nodes in a given cluster.  
In order to reach these nodes, topological parameters (i.e., cluster size and transmission range) need to be adjusted to maintain the \(\tilde{n}_{c}\) in a cluster. In order to determine the time for the next re-clustering, we obtained threshold (\(th_{r}\)) for re-clustering using fuzzy logic. The fuzzy logic system (FLS) uses network conditions (number of depleted nodes, FTR, and energy of a node). In order to obtain optimal threshold value, we use GA for optimized fuzzy membership functions. Thus, with every \(th_{r}\) decrease in nodes (i.e., one step) with an initial n = 1000 sensor nodes, the cluster size and range are increased to maintain \(\tilde{n}_{c}\) and the coverage (i.e., transmission range).  
Deployment of replacement nodes could easily solve this problem; however, physically deploying these nodes is costly, hazardous, and a generally impractical task. Alternatively, we dynamically adjust cluster size and and sensor range to maintain the \(t\) nodes inside a cluster.  
Here, \(t\) is defined as a nodes density (\(\tilde{n}_{c}\)) threshold that should be fixated for a cluster. We assume equal heights and widths for the sensor field and clusters. Let's suppose \(\tilde{n}_{c}\) is our budget for the number of desired nodes per cluster and \(N_{nk}\) is the number of total nodes in the field at the \(k^{th}\) step. The number of \(CHs\) in a row \(N_{CHs}\), or column \(N_{CHs}\) is presented by Equation (2),  
\[N_{CHs}=N_{CHs}=\sqrt{\frac{N_{nk}}{\tilde{n}_{c}}}. \tag{2}\]  
The cluster, k height (C\({}_{th}\)) or width (C\({}_{kw}\)) in sensor field \(F\) having height \(F_{h}\) and width \(F_{w}\) are defined by Equations (3) and (4), respectively, as  
\[C_{th}=\frac{F_{h}}{N_{CHs}\,r} \tag{3}\]  
and  
\[C_{kw}=\frac{F_{w}}{N_{CHs}\,c}. \tag{4}\]  
Therefore, the cluster size at the \(K^{th}\) step with height C\({}_{kh}\) and width \(C_{kw}\) can be represented by Equation (5) as  
\[C_{sizek}=C_{kh}\times C_{kw}=\frac{F_{h}}{N_{r}}\times\frac{F_{w}}{N_{c}}= \frac{\tilde{n}_{c}F_{h}^{2}}{N_{nk}}. \tag{5}\]  
Similarly, the new range, represented by \(R_{k}\) at the \(k^{th}\) step, is defined by Equation (6) as  
\[R_{k}{=}\frac{C_{kh}}{\partial}, \tag{6}\]  
where \(\partial~{}=~{}C_{th}/R_{i}\) is defined as the system design parameter.  
Our proposed method can adjust these parameters to maintain\(N_{CHs}\). At the network setup phase, all nodes are assigned the same fixed amount of energy without any depleted nodes. The proposed scheme keeps track of remaining nodes. We assume that, after a certain number of communications, a number of nodes are declared as depleted as their energy reaches zero. After depletion of \(Th_{r}\) of the total sensors in the network, it resets range \(R_{i}\) and \(C_{sizek}\) along with \(K^{th}\), height, and width i.e., \(C_{hh}\) and \(C_{kw}\) are also readjusted based on the current status of the network.