## 4 Our Proposed Algorithm
### Modified Ant Colony Routing Algorithm  
In this paper, in order to decrease the whole network transmission load and prolong the network lifetime, we provide a modified ant colony routing algorithm, where to speed up the convergence rate and avoid local optimal of the algorithm, pheromone impact factor is improved. Here, we select the energy consumption model described in Section 3.2. The traditional ant colony optimization algorithm selects the next hop depending on Equation (15) [39]:  
\[p_{ij}^{\theta}=\left\{ \begin{array}{ll}\frac{[\tau_{ij}(t)]^{ \zeta}[\rho_{ij}(t)]^{\xi}}{\sum\limits_{v<alloved_{\theta}}[\tau_{ix}(t)]^{ \zeta}[\rho_{ij}(t)]^{\xi}},&j\subset allowed_{\theta}\\ 0,&others\end{array} \right., \tag{15}\]  
where \(\tau_{ij}(t)\) denotes the pheromone information on edge \((i,j)\), while \(\rho_{ij}(t)\) is the heuristic information on edge \((i,j)\). \(\varsigma\) and \(\xi\) are impact factors demonstrating the importance degree of the pheromone information and heuristic information. In order to speed up the convergence rate and avoid local optimal, impact factor \(\varsigma\) is modified as in Equation (16):  
\[\varsigma=\mu(1+e^{-10\times(iter/totiter)^{10}}), \tag{16}\]  
where \(\mu\) is a small positive constant \(\in(0,1]\); _iter_ and _totiter_ refer to current iterations and total iterations, respectively. In Equation (16), \(\varsigma\) gradually becomes smaller as the number of iterations increases. In other words, the proportion of pheromones will diminish when the number of iterations rises. Figure 5: Wavelet functions of the first scheme: (**a**) 2 nd-level wavelet function; (**b**) 10 th-level wavelet function. Figure 6: Wavelet functions of the second scheme: (**a**) First-level wavelet function; (**b**) 10 th-level wavelet function. Furthermore, to yield optimal routing by the ant colony algorithm, in this subsection, a sensor node's residual energy and path length are taken into consideration simultaneously. So, the fitness value of each routing is presented as follows:  
\[Fitness=\beta(E_{\textit{ave}}\times E_{\min})+\sigma Len_{\theta}^{-iter}, \tag{17}\]  
where \(E_{\textit{ave}}\) indicates the average residual energy, while \(E_{\min}\) represents the node minimal energy of ants passing through the path. \(Len_{\theta}^{-iter}\) denotes the reciprocal of path length for given \(\theta\)th ant and \(iter\)th iterations. \(\beta\) and \(\sigma\) are \(\in[0,1]\) constants, and \(\beta+\sigma=1\). Consequently, the path with the largest fitness function value is chosen as the optimal routing, thus balancing the network load and prolonging the network lifetime. Specifically, the modified ant colony algorithm is shown in Algorithm 2. ```
Input: the number of sensor nodes \(N\), the power expended to run the transmitter or receiver circuitry of sensor node \(E_{\textit{e}lec}\), energy consumption of multi-path fading amplifier \(E_{amp}\), energy consumption of free-space amplifier \(E_{f_{\textit{g}}}\), distance threshold \(d_{0}\), impact factors of pheromone information \(\varsigma\), impact factors of heuristic information \(\varsigma\), \(\mu\) is a small positive constant \(\in(0,1]\), pheromone information on edge \((i,j)\tau\), heuristic information on edge \((i,j)\)\(\rho\), \(\beta\) and \(\sigma\) are \(\in[0,1]\) constants. Output: optimal routing \(Routing\). 1 Initialization routing \(R(Path,iter,\theta)\), energy for each node and tabu
2 calculate distance \(d_{ij}\) of different nodes, \(\rho_{ij}=1/d_{ij}\)
3 while maximum iterations has not be reached
4 for\(\theta\)=1: \(\Theta^{\prime}\)
5 compute \(allowed_{\theta}\) according to the node communication radius. 6 generate transition probability \(p_{ij}^{\theta}\) based on Equations (15) and (16)
7 choose the next hop node, relying on \(p_{ij}^{\theta}\), modify routing and tabu
8 the destination node or not?