# Energy-Balanced Routing Algorithm Based on Ant Colony Optimization for Mobile Ad Hoc Networks
## 4 Simulations
### Verification of Algorithm Convergence  
We assume that the source node periodically broadcasts ants for route discovery, and each ant selects the route according to the transition probability Equation (5). It is assumed that all nodes have the same communication range, all nodes initially have the same energy, and the energy consumption is mainly determined by the distance between the nodes. The simulation parameter settings are shown in Table 3. These parameters in the table were defined empirically [21]. The offset coefficient \(\theta\) has a range of \([0,N]\), in our simulations \(\theta\) takes \(0,0.1N,\cdots,0.9N\). At the beginning of the simulation, the pheromone on all nodes is initialized first, and 10 ants are released for random routing in each iteration. When the node reaches the destination node (\(100,100\)), the pheromone of all nodes on the corresponding path is updated immediately. After \(n\) iterations, the average length of the path selected by the ant is obtained. The normalized average distance in Figure 2 refers to the average distance after iterating \(n\) times divided by the farthest distance from the source node to the destination node in the route discovery process. It can be seen from Figure 2 that, when \(\theta=0.5N\) or \(p_{ij}>0.5\), the path obtained by the \begin{table}
\begin{tabular}{c c c} \hline \hline
**Step** & **AntHocMMP** & **IEMACO** \\ \hline Initialize the network & \(O(n*n+m)\) & \(O(2*n*n+m)\) \\ Generation of FANT & \(O(m)\) & \(O(m)\) \\ Update pheromone & \(O(m*n)\) & \(O(2*n*n)\) \\ Generation of BANT and the amount of track updates & \(O(n*n*m+n*m)\) & \(O(n*n+m*n+m)\) \\ Determine if \(P_{optimal}\) is appropriate & \(O(m*n)\) & \(O(m*n)\) \\ return \(P_{optimal}\) & \(O(1)\) & \(O(1)\) \\ \hline \hline \end{tabular} Note: FANT, BANT and \(P_{optimal}\) represent _forward ant_, _backward ant_ and the optimal path, respectively.  
\end{table} 
Table 2: Time complexity. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Parameter** & **Value** & **Parameter** & **Value** \\ \hline Simulation times & 10,000 & Scenario size & 100 m \(\times\) 100 m \\ Number of iterations & 100 & Ant number in each iteration & 10 \\ Pheromone heuristic factor \(\alpha\) & 0.7 & Expected heuristic factor \(\beta\) & 0.3 \\ Initial pheromone \(\tau_{0}\) & 10 & Pheromone evaporate rate & 0.7 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Simulation parameters for ant colony optimization algorithm. same number of iterations is the shortest; when \(\theta=0\), that is, \(p_{ij}>0\), the obtained path length is the longest. This is because the forward ant directly selects the path with the highest probability as the next hop for each iteration, and falls into the local optimum, and the difficulty of finding the new path by the ant is increased due to the accumulation of pheromone. When \(\theta\geq N\), or equivalently \(p_{ij}>1\), the obtained path is also not optimal. This is because the routing criterion degenerates into random routing, and more iterations are needed to find the optimal path. Based on the optimal \(\theta\), in Figure 3, the improved ant colony optimization algorithm, basic ant colony optimization algorithm and random number based ant colony optimization algorithm are simulated and compared. It can be seen from Figure 3 that the convergence performance of the improved ant colony optimization algorithm proposed in this paper is basically consistent with the ant colony optimization algorithm that introduces random numbers. The global convergence of the ant colony optimization algorithm is thus verified. In addition, the path obtained by the basic ant colony optimization algorithm is significantly worse than the other two methods. This is because the positive feedback mechanism of the ant colony optimization algorithm makes the pheromone accumulation speed too fast, which makes it difficult to find new paths in subsequent iterations, and makes the algorithm fall into local optimum.