# Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme in Intrabody Nanonetworks
## 3 Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme
### System Architecture  
A possible healthcare monitoring system is composed of an IBNN and an external healthcare system. IBNN consists of two kinds of nanodevices, namely, NBSs and nanorouters implanted inside the human body. NBSs have severe constraints in terms of energy, transmission range, storage and computational resources. While nanorouters have more resources than NBSs and they are responsible for handling more complex operations such as collecting data from NBSs, performing complex computational operations and transmitting collected information to the external healthcare system using nanointerface. Nanointerface is connected to the external healthcare system through the internet for remote data transmission. The communication is carried out until the IBNN is dead. Figure 2: The complete working of the routing scheme proposed in this work. Network Model Assumption and Definitions  
We describe our network model as a undirected graph \(G=(V,E)\), where \(V\) denotes set of NBSs and nanorouter (vertices), represented as \(V\in(nr,nbs)\) and \(E\) is the set of edges connecting vertices. In a scenario where an edge is directly connecting \(nr\) and \(nbs_{i}\) to each other, they are said to be neighbors. The neighbors of router \(nr\) are defined as \(N(nr)=\{nr|nr(nr,nbs_{i})\in E\}\). The one-hop neighbor set of \(nr\) is a symmetric graph \(G^{\prime}=(V,E)\), where given any two pairs of adjacent vertices \(nr\)--\(nbs_{1}\) and \(nr\)-\(nbs_{2}\) of \(V\), bidirectional edge \(E\) exist. Definition 1: When several NBSs are located in the transmission range of a nanorouter \((r_{i})\), a cluster is formed that is expressed as:  
\[Cluster_{members}(nr)= \begin{cases}1&\text{if }\{nbs_{1},nbs_{2},\ldots nbs_{n} \}\in TR(nr),\\ 0&\text{otherwise}\end{cases}  \tag{1}\]  
where \(TR(nr)\) is the transmission radius of the nanorouter \(nr\). Nanorov outer \(nr\) is responsible for collecting detected information from its cluster members and transmitting it to the external healthcare system. Definition 2: The transmission radius of a nanorouter \((nr)\) is divided into small correlated region, such that the value observed by the NBSs in that spatially correlated region are considered similar (for the application). The correlated region of nanorouter \(nr\) are expressed as \(\{cr_{1},cr_{2},cr_{3},cr_{n}\}\in nr\). Instead of collecting data from all deployed NBSs, data is aggregated from the optimal number of NBSs, which is sufficient to represent the correlated region \(CR_{i}\). The size of the correlation region varies according to the type of application and event characteristics. For those applications that demand a high level of accuracy, the size of the correlation region can be decreased. While for the event characteristics that do not change significantly at a small range, the size of the correlation region can be increased. In this work, the size of the correlated region is defined during the simulation setup time. Definition 3: Participating correlated regions are selected before the data collection process based on the output of the fuzzy logic decision, the detailed selection process is given in the Section 3.2. Definition 4: NBSs selection from participating correlated regions is performed based on the bio-inspired firefly algorithm fitness value. The complete process is demonstrated in the Section 3.3. Definition 5: The lifetime of IBNN is evaluated based on the number of alive NBSs **(m-in-k-of-n nodes)**[58]. The total number of NBSs are divided into two groups; directed -- neighbors -- to -- nanorouter and non -- directed -- neighbors -- to -- nanorouter denoted as \(NBS_{D}\) and \(NBS_{ND}\), respectively. According to the **(m-in-k-of-n nodes)** approach, the group of \(NBS_{ND}\) are characterized as non-critical NBSs, which means death of k NBSs is allowed from \(NBS_{ND}\). While no failure of NBSs from the group of \(NBS_{D}\) is tolerable.