## 3 GA Hybrid-Fog Model
### GA Hybrid-Fog Formulation  
Task offloading to various fog nodes (FUAVs and FBSs) and task scheduling are the most crucial challenges in IoD networks. To address the first challenge, we have proposed a hybrid fog architecture, which is based on Algorithm 1. In particular, we propose the use of a GA to provide an optimal task-offloading solution, minimizing both transmission and fog computing delays. To address the second challenge, we have used a scheduling algorithm (Algorithm 2), which calculates the transmission and computing delays of each task. It then determines the maximum delay across all tasks allocated to a single processing station [28]. * GA Hybrid-Fog Channel Model Figure 2 provides a representation of the channel model used in the GA Hybrid-Fog algorithm. For the purpose of modeling the channel connectivity over expansive geographic regions, the range between the aerial nodes (UAVs or fog UAVs) and ground devices (FBSs) must be calculated. To ensure uninterrupted data delivery between nodes, network quality must be maintained by calculating path loss to determine the optimal path for UAVs. The total path loss (assumed to be free space) from UAVs to ground FBSs can be computed using Equation (1) [29; 30]: \[L[dB]_{d_{i}}=20 log(d_{i})+20 log(f_{c})+20 log(\frac{4\pi}{c})+L_{0}\] (1)  
Figure 1: Architecture of the proposed GA Hybrid-Fog algorithm. where \(d_{i}\) is the distance between \(UAV_{i}\) and \(FBS_{i}\) (Figure 2), \(f_{c}\) is the channel frequency, \(c\) is the speed of light, and \(L_{0}\) is the excess path loss, including LoS for direct communication and NLoS for indirect communication [20]. The path loss \(L[dB]_{d_{i}}\) and the transmission power \(Pt_{(j)}\) of the air devices \(UAV_{i}\) are used to calculate the signal-to-noise ratio (SNR). Specifically, \(SNR_{(i)}\) is calculated using Equation (2) [31]:  
\[SNR_{(i)}=\frac{Pt_{(j)}/L[dB]_{d_{i}}}{n_{0}} \tag{2}\]  
where \(n_{0}\) is the noise power. Equation (3) defines the maximum transmission data rate \(T_{i}\) from the air device to the ground device [31]:  
\[T_{i}=B.\ log_{2}(1+SNR_{(i)}) \tag{3}\]  
where \(B\) represents the transmission bandwidth. * GA Hybrid-Fog Computing Model  
We begin by defining the vector of the data size of each task as \(D=\{D1,D2,\ldots,Dj,\ldots,Dn\}\); then, we calculate the transmission delay \(Delay_{(i,j)}\) for offloading \(TASK_{j}\) to \(FBS_{i}\) using transmission rate \(T_{i}\) according to the following equation [31]:  
\[Delay_{(i,j)}=\frac{D_{j}}{T_{i}} \tag{4}\]  
The computing time of \(FBS_{i}\) depends on its CPU frequency, \(f_{i}\). The CPU cycles required to process each bit of data are represented by \(\eta_{i}\). The computing delay of \(TASK_{j}\) on \(FBS_{i}\), denoted as \(C_{(i,j)}\), is calculated using the following equation [31]:  
\[C_{(i,j)}=\frac{D_{j}.\ \eta_{i}}{f_{i}} \tag{5}\]  
Figure 2: Channel model used in the GA Hybrid-Fog algorithm. * Algorithmic Structure of a Standard GA  
A GA is an evolutionary heuristic optimization algorithm that is used to find the optimal solution [32]. In a GA, the evolution starts from a random population that consists of a set of individuals (solutions). In each generation, the fitness of each individual within the population is evaluated, and a set of individuals is chosen from the existing population according to their fitness levels to create a new population for the next iteration. The algorithm concludes when either the maximum number of generations is reached or the population attains an acceptable fitness level. To produce a new population, a GA utilizes two key operations: mutation and crossover, which are detailed as follows:  
1. Mutation: The population of individuals is encoded by a sequence of bits (named a chromosome). The mutation consists of randomly choosing one bit of this chromosome and changing its value. 2. Crossover: After selecting two individuals from a population, a random point is chosen, and their tails are subsequently crossed.