# GAFOR: Genetic Algorithm Based Fuzzy Optimized Re-Clustering in Wireless Sensor Networks
## 4 Proposed System Overview and Models
### System Overview
#### 4.1.7 GA-Based Optimization  
In order to determine optimized fuzzy membership functions, a GA-based membership function optimizer for re-clustering is illustrated in Figure 5. A chromosome represented one trial set of fuzzy membership functions. The optimizer consists of the GA unit (GAU), the simulation unit (SU), and the fitness evaluation unit (FEU), as illustrated in Figure 6.  
Figure 4: Fuzzy members, fuzzy sets, and rules for re-clustering.  
Figure 5: Standard & optimized fuzzy inputs membership functions.  
Figure 6: GA-based membership function optimizer for re-clustering.  
* GAU: The GA-based optimization process begins, and the GAU initiates the population. It randomly generates and maintains a population. Chromosomes from the population are evaluated by the simulation and their fitness value is computed using simulation results.
* SA: SU starts simulations using chromosomes from the population, and the chromosomes are generated by the population of randomly generated bit strings. The bit string representation of chromosomes render it feasible to employ mutation and crossover operations. The performance parameters or membership function as highlighted in the corresponding fuzzy system are measured in the simulation process.
* FEU: Based on the simulation results for all chromosomes being finished, the fitness value representing the threshold value is computed by the FEU. The fitness value of the re-clustering threshold (\(F_{RT}\)) of chromosomes is shown in Equation (7), \[F_{RT}=DN\times\left(1-\frac{\alpha}{2}\right)+\left(TE+AF\right)\times\left(1 -\frac{\beta}{2}\right),\] (7) where \(DN\) is the total number of depleted nodes, TE is the total energy consumed in the sensor network, AF is average FTR, and \(\alpha\), \(\beta\) are weighted factors for these parameters.  
Based on the current fitness value, the GA unit evolves the current population. In order to produce the next generation of chromosomes, selection, crossover, and mutation operations are applied to the population in GA. The optimization process in GAFOR--(1) simulation, (2) evaluation, and (3) evolution--is repeated until the exit condition becomes true. In order to avoid local optimal, a high mutation probability or tolerance are beneficial for a globally optimized solution. The entire optimization process is processed within the simulation experiments. There is one simulation setup for optimization and three different and diverse experimental evaluation setups to apply our method.  
After the threshold calculations are completed, the new values of membership function are obtained based on these optimized membership functions being calculated. Based on these new membership functions, the corresponding final (\(Th_{m}\)) is optimized for the best performance based on network conditions, not guesses or experiences. It does not require many resources as, after optimization, the optimizer is terminated and the threshold obtained for re-clustering is used on wards.  
Terminating condition: The terminating condition is satisfied when the fitness value of the highest ranking solution has reached a steady state such that further iteration no longer produces better results. For that purpose, we used tolerance \(\tau\)=10 for optimization. Therefore, when there is no significant performance improvement after 10 consecutive iterations, we terminate the optimization.