**3.2 ARA**

*ARA* (Ant-Colony-based Routing Algorithm) was proposed for *MANETs* by Güne s, Sorges and Bouazizi in 2002 [34]. *ARA* is based on a version of *Ant Colony Optimization* which the authors call "Simple ACO". Its main goal is to reduce the overhead of routing as compared to classical routing algorithms. The algorithm consists of three phases: route discovery, route maintenance, and route failure handling. It uses routing tables at each node *ni* which consist of records of the form *nd*, *nn*, *φ<sup>i</sup>*,*<sup>n</sup>* � � where *nd* is the destination node, *nn* the next hop node and *φ<sup>i</sup>*,*<sup>n</sup>* the pheromone value for this link and destination. Ants carry a sequence number and the source address they originated from.

The transition rule looks very much like that of *AntHocNet* (cf. also Eq. (3)) with a coefficient of *β*<sup>1</sup> ¼ 1:

$$p\_{i,n} = \begin{cases} \frac{\rho\_{i,n}}{\sum\_{j \in N\_i} \rho\_{i,j}} & n \in N\_i \\ 0 & n \notin N\_i \end{cases} \tag{5}$$

where *pi*,*<sup>n</sup>* is the transition probability of going from the current node *ni* to node *nn* and *Ni* is the set of one-hop neighbors of *ni*.

In contrast to *AntHocNet*, though, ants are used differently as follows:


The pheromone update rule in *ARA* is quite simple; an ant changes the pheromone value moving from node *ni* to *nn* by a constant amount:

$$
\rho\_{i,n} := \rho\_{i,n} + \Delta \rho. \tag{6}
$$

Güneş et al. suggest that the number of hops an ant has traveled to the current node could also be included in the calculation of the new amount of pheromone. Pheromone is evaporated in regular intervals according to the evaporation rule shown in Eq. (7). The authors suggest that the link quality measurements should be *Ant Algorithms for Routing in Wireless Multi-Hop Networks DOI: http://dx.doi.org/10.5772/intechopen.99682*

incorporated into the evaporation rule rather than into the pheromone update rule as usual. This has the advantage that nodes can update local changes of link quality much more quickly. On the other hand, the disadvantage of this method is that the quality reflected by the amount of pheromone reflects local link quality only instead of end-to-end path quality.

$$
\rho\_{i,n} \coloneqq (1-q) \cdot \rho\_{i,n}, \qquad q \in (0,1] \tag{7}
$$

**Route maintenance** is done by observing the traffic flowing through the network. Traffic does not have to be encapsulated in ant packets; rather, nodes autonomously update the pheromone tables according to the pheromone update rule already shown in Eq. (6). For each packet of traffic observed by the node, the pheromone value is increased by the constant amount Δ*φ*. This has the advantage that route reinforcement happens "automatically" without the need for extra ant packets.

To prevent the creation of loops, *ARA* implements a simple loop avoidance mechanism. When a node recognizes the duplicate reception of a data packet (identifiable by sequence number and address), it sets an error flag and sends the packet back to the previous node which removes the link from its routing table.

**Route failures** are recognized by missing acknowledgements. When a link fails, a node first checks whether it has another route to the required destination in its routing table. If this is the case, it sends the packet via this alternative link. If not, the node informs its neighbors anticipating that they can relay the packet. Failing this, the mechanism tracks back until it arrives back at the source node. In that case, a new route discovery phase has to be initiated by the source node.

### **3.3 ARAMA**

Ant Routing Algorithm for Mobile Ad-hoc networks (*ARAMA*) was published by Hussein, Saadawi and Lee in 2005 [35]. It is targeted at *MANETs* and *WSNs* and focuses on fair resource usage – esp. node energy – across the network. To achieve this, the forward ants carry not only source and destination address and intermediate node IDs but also quality information about the path. To prevent ants from growing too big, the path information is calculated as a normalized local index and computed into a cumulative path index as shown in Eqs. (8) and (9) below. The ant only carries the path index. This novel path index is the main contribution of the paper.

Let *pi*,*<sup>m</sup>* node *i*'s normalized optimization parameter *m* with 0<*pi*,*<sup>m</sup>* <1. This can be the number of hops, battery power, delay, bandwidth, etc. Then the local normalized index *Ii* for node *i* is

$$I\_i = \sum\_{m} a\_m p\_{i,m} \tag{8}$$

where *am* is the weight of this parameter with P *<sup>m</sup>am* ¼ 1. This leads to 0 ≤*Ii* ≤1. As the forward ant passes a node it updates the path information it carries by calculating the path index *Ipath* as follows:

$$I\_{path} = \prod\_{i} I\_i. \tag{9}$$

Since 0 ≤*Ii* ≤ 1 also 0≤*Ipath* ≤1. A bottleneck link on the path correctly influences the overall path index as the value of *Ipath* is smaller than the smallest *Ii* along the path. When the forward ant reaches the destination, the path grade *ρ* is computed as

$$
\rho = f\left(I\_{path}, I\_{path,best}\right) \tag{10}
$$

where *Ipath*,*best* is the best *Ipath* received in the last *W* number of ants (*W* a suitable window size).

With *d* the destination node, *i* the current node, and *n* the next hop node the **transition rule** used by *ARAMA* is given as

$$p\_{d,i,n} = \begin{cases} \frac{\text{fun}\left(\tau\_{d,i,n}, \eta\_{i,n}\right)}{\sum\\_j \text{fun}\left(\tau\_{d,i,j}, \eta\_{i,j}\right)}, & n \in N\_i\\ 0 & n \notin N\_i \end{cases} \tag{11}$$

where *τ<sup>d</sup>*,*i*,*<sup>n</sup>* is the pheromone value for going from current node *i* to destination *d* via next neighbor *n* and *η<sup>i</sup>*,*<sup>n</sup>* is the local heuristic value of the link ð Þ *i*, *n* . Function *fun τ<sup>d</sup>*,*i*,*<sup>n</sup>*, *η<sup>i</sup>*,*<sup>n</sup>* � � is chosen to give a high function value when *τ<sup>d</sup>*,*i*,*<sup>n</sup>* and *η<sup>i</sup>*,*<sup>n</sup>* are high; eg. as in the transition rule of *AntHocNet*.

When the backward ant traverses the network back to the source, the pheromones are updated with the **pheromone update rule**:

$$\tau\_{d,i,n} \coloneqq \begin{cases} f\_{enap}(\rho\_d)\tau\_{d,i,n}) + \mathbf{g}\_{en\tilde{f}}(\rho\_d) & \text{if} \quad n \in \text{Path} \\ f\_{enap}(\rho\_d)\tau\_{d,i,n}) & \text{if} \quad n \notin \text{Path} \end{cases} \tag{12}$$

with *<sup>f</sup> evap*ðÞ the evaporation function, *genf* the enforcement function, and *<sup>ρ</sup><sup>d</sup>* the path grade for this path calculated from the information in the forward ant as shown above.

The authors also propose two very interesting extensions to the algorithm: Negative Backward Ants are sent if a forward ant dies due to running out of TTL (time-to-live) or loop detection. In this case, a negative backward ant is sent which deemphasizes the path by decreasing its pheromone levels. Destination Trail Ants implement the *RARE* (Receiver Assisted Routing Enhancement) concept by the same group (Abdelmalek, Hussein, and Saadawi [36]). With this technique, destination nodes send so called "destination trail ants" into the network which randomly mark paths leading to the destination. When forward ants search for this destination there is a probability that they will hit a destination trail left behind by a destination trail ant. This helps to speed up connection setup time.

### **3.4 AMQR**

Ant colony based Multi-path QoS-aware Routing (*AMQR*) was developed for *MANETs* by Liu and Feng in 2005 [37]. It is based on *ARA* (introduced in Section 3.2). In contrast to *ARA* it supports link-disjoint multi-path routing.

Like *ARA* it uses the transistion rule from *AntHocNet* with a factor *β*<sup>1</sup> ¼ 1 (cf. Eq. (3)).

$$p\_{i,n} = \begin{cases} \frac{\varphi\_{i,n}}{\sum\_{j \in N\_i} \varphi\_{i,j}}, & \text{if} \quad n \in N\_i\\ 0 & \text{if} \quad n \notin N\_i \end{cases} \tag{13}$$

with *pi*,*<sup>n</sup>* the probability to go from node *ni* to *nn* and *Ni* the set of neighbors of *ni* in dependence of the pheromone value *φi*,*n*.

As in *ARA*, forward ants mark the trail back to the source as they move while backward ants update the trail to the destination. The pheromone values are updated as follows:

$$
\rho\_{i,n} \coloneqq (1 - a) \cdot \rho\_{i,n} + \Delta \rho\_{i,n} \tag{14}
$$

with *α* the pheromone decay parameter and Δ*φi*,*<sup>n</sup>* calculated as

$$
\Delta \rho \dot{\mathbf{u}}, \mathbf{n} = q^{-m} \mathbf{h}^{-n} \tag{15}
$$

where *q* is the delay time and *h* the hop count experienced by the ant so far. The parameters *m* and *n* are the weights that determine the relative importance of time delay and hop count.

Forward ants use a frame format of *ns* h i , *nd*, *SeqN*, *HopC*, ½ � ð Þ *PasN*, *ArrT* ,ð Þ *:*, *:* , … . where *ns* is the ID of the source node, *nd* the ID of the destination node, and *SeqN* and *HopC* the sequence number and hop count of the ant respectively. The list ½ � ð Þ *PasN*, *ArrT* , … contains the IDs of the nodes *PasN* passed by the ant and the relevant arrival times *ArrT*. Backward ants use the same frame format as forward ants but without *SeqN* and *HopC*.

The routing table has the usual entries *nd*, *nn*, *φ<sup>i</sup>*,*<sup>n</sup>* with *nd* the destination, *nn* the next hop and *φ<sup>i</sup>*,*<sup>n</sup>* the pheromone value for this link.

During route discovery, a source node first sends hello packets to determine its neighbors and then broadcasts a forward ant. Therefore, there is more than one copy of the forward ant in the system. When an intermediate node receives a forward ant more than once and the ant's hop count *HopCnew* ≤ *HopCold* þ Δ*hops* another entry is made in the routing table to record this alternative path. Parameter Δ*hops* is the threshold for an acceptable additional path length to avoid overly long alternative paths. Backward ants always choose the best path back to the source.

Nodes exchange routing information by additional communication and build their own view of the topology, and only link-disjoint routes are used. The same concept is used in *PPRA* shown later (see Section 3.6). Load balancing and route failures are handled as in *ARA*.

To support QoS, nodes monitor their state and the delay recorded in the ants they receive. If the delay in an ant exceeds a certain limit, the pheromone for the respective link is set to 0 and the other pheromone values in the routing table are adjusted to eliminate this high-delay link. If the node itself is overloaded, it initiates a new backward ant to the source to change the route.

### **3.5 Scalable Ant-based Routing**

Ohtaki et al. [38] focus on the scalability of ant-based routing for *MANETs*. Their algorithm is based on uniform ant routing [39] and borrows the TTL-limiting technique from HSLS (Hazy Sighted Link State) routing [40].

As in uniform ant routing, a probability routing table is kept at each node. For each entry ð Þ *d*, *n* there exists a value *pdn* which gives the probability of routing a packet destined for node *d* via neighboring node *n*. Nodes send periodic control messages (ants) of the form *hs* h i ,*c*, TTL which wander the network randomly. Here, *hs* is the source address, *c* the cost of all links traversed so far, and *TTL* the remaining time-to-live. Whenever a node receives such a control message from a neighboring node *l* it updates its routing table as follows

*The Application of Ant Colony Optimization*

$$p\_{dn} = \begin{cases} \frac{p\_{dn} + \Delta p}{1 + \Delta p}, & \text{if} \quad n = l \\ \frac{p\_{dn}}{1 + \Delta p} & \text{if} \quad n \neq l \end{cases} \tag{16}$$

with *n*∈ *Ni* the set of neighbors of the current node *i* and Δ*p* given by

$$
\Delta p = \frac{k}{f(c)},\\
(k > 0) \tag{17}
$$

where *f c*ð Þ is a function of the total cost *c* and *k* the so-called learning rate of the algorithm. It defines the weight of one ant and is generally less than 0.1.

As the number of nodes in the network increases, the number of ants goes up and becomes a burden on the network. To improve scalability, the Scalable Antbased Routing algorithm borrows a technique from HSLS [40] to limit the *TTL* of the control packets. The *TTL Tk* of the *k*-th ant is calculated as

$$T\_k = \mathbf{2}^{\mathbf{x}\_k + 1} \tag{18}$$

where

$$\boldsymbol{\infty}\_{k} = \min\left(\boldsymbol{\pi}\_{\max}, \max\left(\boldsymbol{\pi}|k \equiv \mathbf{0}(\mathbf{mod}\,\mathbf{2}^{\mathbf{x}})\right)\right). \tag{19}$$

The authors suggest that *xmax* should be set to half the number of nodes in the network.

Another improvement of this algorithm is the novel ant migration scheme. Instead of a purely random walk, ants try to move as far away from the source as possible. The idea is that ants should not "waste" their *TTL* in the neighborhood but rather try to cover the whole network. They can find the "direction away from the source" by following those links which have a low probability as a way to the source in the routing table. Iow. when an ant originated from source *s* was received from node *m* the probability *q <sup>j</sup>* that node *j* will be chosen as next-hop node among all neighboring nodes except *m* is calculated as

$$q\_{j} = \frac{\frac{1}{p\_{j}}}{\sum\_{k=1}^{n} \frac{1}{p\_{ik}} - \frac{1}{p\_{m}}} \tag{20}$$

to find the next link in direction away from the source. In this way, they use their TTL most efficiently to reach nodes as far away from the source as possible and get good coverage of the network.

## **3.6 PPRA**

*PPRA* Prioritized Pheromone Aided Routing Algorithm was published by Jeon and Kesidis in 2005 [41]. It is a multipath routing algorithm that considers both energy and latency and supports dual-priority traffic. It is aimed at sensor networks (*WSNs*) and *MANETs* with battery constraints and based on *ARA* [34] (see also Section 3.2). Multipath routes are used to guard against route failures; in case of a route breaking, the already set-up backup route can be used without waiting for another route discovery phase. The multiple paths are also used for load balancing. As the primary path's pheromones degrade, traffic switches to the alternate routes.

*Ant Algorithms for Routing in Wireless Multi-Hop Networks DOI: http://dx.doi.org/10.5772/intechopen.99682*

The routing tables at each node *ni* consist of entries of the form *nd*, *nn*, *δ<sup>i</sup>* ð Þ *<sup>d</sup>*, *<sup>n</sup>* ,*ei* ð Þ *<sup>d</sup>*, *<sup>n</sup>* or *nd*, *nn*, *<sup>∂</sup><sup>i</sup>* ð Þ *<sup>d</sup>*, *<sup>n</sup>* ,*e<sup>i</sup>* ð Þ *<sup>d</sup>*, *<sup>n</sup>* where *nd* is the destination node, *nn* the next hop node, *δ<sup>i</sup>* ð Þ *<sup>d</sup>*, *<sup>n</sup>* the TTL-pheromone or *<sup>∂</sup><sup>i</sup>* ð Þ *d*, *n* the Delaypheromone respectively, and *ei* ð Þ *d*, *n* the Energy-pheromone described later.

During **route discovery** the forward ants are broadcasted. Like in source routing, they carry the source address and record all node addresses along the way. Duplicate forward ants are *not* discarded as in single path algorithms. Instead, they are used to set up alternative routes. Note that out of the paths found by the duplicate ants only those which are link-disjoint are kept. Once a forward ant reaches the destination, a backward ant is created, which takes the path found by the forward ant back to the source. For the measurement of energy and delay, periodic control packets are sent in addition to route discovery ants.

**Pheromone types**: There are three kinds of pheromones in *PPRA*: TTLpheromone (*δ*), Delay-pheromone (*∂*), and Energy-pheromone (*e*). The algorithm has two variants. Variant 1 uses TTL-pheromone and Energy-pheromone, while Variant 2 uses Delay-pheromone and Energy-pheromone.

**TTL-pheromone** is used to express the distance in hops (iow. the time-to-live a packet traveling this path will use) and is calculated as

$$\delta^i(d, n) \coloneqq \delta^i(d, n) + \beta\_1 \cdot TTL(d, n) \tag{21}$$

with *β*<sup>1</sup> a scaling constant and *TTL d*ð Þ , *n* the number of hops between node *d* and node *n*. Evaporation for TTL-pheromone is calculated as

$$\delta^i(d, n) \coloneqq \delta^i(d, n) \cdot \beta\_2 \quad \text{with} \quad 0 < \beta\_2 < 1. \tag{22}$$

For highly volatile networks a higher value of *β*<sup>2</sup> can be used to decay stale routes faster.

**Energy-pheromone** represents the battery status of the nodes in the path. Similar to Eq. (21) it is calculated as

$$e^i(d, n) \coloneqq e^i(d, n) + a\_1 \cdot E\_{min}(d, n) \tag{23}$$

with *α*<sup>1</sup> a scaling constant. *Emin* represents the energy bottleneck on the path, i.e. the lowest battery level encountered in a node along the path. Evaporation for Energy-pheromone is calculated as

$$e^i(d, n) \coloneqq e^i(d, n) \cdot a\_2 \quad \text{with} \quad 0 < a\_2 < 1. \tag{24}$$

**Delay-pheromone** marks the cumulative queuing delay experienced along a path. It is calculated analogously to TTL-pheromone as

$$\partial^{\dot{}}(d,n) \coloneqq \partial^{\dot{}}(d,n) + \chi\_1 \cdot D(d,n) \tag{25}$$

with *γ*<sup>1</sup> a scaling constant and *D d*ð Þ , *n* the cumulative queuing delay between node *d* and node *n*. Evaporation for Delay-pheromone is calculated as

$$
\partial^i(d, n) \coloneqq \partial^i(d, n) \cdot \boldsymbol{\gamma}\_2 \quad \text{with} \quad \boldsymbol{\gamma}\_2 > \mathbf{1}. \tag{26}
$$

The algorithm distinguishes between latency-critical and non-critical traffic. For latency-critical traffic, it always uses both pheromone levels (Energy- and TTL-pheromone or Energy- and Delay-pheromone respectively) to determine the route, for non-critical traffic only Energy-pheromone is considered.

The **transition rule for non-critical traffic** is given in Eq. (27).

$$p\_\epsilon^i(d, n) = \frac{\epsilon^i(d, n)}{\sum\_{j \in N\_i} \epsilon^i(d, j)} \tag{27}$$

where *Ni* the set of neighboring nodes of *i*.

The **transition rule for latency-critical traffic** is calculated by combining Energy-pheromone and TTL-pheromone (algorithm variant 1) or Energypheromone and Delay-pheromone (algorithm variant 2) as shown in Eqs. (28)–(31) respectively.

$$\text{Variant 1}: \quad p\_{lat}^{i}(d, n) = \frac{\theta \cdot p\_{\epsilon}^{i}(d, n) + p\_{\delta}^{i}(d, n)}{\sum\_{j \in N\_{i}} [\theta \cdot p\_{\epsilon}^{i}(d, j) + p\_{\delta}^{i}(d, j)]} \tag{28}$$

where

$$p\_\delta^\mathbf{x}(w, z) = \frac{\delta^\mathbf{x}(w, z)}{\sum\_{j \in N\_\mathbf{x}} \delta^\mathbf{x}(w, j)}\tag{29}$$

and *Nx* the set of neighboring nodes of *x*.

$$\text{Variant } 2: \quad p\_{lat}^i(d, n) = \frac{\theta \cdot p\_\epsilon^i(d, n) + p\_\delta^i(d, n)}{\sum\_{j \in N\_i} [\theta \cdot p\_\epsilon^i(d, j) + p\_\delta^i(d, j)]} \tag{30}$$

where

$$p\_{\partial}^{i}(d,n) = \frac{\mathbf{1}/\delta^{i}(d,n)}{\sum\_{j \in N\_{i}} \mathbf{1}/\delta^{i}(d,j)}\tag{31}$$

and *Ni* the set of neighboring nodes of *i*.

### **3.7 EEABR**

Energy-Efficient Ant-Based Routing (*EEABR*) is a routing algorithm based on the *Ant Colony Optimization* metaheuristic. It was developed for *WSNs* by Camilo et al. in 2006 [42]. The major goal of this algorithm is to increase energy efficiency. The authors propose three algorithms, basic, improved, and energy-efficient ant routing.

$$p\_k(r,s) = \begin{cases} \frac{[\pi(r,s)]^\alpha [E(s)]^\beta}{\sum\_{\boldsymbol{\mu} \notin M\_k} [\pi(r,\boldsymbol{\mu})]^\alpha [E(\boldsymbol{\mu})]^\beta}, & \text{if} \quad s \notin M\_k\\\\ 0 & \text{if} \quad otherwise \end{cases} \tag{32}$$

where an ant *k* chooses with probability *pk*ð Þ *r*, *s* to move from node *r* to node *s*, *τ*ð Þ *r*, *s* the amount of pheromone for link ð Þ *r*, *s* , and *E s*ð Þ being the factor *η* in the *Ant Colony Optimization* metaheuristic. In this case, *E s*ð Þ is calculated from the initial energy level of the nodes *C* and *es* the actual energy level of the node by

$$E(s) = \frac{1}{\mathcal{C} - e\_s}.\tag{33}$$

The backward ant of forward ant *k* drops pheromone according to the pheromone update rule given in Eq. (34).

$$
\pi\_k(r, s) \coloneqq (\mathbf{1} - \rho) \cdot \pi\_k(r, s) + \Delta \tau\_k. \tag{34}
$$

Here, 1ð Þ � *ρ* represents the evaporation and Δ*τ<sup>k</sup>* is calculated from the total number of nodes *N* and the distance *Fdk* traveled by forward ant *k* as

$$
\Delta \tau\_k = \frac{1}{N - Fd\_k}.\tag{35}
$$

The first improvement of this basic algorithm uses a refined function for calculating *τ<sup>k</sup>* where the ant carries an energy vector. From this, the average energy level of the path is calculated when the backward ant is created. While this makes it possible to better monitor the energy level on the path it can lead to quite big forward ants. Since in *WSNs* communication costs much more energy than local calculation, the authors propose to save ant size by storing only the average (*E*avg*k*) and minimum energy (*E* min *<sup>k</sup>*) found on the path so far in the forward ant. The pheromone update rule in the final *EEABR* algorithm is then given as:

$$\tau\_k(r,s) \coloneqq (\mathbf{1} - \rho) \cdot \tau\_k(r,s) + \left[\frac{\Delta \tau\_k}{\rho B d\_k}\right] \tag{36}$$

where *φ* is a coefficient, *Bdk* the traveled distance of the backward ant in hops and

$$\Delta \tau\_k = \frac{\mathbf{1}}{\mathbf{C} - \begin{bmatrix} \frac{E \ \min\_k - F d\_k}{E \ \text{avg}\_k - F d\_k} \end{bmatrix}}. \tag{37}$$

Through factors *φ* and *Bdk* the backward ant loses part of its pheromone strength while it travels back to the source – thereby giving shorter paths an advantage in the routing table.

The authors also reduce the memory *Mk* of already visited nodes in the forward ant to just the last two nodes visited. This means no full path information is stored in the ant anymore, further reducing its size to achieve a so-called "light-weight" ant. The tasks of loop detection and remembering the path back to the source now fall to the nodes themselves. Nodes keep track of the forward ants using a structure *np*, *ns*, *ant*ID, *t* � � where *np* is the previous node, *ns* the next (forward) node, *ant*ID the ID of the ant and *t* a timeout value.

When a forward ant is received, a node checks the table whether this ant has been received before. If yes, the ant is discarded as a loop was detected. If no, the ant is forwarded according to the transition rule. When the backward ant returns to the node, it looks up the way back to the source in this same table. The timeout timer *t* controls how long the node keeps the entry in the table. This also determines the maximum time a backward ant may take to come back via this node.
