## 4 Clustering Routing Algorithm Design
### Data Transmission Phase  
The data transmission phase includes intra-cluster data transmission and inter-cluster data transmission. In the intra-cluster data transmission, the CHNs allocate time slots by a time division multiple access (TDMA) scheme for the CMNs to send data packets to their own CHNs by a single hop. After the CMNs transmit the data packets for this round, they turn to sleep mode in order to reduce energy consumption. After receiving the data packets from all the CMNs in the cluster, the CHNs process the data and then transmit them to the SN by using a carrier sense multiple access with collision detection (CSMA/CD) mechanism through multiple hops and the optimal multi-hop paths are found by the improved ACO algorithm. If some CHNs are near the SN, they can directly transmit the data to the SN by a single hop. The process of the improved ACO algorithm is shown in Figure 3 and the steps are given as follows:Step 1: To ensure the initial search ability of ants, the initial energy and the initial pheromone concentration of each node are set to be equal. Each node has a unique ID. Step 2: The source node generates a forward ant at regular intervals. The format of the routing table carried by the forward ant is shown in Table 1. The taboo list indicates the nodes that the ant has visited and these nodes cannot be accessed in future searches. Step 3: The transfer probability to the next hop node is calculated by (10). The ant transfers to the next CHN according to this probability. Then this next hop node is added to the taboo list, and the hop count is increased by one. Step 4: Step 3 is repeated until the ant reaches the SN. At the same time, the forward ant dies, and the corresponding backward ant is generated. The backward ant carries the routing information of the forward ant and returns to the source node by the path that the forward ant made. The routing information no longer changes as the backward ant returns. When the backward ant reaches the source node, a routing path is established. Step 5: Steps 2, 3, and 4 are repeated until all ants have completed a path search. By this time, the present iteration ends. Then the search paths of the ants are noted, the taboo list is cleared, and the pheromone is updated according to (9). Step 6: Steps 2 to 5 are repeated until the preset number of iterations is reached, and the optimal path output is shown. It is noted that only one CHN finds its optimal path to the SN after Step 6, and the number of CHNs is equal to the number of small cubes in the network. Hence, by changing the IDs of the source \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Source Node ID** & **SN ID** & **Hop Count** & **Taboo List** & **Packet Length** & **Packet Type** \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The format of the routing table. Figure 3: The process of the improved ant colony optimization (ACO) algorithm. nodes and repeating the whole process of the ACO algorithm, the paths from the other CHNs to the SN can be determined. In this paper, the destination node is always the SN and the CHNs that need to send data packets become the source nodes. The relay nodes on multi-hop paths are other CHNs. Furthermore, the search process for the optimal multi-hop routing paths is accomplished in the SN because it has a continuous energy supply. After the CHNs are selected, they send the SN messages with information such as IDs, locations, and residual energy so that the SN can figure out the optimal paths by using the improved ACO and then transmit the routing information to the CHNs. By the time all the CHNs have sent the data to the SN, one round is over. At this time, if in one cube the residual energy of the CHN is more than half of the average energy of other nodes, the CHN of the next round stays the same, which can save energy and time. Otherwise, a new CHN is selected in the next round. The new selected CHN transmits its information to the SN so that the SN can restart the process of the ACO algorithm and find the optimal path for the new CHN.