**3.9 Approaches using colored pheromones**

Several algorithms are known which make use of "colored pheromones". This means that trails can be distinguished not only by the amount of pheromone dropped but also by the "color" of the pheromone. In the following, we introduce three approaches for *MANETs*, *WSNs*, and *WMNs* respectively.

## *3.9.1 MACO*

The original *Ant Colony Optimization* metaheuristic has some drawbacks in terms of stagnation and adaptiveness. Stagnation occurs when a network reaches convergence, and an optimal path is found and chosen by all ants. This, in turn, reinforces this path so much that the probability of selecting other paths becomes very low, which can lead to congestion on the "optimal" path. Adaptiveness describes the ability of an algorithm to react to changes in the network. *MACO* (Multiple Ant Colony Optimization) was developed to mitigate these problems in *MANETs* by Sim and Sun in 2002 [43].

*MACO* uses several ant colonies in parallel, which each use their own color of pheromone. The colonies are entirely separated and cannot sense pheromone other than that of their own color.

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

Similar to nature, the forward ants immediately drop pheromone on the paths they take. I.e., a "red" forward ant *Ar* will drop <sup>þ</sup>*τ<sup>r</sup>* on the forward direction of a link it chooses. The backward ant inherits the color from the forward ant and chooses the path back to the source with the highest amount of pheromone in its respective color. Backward ants also drop additional pheromone on the link on their way back.

Depending on the number of ant colonies used in parallel, several paths from the source to the sink can be found. These paths can then be used as alternative routes for load-balancing. Consider the following example with two ant colonies, "red" and "blue". Lets assume that there are three paths through the network, one long route *R*<sup>1</sup> and two similarly short (=good) ones *R*2, *R*<sup>3</sup> with *R*<sup>1</sup> >*R*<sup>2</sup> ≈*R*3. With just one ant colony, the true minimum route would be chosen as the optimal path. With two ant colonies, there is a possibility that one colony will find *R*<sup>2</sup> as the shortest path and the other colony *R*3. In this case, two alternative paths of similar quality were found. Therefore, *MACO* increases the probability of exploring alternatives.

## *3.9.2 Division of labour in SANETS*

Wireless *SANETs* (Sensor/Actuator Networks) are a form of *WSN* which also contains actuators (eg. robots). The same energy constraints as in *WSNs* apply.

Labella and Dressler develop in [44] an ant-based algorithm for division of labour and the routing of the respective traffic in *SANETs*. In their model, nodes can perform different tasks (measurement of temperature, recording of sound, recording of video, and movement). The goal is to distribute the tasks evenly in the network to get good measurement coverage and not overload single paths with high-load communications (video and audio transmissions).

Nodes choose tasks by employing the *AntHocNet* transition rule. The probability for a node to choose task *i* from the task list *T*agent is

$$P(i) = \frac{\pi\_i^{\beta\_{\text{task}}}}{\sum\_{k \in T\_{\text{parent}}} \pi\_k^{\beta\_{\text{task}}}}.\tag{38}$$

Pheromones are updated depending whether the task could be completed successfully or not by

$$
\pi\_i := \min \tau\_{\max}, \tau\_i + \Delta \tau \tag{39}
$$

if successful and

$$
\pi\_i := \max \pi\_{\min}, \pi\_i - \Delta \pi \tag{40}
$$

if not.

Since tasks are inherently linked with the traffic they generate (simple temperature values, sound, video, or command traffic for movements) tasks imply traffic classes. To deal with these different classes, the authors employ colored pheromones.

Each node *i* keeps separate routing tables *<sup>c</sup>***R***<sup>i</sup>* for each color *c*. Each entry *<sup>c</sup>***R***<sup>i</sup> nd* for going from node *i* via node *n* to destination *d* is of the form h i *t*, *h*,*e*, *s*, *m*, *v* where *t* is an estimation of the transmission time, *h* the number of hops in the route, *e* the energy required for transmission, *s* the minimal signal-to-noise ratio on the path, and *m* and *v* are flags that indicate whether a node is mobile and still valid for routing.

The transition rule is taken from *AntHocNet* and evaluated for each color:

$$\mathcal{P}\_{nd}^{i} = \frac{r\left(\_{c}\mathbf{R}\_{nd}^{i}\right)^{\beta}}{\sum\limits\_{j \in N\_{d}^{i}} r\left(\_{c}\mathbf{R}\_{nd}^{i}\right)^{\beta}}\tag{41}$$

where *N<sup>i</sup> <sup>d</sup>* is the set of neighbors for which a path to *d* is known. A different value for *β* is used during route discovery and data routing. *r*ð Þ� is a function *r* : **R** ! <sup>þ</sup> which evaluates the link statistics.

The algorithm also employs an elaborate probabilistic scheme to filter packets and deliberately drop them to avoid congestion (eg. if a measurement value did not change).
