# Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme in Intrabody Nanonetworks
## 3 Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme
### Bio-Inspired Firefly Algorithm Based NBSs Selection
Figure 7: Residual energy comparison of our proposed scheme with flooding scheme and different scenarios (A and B) with respect to increasing request rate interval and NBSs density of 100. (**a**) Residual energy comparison at request rate interval 0.2. (**b**) Residual energy comparison at request rate interval 0.3. (**c**) Residual energy comparison at request rate interval 0.4. (**d**) Residual energy comparison at request rate interval 0.5. Network Lifetime with the Density of 100 NBSs and Increasing Request Rate Intervals

Figure 9 clearly depicts that the maximum number of alive NBSs are obtained for the 0.5 request rate interval. Since at interval 0.5, requests are generated at the minimum number. Our proposed scheme achieves the maximum network lifetime due to our selection strategy that balances the message generation load among all the NBSs. In addition, the selection of NBSs based on the their fitness value also supports in preventing energy consumption in those NBSs that have low remaining energy. While Flooding scheme results in a minimum network lifetime for all the intervals due to the involvement of all the NBSs. From Figure 9a-d, it is evident that scenarios A and B do not provide improved network lifetime alone, without combining them to achieve the goal of maximum network lifetime. Network Lifetime with the Density of 200 NBSs and Increasing Request Rate Intervals

From Figure 10, it is evident that increasing the density of NBSs improves network lifetime. However, the increasing density also influences the rate of packet generation. In our proposed scheme, the network lifetime remains almost the same for increasing the density of NBSs due to our proposed selection scheme. While in both scenarios A and B, the number of dead NBSs increases with the

Figure 9: Comparison of total number of alive NBSs in our proposed scheme with flooding scheme and different scenarios (A and B) with respect to increasing request rate interval and NBSs density of 100. (**a**) Total number of alive NBSs at request rate interval 0.2. (**b**) Total number of alive NBSs at request rate interval 0.3. (**c**) Total number of alive NBSs at request rate interval 0.4. (**d**) Total number of alive NBSs at request rate interval 0.5.

increase in the request rate interval. Similarly, the flooding scheme experienced the minimum network lifetime for all the intervals. 1.3 Average Remaining Energy Comparison at the End of Simulations with Increasing Request Rate Interval and NBSs Density

The remaining energy at the end of the simulation with different NBSs density is represented in Figure 11. The Figure shows that our proposed scheme outperforms all the other scenarios and flooding scheme for both densities of NBSs. By combing the characteristics of fuzzy logic and bio-inspired firefly algorithm, our proposed scheme results in the highest remaining energy. While in both scenarios A and B, the remaining energy is almost similar due to the optimal selection of correlated regions and NBSs. Flooding scheme has the lowest remaining energy due to the participation of all the NBSs in data reporting, which also significantly increases the overall packet forwarding rate. Therefore, the flooding scheme consumes more energy. Figure 10: Comparison of total number of alive NBSs in our proposed scheme with flooding scheme and different scenarios (A and B) with respect to increasing request rate interval and NBSs density of 200. (**a**) Total number of alive NBSs at request rate interval 0.2. (**b**) Total number of alive NBSs at request rate interval 0.3. (**c**) Total number of alive NBSs at request rate interval 0.4. (**d**) Total number of alive NBSs at request rate interval 0.5. #### 4.1.4 Average End-to-End Delay

Average end-to-end delay is defined as the time a packet takes from its transmission till the reception.