## 2 Proposed WSN Routing Scheme
### ACO Approach  
In the ACO based approach, each ant tries to find a path in the network, providing minimum cost. Ants are launched from a source node \(s\) and move through neighbor repeater nodes \(r_{i}\), and reach a final destination node (sink) \(d\). Whenever, a node has data to be transferred to the destination which is described as a base or base station, launching of the ants is performed. After launching, the choice of the next node \(r\) is made according to a probabilistic decision rule (1):  
\[P_{k}\left(r,s\right)=\left\{ \begin{array}{ll}\left[\tau(r,s)\right]^{ \alpha}\cdot\left[\eta(r,s)\right]^{\beta}&\text{ if }\;k\
ot\equiv tabu^{r}\\ \sum_{r\in R_{s}}\left[\tau(r,s)\right]^{\alpha}\cdot\left[\eta(r,s)\right]^{ \beta}&\text{ otherwise}\end{array} \right. \tag{1}\]  
where \(\tau(r,s)\) is the pheromone value, \(\eta(r,s)\) is the value of the heuristic related to energy, \(R_{s}\) is the receiver nodes. For node \(r\), \(tabu^{r}\) is the list of identities of received data packages previously. \(\alpha\) and \(\beta\) are two parameters that control the relative weight of the pheromone trail and heuristic value. Pheromone trails are connected to arcs. Each \(arc(r,s)\) has a trail value \(\tau(r,s)\in\left[0,1\right]\). Since the destination \(d\) is a stable base station, the last node of the path is the same for each ant travel. The heuristic value of the node \(r\) is expressed by equation (2):  
\[\eta(r,s)=\frac{\left(I-e_{r}\right)^{-1}}{\sum_{m\in R_{s}}\left(I-e_{n} \right)^{-1}} \tag{2}\]  
where \(I\) is the initial energy, and \(e_{r}\) is the current energy level of receiver node \(r\). This enables decision making according to neighbor nodes' energy levels, meaning that if a node has a lower energy source then it has lower probability to be chosen. Nodes inform their neighbors about their energy levels when they sense any change in their energy levels. In traditional ACO, a special memory named M\({}_{k}\) is held in the memory of an ant to retain the places visited by that ant (which represent nodes in WSNs). In equation (1), the identities of ants (as sequence numbers) that visited the node previously, are kept in the node's memories, instead of keeping node identities in ant's memories, so there is no need to carry M\({}_{k}\) lists in packets during transmission. This approach decreases the size of the data to be transmitted and saves energy. In equation (1) each receiver node decides whether to accept the upcoming packet of ant \(k\) or not, by checking its tabu list. So, the receiver node \(r\) has a choice about completing the receiving process by listening and buffering the entire packet. If the receiver node has received the packet earlier, it informs the transmitter node by issuing an ignore message, and switches itself to idle mode until a new packet arrives. After all ants have completed their tour, each ant \(k\) deposits a quantity of pheromone \(\Delta\tau^{k}(t)\) given in equation (3), where \(J_{w}^{k}(t)\) is the length of tour \(w^{k}(t)\), which is done by ant \(k\) at iteration \(t\). The amount of pheromone at each connection (\(l(r,s)\)) of the nodes is given in equation (4). In WSNs, \(J_{w}^{k}(t)\) represents the total number of nodes visited by ant \(k\) of tour \(w\) at iteration \(t\):  
\[\Delta\tau^{k}(t)=1/J_{w}^{k}(t) \tag{3}\]\[\tau(r,s)(t)\longleftarrow\tau(r,s)(t)+\Delta\tau(r,s)(t),\hskip 14.226378 pt \forall l(r,s)\in w^{k}(t),\hskip 14.226378 ptk=1,...,m \tag{4}\]  
Pheromone values are stored in a node's memory. Each node has information about the amount of pheromone on the paths to their neighbor nodes. After each tour, an amount of pheromone trail \(\Delta\tau^{k}\) is added to the path visited by ant \(k\). This amount is the same for each arc(r, \(s\)) visited on this path. This task is performed by sending ant \(k\) back to its source node from the base along the same path, while transferring an acknowledgement signal for the associated data package.