# An Effective Hybrid Routing Algorithm in WSN:
## 4 ACOHCM Routing Algorithm
### Analysis of the Convergence Speed of the Algorithm
The current theoretical analysis is mainly focusing on for 1-ANT ant colony system assuming one ant in artificial pseudo-Boolean functions. Thus it turns to be a classical combinatorial optimization problem. For example, it is hard to analyze the influence of different parameter settings on algorithm performance. The optimization and theoretical analysis are still challenging problems when considering the multi-ant colony system. In this paper, we propose a new strategy of using the minimal hop count to guide the path searching direction. We expect that it can greatly improve the convergence speed of the algorithm and reduce the computation time of finding the optimal solution. The procedure are given as follows. We assume that the ant is currently on the node \(i\). There are \(n\) nodes in \(Set_{all}\). Firstly the following terms are defined:  
\(Set_{cur}\) is the set of the nodes whose hop counts are same as that of the node \(i\);  
\(Set_{far}\) is the set of nodes whose hop counts are one more than that of the node \(i\);  
\(Set_{near}\) is the set of the nodes whose hop counts are one less than that of the node \(i\);  
\(Set_{all}\) is the set of all alternative next hop nodes. According to the assumption, when the traditional ACO selects the next hop node for this ant, it calculates the node state transition probability for the \(n\) nodes in \(Set_{all}\) respectively by using the probabilistic node state transition formula. Differently, our ACOHCM firstly puts the \(n\) nodes from \(Set_{all}\) into \(Set_{cur}\), \(Set_{far}\) or \(Set_{near}\) respectively according to their hop counts. \(Set_{all}=Set_{cur}\bigcup Set_{far}\bigcup Set_{near}\). We also Assume that there are \(num_{c}\) nodes in \(Set_{cur}\), \(num_{f}\) nodes in \(Set_{far}\) and \(num_{n}\) nodes in \(Set_{near}\). Then \(num_{c}+num_{f}+num_{n}=n\), \(num_{c}\), \(num_{f}\), and \(num_{n}\) must be larger than 0. Then it can fall into the following two cases. **Case 1**. : _When all \(n\) nodes are in the same set of \(Set_{cur}\), \(Set_{far}\) or \(Set_{near}\), it selects the next hop in \(n\) nodes and calculates the state transition probability for the \(n\) nodes. The convergence speed of the algorithm does not improve._  
**Case 2**. : _When all \(n\) nodes are not in the same set, then at most one set is empty. \(num_{c}\), \(num_{f}\), and \(num_{n}\) are all less than \(n\). There are three following situations:_  
1. _If_ \(num_{n}>0\) _and the energy of the nodes in_ \(Set_{near}\) _meets the requirements of data transmission, the algorithm only chooses the next hop nodes in_ \(Set_{near}\) _and calculates the node state transition probability for the nodes in_ \(Set_{near}\)_. Therefore, the convergence speed of the algorithm can be improved by_ \(nnum_{n}\) _times._
2. _If_ \(Set_{near}\) _is empty or the energy of the nodes in_ \(Set_{near}\) _does not meet the requirements of data transmission, but_ \(num_{c}>0\) _and the energy of the nodes in_ \(Set_{cur}\) _meets requirements of data transmission, then the algorithm only chooses the next hop nodes in_ \(Set_{cur}\) _and only calculates the node state transition probability for the nodes in_ \(Set_{cur}\)_. Therefore, the convergence speed of the algorithm can be improved by_ \(nnum_{c}\) _times._
3. _If_ \(Set_{near}\) _is empty and the energy of the nodes in_ \(Set_{cur}\) _does not meet the requirements of data transmission, or_ \(Set_{cur}\) _is empty and_ \(Set_{near}\) _is not empty but the energy of the nodes in_ \(Set_{near}\) _does not meet the requirements of data transmission, it is clear that_ \(num_{f}>0\)_. If the energy of the nodes in_ \(Set_{far}\) _meets the requirements of data transmission, then the algorithm only chooses the next hop nodes in_ \(Set_{far}\) _and only calculates the node state transition probability for the nodes in_.