• No results found

The MagAntA adaptive routing algorithm

7.2 The MagAntA routing system

7.2.5 The MagAntA adaptive routing algorithm

Figure 7.3: Declaration of the routing interface structure. Some details were left out to improve readability; e.g., the parameters taken by each of the functions are left out here.

describe below in subsection 7.2.5. We would like to point out that the followed approach is quite general, and that also more traditional routing algorithms, such as AODV or OLSR, could be added to the system.

7.2.5 The MagAntA adaptive routing algorithm

The adaptive routing algorithm that is currently implemented in MagAntA can be considered a simplified version of AntHocNet. The algorithm is partly reac-tive, in the sense that nodes only gather routing information about destinations that they are communicating with. Therefore, when a source node starts a data session to an unknown destination, it executes a route setup process, in which it looks for an initial route to the destination. During the course of the session the algorithm works proactively: the source node periodically sends out ant agents towards the destination, in order to find new paths, and to update informa-tion about existing ones. Pheromone values are based on the round-trip-time experienced by the ants. Data are forwarded stochastically according to the pheromone tables. Link failures are detected using hello messages and are dealt with using warning messages. In what follows, we give details about each of these elements.

When a node in the network starts a data session to an unknown destination, it reactively starts a route setup process, in which it searches for initial routing information. This process consists of flooding a reactive forward ant over the network in search of the destination. When the ant arrives in an intermediate

node, this node’s address is added to the ant, and the ant is forwarded. The forwarding at intermediate nodes is normally done by broadcasting, unless the ant is in a node where routing information to its destination is available. In that case, the ant is unicast to a stochastically chosen next hop. The probability of choosing a next hop n is given in formula 7.1.

Pnd= nd)β1 P

j∈Njd)β1 (7.1)

In this formula, τndis the pheromone associated with neighbor n and desti-nation d. By raising it to a power β1, exploration can be encouraged (β1 < 1) or limited (β1 > 1). When a copy of the forward ant reaches the destination, a backward ant retraces the forward path and updates the routing tables of in-termediate nodes. In this way an initial route is established between the source and destination of the session.

During the course of the session, the source node proactively tries to improve and extend existing routing information. To this end, it periodically sends out proactive forward ants to sample existing and new paths towards the destina-tion. Proactive ants are not broadcast, but are unicast based on the pheromone values. Like during the unicasting of reactive forward ants, a next hop is chosen probabilistically at each node. The probability for a proactive forward ant with destination d to take next hop n is given in formula 7.2.

Pnd= (1 − q) · nd)β2 P

j∈Njd)β2 + q · 1

|N | (7.2)

In this formula, (1 − q) is the probability that the ant will be forwarded using the pheromone values. Again, we raise the pheromone value τnd to a power β2, in order to increase exploration (β2 < 1) or decrease it (β2 > 1). q is the probability that uniform forwarding is applied. This is another way of enhancing exploration: each of the |N | neighbors can be picked with probability (1/|N |). While a low value for power β2can allow the exploration of paths with low pheromone, uniform forwarding allows to choose neighbors for which no routing information at all is available. Different from AntHocNet, we do not implement pheromone diffusion (see subsection 4.2.3) here, in order to keep the first algorithm implementation in MagAntA simple. Therefore, there is no virtual pheromone available to guide the exploration of unknown paths. The source nodes stop sending proactive ants to a destination if for a certain period no data have been sent to this destination.

Pheromone variables are calculated based on the round trip times (RTT) experienced by the ants. When a forward ant passes through a node, this node adds its address to the ant, and a timestamp. When the backward ant arrives back at the same node, the timestamp in the ant is compared to the current time in the node to get the RTT. This allows to get a good estimate without the need for synchronized clocks in the different nodes. Pheromone values are updated as indicated in equation 7.3. As pheromone represents a goodness value rather than a cost, we update with δid, which is the inverse of the RTT

from the current node through neighbor i to destination d. γ is a discounting factor. The use of RTT as a routing metric is different from AntHocNet, where the best results were obtained when paths were evaluated based on information about the quality of the wireless radio link (see subsections 4.2.6 and 5.3.2).

Unfortunately, in many existing systems it is difficult to obtain such information from the physical or MAC layer protocols, and we decided therefore not to use it here. In a later implementation, we could implement local probing by the routing algorithm itself to find out about link quality. This is the approach followed in the Roofnet project of MIT [30].

τid← γ · τid+ (1 − γ) · δid (7.3) Data packets are forwarded stochastically according to the pheromone val-ues. However, different from proactive forward ants, there is no uniform routing for data packets, and the power exponent β3 that the pheromone is raised by is higher than for ants, so that there is a stronger preference for the best paths.

This is because stochastic routing for data packets is not meant for exploration, but rather to spread the data load over multiple available good paths. The probability for a data packet with destination d to take a next hop n is given in formula 7.4.

Pnd= nd)β3 P

j∈Njd)β3 (7.4)

Link failures are detected via hello messages. Hello messages are short bea-con messages which are sent out periodically by each node. When a node hears a hello message from another node, it knows that this node is its neighbor.

When for a multiple of the hello beacon period no beacon was received anymore from the other node, the connection to the neighbor is considered broken. This mechanism for failure detection is similar to the one used in AntHocNet (see subsection 4.2.5). However, in AntHocNet link failures could additionally be detected when unicast transmissions failed. This is not possible here, because feedback about transmission failures are normally not given by the Linux routing protocol stack (one possible solution is available if the Linux kernel contains the Linux Wireless Extension [258], which is at the moment however not supported in many systems and for many drivers).

When a connection failure is detected, the routing algorithm simply removes all the entries concerning this neighbor from its pheromone table. It does not immediately warn other nodes about the changed situation. However, it is possible that due to the lost connection, the node now no longer has a path to some destination. If this is the case, and the node is still receiving data packets for this destination, it unicasts a warning back to the node that is sending these data packets, stating that this route is no longer valid. This approach of dealing with link failures is different from AntHocNet, on the one hand to keep the first implementation in MagAntA simple, and on the other hand because we expect to use MagAntA on WMNs rather than MANETs, where network change rates are lower and fast reactions to link failures are therefore less crucial.