# Firefly Optimized Resource Control and Routing Stability in MANET +
## 3 Design of Firefly Resource-Optimized Routing (FFROR) Technique
The light intensity is a function of distance '\(r\)' mathematically formulated as  
\[L_{l}(r)=L_{o}e^{-\gamma r}. \tag{4}\]  
From (4), '\(L_{o}\)' represents the actual light intensity, and '\(\gamma\)' denotes the light absorption coefficient. A firefly's attractiveness is associated with the light intensity seen by adjacent fireflies. The attractiveness '\(A\)' of a firefly is represented as follows:  
\[A=A_{o}\textrm{exp}(-\gamma r^{m}),\ m\geq 1. \tag{5}\]  
From the above Equation, '\(r\)' represents the distance between two fireflies, \(A_{o}\) is attractiveness at \(r=0\), and '\(m\)' is the number of fireflies taken. Euclidean distance in the FFRO algorithm evaluates the distance between two fireflies, \(p\) and \(q\), at \(y_{p}\), and \(y_{q}\) is formulated as  
\[r_{pq}=\sqrt{\sum_{k=1}^{d}\left(y_{p,k}-y_{q,k}\right)^{2}}. \tag{6}\]  
From (6), the movement of less bright firefly \(p\) to brighter firefly \(q\) is represented as below:  
\[y_{p}=y_{p}+A_{o}e^{-\gamma r_{pq}^{2}}\left(y_{q}-y_{p}\right)+\alpha(R-0.5). \tag{7}\]  
From the above Equation, the second term is because of attraction, and the third term is randomization using \(\alpha\), which represents the randomization parameter. '\(R\)' represents the random no generator issued in [0, 1]. Let us consider that \(A_{o}=1\) and \(\alpha\ \in\ [0,\ 1]\). The randomization term is expanded to normal distribution N (0, 1). The formula used for any pair of fireflies '\(y_{p}\)' and '\(y_{q}\)' is represented as  
\[y_{p}^{t+1}=y_{p}^{t}+A\exp\left(-\gamma r_{pq}^{2}\right)\left(y_{q}^{t}-y_{p} ^{t}\right)+\alpha_{t}\epsilon_{t}. \tag{8}\]From the above equation, \(\alpha_{t}\) denotes the parameter controlling step size, while '\(e_{t}\)' represents vector drawn from Gaussian or another distribution. The proposed algorithm mainly contains two objective functions, known as minimum energy consumption and minimum bandwidth utilization. These objective functions are used for determining the light intensity of fireflies to find resource-optimized route paths in MANET, which result in increasing the routing stability. In MANET, the resource utilization is calculated by evaluating the light intensity of the firefly by using the proposed algorithm. Based on the light intensity of the firefly, the DP is moved from one firefly to another firefly. After that, the FFRO algorithm ranks fireflies according to the light intensity and finds the best resource-optimized route path for DP transmission. With the aid of the algorithmic process below, the proposed FFRO algorithm efficiently chooses the resource-optimized route path. This, in turn, helps in increasing the routing stability while sending the DP from the transmitter to the receiver. The algorithmic process of the firefly optimization algorithm is shown below. The proposed FFRO Algorithm 1 initially generates the firefly population and calculates the firefly's light intensity based on objective functions. With the help of calculated light intensity, the FFRO algorithm finds the resource-optimized MN in MANET. Then, the source node finds the adjacent resource-optimized mobile nodes and calculates the distance between them. Suppose the light intensity of firefly \(q\) is higher than the light intensity of firefly \(p\); in that case, firefly \(p\) moves towards firefly \(q\) (i.e., the DP in MN\(p\) is transmitted to mobile node \(q\)). The attractiveness of the firefly (i.e., resource utilization of mobile node) changes with distance \(r\), consequently estimating the new solutions and updating light intensity until the termination condition is met. Finally, the proposed FFRO algorithm ranks fireflies according to the light intensity and finds the best resource-optimized MN for transmitting the DP to the destination node.