CS266 Final Paper
ACO Routing in Wireless Sensor Networks
Atanu Roy Chowdhury
The recent popularity of applications based on wireless sensor networks provides a strong
motivation for pushing its technological limits.We feel that sensor networks can beneﬁt from
some of nature’s robust solutions.In this work we evaluate the applicability of pheromone
based foraging techniques,found in many ants,to route data packets in sensor networks.We
ﬁnd that such a solution is very robust and can easily recover from signiﬁcant outages within
the network.However high overheads do not allow it to replace traditional routing techniques
in its current form.Our work is implemented in the ns2 simulator.
Due to the recent availability of low cost and low power hardware,the number of wireless
sensor network (WSN) deployments has rapidly increased over the past several years.A
WSN deployment typically consists of hundreds to thousands of small,battery operated,
wireless sensors dispersed throughout a geographical area and are characterized by several
key features.First,they are self organizing,which means the sensor nodes coordinate with
each other to form a system that adapts to achieve a goal more eﬃciently .Second,they
have localized decision making,with little to no input from a centralized source.Third,the
sensor nodes have limited power,computational ability,and limited storage.Finally,the
wireless radios on these devices are short-range and have a low data rate.
Sensor networks are closely related to ad-hoc wireless networks but vary in the following
areas:First,WSNs deploy many more nodes than ad-hoc networks.This implies that
whatever routing algorithm deployed must be scalable.Second,as we stated above,WSNs
are constrained in computation power,energy,and the amount of storage compared to a
typical ad-hoc network.This constrains our routing algorithm to be straightforward with as
little overhead as possible.Third,WSN deployments are often unattended for long periods
of time,often months or years.This requirement means our routing algorithm must be
robust to changing conditions,node failure,and must be self healing.
Typical uses of WSNs include environmental monitoring,such as detecting volcano erup-
tions ;military uses such as vehicle tracking;building monitoring such as vibration sens-
ing;and health-care applications,such as monitoring patients in disaster situations.The
primary responsibilities of WSNs are to collect and report data and events,typically to a
There as been much research in routing in wireless sensor networks .In our context,
routing refers to building tables for each sensor node to tell incoming data which outbound
link to send the data to its ﬁnal destination.
Routing is at its most basic level an optimization problem.One way to look at routing is
ﬁnding the shortest path between two nodes and for millions of years ants have had success
ﬁnding the shortest paths between food sources and their nest using only a pheromone trail
laid by other ants .This is known as as stigmergy  and Ant Colony Optimization (ACO)
routing,which is inspired from the actions of ants,have been shown useful for routing in
wired networks .
There are a number of reasons that ACO algorithms are a good ﬁt for WSN routing.
ACO algorithms are decentralized just as WSNs are similarly decentralized.WSNs are
more dynamic that a wired network.Nodes can break,run out of energy,have the radio
propagation characteristics change.ACO algorithms have been shown to react quickly to
changes in the network.
In this paper we look at ACO routing for wireless sensor networks.We give an overview
of several of the currently used routing algorithms in WSNs.We then give an overview of
the how AntNet is implemented on the ns2 simulator using 802.15.4.We then compare ACO
based routing to AODV and DSR routing,standard WSN routing algorithms.Finally,we
wrap up the paper with a discussion of our results and describe our future work with the
2 Routing in Wireless Sensor Networks
Generally speaking,routing algorithms can be described in two broad classes,reactive (on-
demand) routing and proactive (table driven) routing.Reactive protocols establish a path
between the source and destination only when there are packets to be transmitted.Two com-
monly found reactive protocols in WSNs are Ad-hoc On-demand Distance Vector (AODV)
 routing and Dynamic Source Routing (DSR) .They are described in more detail below.
Proactive protocols are constantly probing the network to maintain routes for all the
nodes.One common proactive protocols is Destination-Sequenced Distance Vector (DSDV)
 routing.This protocol is described in the next section.ACO algorithms such as AntNet
are proactive protocols.
Proactive protocols always have a route available,so they are more suited for dynamic
networks,such as when the nodes are mobile.They are eﬃcient if routes are used often.
Reactive protocols create their routes just before data is about to be sent.This ensures the
nodes have the most up to date routing information but there is a start up cost as the route
is being acquired.Reactive protocols have lower overhead than the proactive protocols and
work better for intermittently used links.
2.1 Destination-Sequenced Distance Vector Routing
DSDV is a proactive routing protocol based on the Bellman-Ford algorithm.It expands on
Bellman-Ford by having each entry in the routing table contain a sequence number.A route
is considered more favorable if it has a higher sequence number.If two routes have the same
sequence number,the one with the lower cost metric is chosen.When a node decides a route
is broken,it advertises that route with an inﬁnite metric and a sequence number one greater
than before.It can be shown that this routing algorithm is loop free.
2.2 Dynamic Source Routing
DSR is a reactive protocol that is similar to AODV,which is described below.The primary
diﬀerence from AODV is DSR uses source routing instead of hop-by-hop routing.Each
packet routed by DSR contains the complete ordered list of nodes that the packet travels
through.The protocol consists of two phases,route discovery and route maintenance.Route
discovery is used to obtain a path from a source to a destination.A route request packet is
ﬂooded through the network and is answered by a route reply packet.Route maintenance
is used to detect if the network topology has changed.
2.3 Ad-hoc On-Demand Distance Vector Routing
AODV is an reactive protocol that is a combination of DSR and DSDV.Route discovery
and maintenance is similar to DSR,and uses the hop-by-hop routing of DSDV.It also uses
sequence numbers for loop prevention,with the goals of quick adaptation under rapidly
changing link conditions,lower transmission latency that the other protocols,and less band-
2.4 ACO Based Routing
Aside from AntNet,which we will describe in detail in the next section,there have been a
number of ACO routing protocols that have been proposed for ad-hoc networks.
2.4.1 Probabilistic Emergent Routing Algorithm (PERA)
PERA  is an ACO algorithm designed to take advantage of the broadcast capabilities
of wireless networks.Route discovery is carried out by a controlled ﬂooding to obtain and
update the routes in the network.As there is no ﬁxed links in a wireless network,neighbor
discovery is done by broadcasting “HELLO” messages.
AntHocNet is an AntNet based algorithm for routing in mobile ad hoc networks (MANETs)
.To reduce the overhead of constantly ﬁelding ant agents,AntHocNet adapts a hybrid
approach,having both proactive and reactive schemes.AntHocNet does not maintain routes
to all possible destinations,but sets up routes only when they are needed.The paths are
setup in the same manner as AntNet,by launching multiple ants to ﬁnd multiple paths to
the destination and by having the backward ants return to the source setting up the paths
by updating pheromone tables.
After the pheromone tables have been established,data packets are routed probabilisti-
cally over the diﬀerent paths following these pheromone tables.While the data session is
going on,the paths are monitored and are maintained and improved using proactive forward
ants.In this way,the algorithm quickly reacts to link failures or changes in link quality.
3 Implementation of AntNet for WSNs
This sections give an overview of the AntNet algorithm for WSNs on ns2.The imple-
mentation is fairly faithful to the description given in  with the addition of a neighbor
discovery protocol.This is necessary as we using wireless links and must manually discover
the neighbors near each wireless node.
3.1 Packet Types
There are three types of packets in the AntNet implementation:data packets,ant packets,
and neighbor packets.Data packets are the data carried in the sensor network.The routing
algorithmroutes these packets fromsource to destination,but has no interest in the contents
of these packets.Forward and backward ants are represented by control packets.These
packets are what are used to update the routing table.These packets contain the ﬁnal
destination address,the birth-time,the arrival time to the ﬁnal destination,and a stack
of each node visited.The ﬁnal destination is needed so the ant knows it has ﬁnished its
journey and can be replaced with a backwards ant.The birth-time and arrival time are used
to calculate the total trip time,and the stack of each node visited is needed so that the
backwards ant can retrace the forward ant’s trip exactly in reverse.
3.2 Node Data Structures
Each node in the network has a single input queue,one high priority output queue,and
one low priority output queue.The low priority queue is used for all data packets and any
forward ant packets,while the high priority queue is used for the reverse ant packets.Packets
in the high priority queue are serviced before any packets in the low priority queue.The
forward ant packets are placed in the low priority queue so an accurate representation of the
total trip time may be obtained.High priority queues are used on the return trip to update
the nodes as quickly as possible.
Figure 1:The data structures for a node:routing table (T
) and local traﬃc stats (M
In addition to the input and output queues described above,each node has two data
structures,as shown in Figure 1,which the routing agents can interact with in an indirect
contains a probabilistic measure of next hop nodes and M
contains a weighted
mean and variance of trip times to node k over the observation window W
to evaluate whether the trip time of a new route is a marked improvement over what is
3.3 Algorithm Description
In this section we will present an overview of the AntNet algorithm.For full details,see .
The algorithm goes as follows:
1.At regular intervals,from every network node s,a forward ant F
towards a randomly selected destination node d.Destinations are probabilistically
chosen to match the current traﬃc patterns.
2.While traveling towards their destination nodes,the forward ants store the address
of each visited node N
and the departure time to the next hop in a memory stack.
Forward ants share the same queues as data packets,so they experience the same traﬃc
3.At each node k,each forward ant probabilistically chooses the next node based on a
greedy stochastic policy.
4.If all the neighboring nodes have been visited previously,then the next node is chosen
uniformly among all the neighbors.In this case,since all the neighbors have been
already visited,the forward ant is forced to return to a previously visited node.Thus,
regardless of which neighbor is chosen as the next node,the forward ant is in a loop
5.With some probability ε,the next node may be also chosen uniformly among all the
neighboring nodes.The parameter ε is deliberately incorporated to overcome the
problem where one of the entries in the routing table is almost unity,while the other
are vanishingly small.In such a situation,the forward ants always choose the same link
and thus stop exploring the network for other routes.The parameter ε ensures that the
network is being constantly explored,though it introduces an element of ineﬃciency
in the algorithm.
6.If a cycle is detected,that is,if the ant is forced to return to an already visited node,
the cycle’s nodes are popped from the ant’s stack and all memory about the cycle is
destroyed.If the cycle lasted longer than the lifetime of the forward ant before entering
the cycle,the ant is destroyed.The lifetime of a forward ant is deﬁned as the total
time since the forward ant was generated.
7.When the destination node d is reached,the forward ant F
generates a backward
.The forward ant transfers all the memory contained in the stack S
the backward ant,and dies.
8.The backward ant takes the same path as the corresponding forward ant,but in the
opposite direction.At each node k,the backward ant pops the stack S
to the next node.Backward ants do not share the same queues as data packets and
forward ants;they use high priority queues to quickly propagate to the routing tables
the information collected by the forward ants.
9.Arriving at a node k coming from a neighbor node h,the backward ant updates the
two main data structures of the node,the local model of the traﬃc M
and the routing
,for all the entries corresponding to the destination node d.
10.The mean µ
and variance σ
entries in the local model of traﬃc M
The best value t
of the forward ants trip time from node k to the destination d
stored in the moving observation window W
is also updated by the backward ant.If
the newly observed forward ant’s trip time t
from the node k to the destination d
is less then t
is replaced by t
11.The routing table T
is changed by incrementing the probability p
ity of choosing neighbor h when destination is d
) and decrementing,by normalization,
the other probabilities p
3.4 Neighbor Discovery
As we are working in a wireless medium,neighbor modes must be occasionally discovered.
This is done with a straightforward protocol that is run in conjunction with AntNet.
1.At every HELLO
INTERVAL seconds,each node broadcasts a message to its neighbors.
This message lets the neighbors know the node is alive and ready to route packets.
2.Every node checks to see if its neighbors are still available.If a node has not heard
from a neighbor node greater than a predeﬁned expire time,that neighbor is deleted
from the neighbor list.
3.When a node hears a new neighbor,it adds that neighbor to the list,and the routing
is updated with a default minimum probability assigned to that node.
4.When a node hears from an existing neighbor,the expire time is updated.
While AntNet has shown promise for routing in wired networks,it is still to be shown
whether it is feasible for wireless networks.Before going through the eﬀort to port AntNet
to an actual wireless sensor node platform such as the Telos motes ,simulations were
ﬁrst done to prove the eﬀectiveness of AntNet.
To get the most realistic simulation for the motes as possible,we went with the simulator
with the best 802.15.4 support.802.15.4 is an IEEE standard which speciﬁes the PHY
(physical) and MAC (medium access control) layers for low-rate personal area networks.
The 802.15.4 standard is supported on the radio used on the Telos motes.
The best implementation for 802.15.4 is wpan module provided by the ns2  simulator
version 2.26 or greater.It is a full featured implementation with support for pure and slotted
CSMA-CA,beacon and non-beacon modes,channel scanning,energy detection (ED),clear
channel assessment (CCA),and link quality (LQD).
We tried two implementations of AntNet for ns2.The ﬁrst implementation we tried 
did not have support for wireless nodes.We spent considerable time porting the code to
use wireless nodes.In the end,there were too many assumptions about using wired nodes
hard-coded into the implementation for us to successfully run our experiments.
We fared better with our second AntNet implementation  for ns2.This implemen-
tation was designed for MANETs and thus has support for wireless 802.11 nodes right out
of the box.In theory,it should have been trivial to swap out the 802.11 radio model for
ns2’s 802.15.4 radio,but in practice there was a fair bit of porting involved to get everything
running correctly even in this setup.
4.1 Experimental Setup
For our experiments,we compared AntNet to AODV and DSR.All of our experiments
consisted of 50 wireless nodes randomly placed on a 400x400 meter area and run for 300
seconds.Even though WSNs typically are not mobile,we have allowed the nodes in our
experiment to move a rate of 1-2 meters/second.This is a good approximation to a varying
radio link quality found in real stationary WSNs.We have set the packet size to 64 bytes,
which is typical size of a sensor packet with radio overheard.The datarate is set to 1 packet
per second,typical of a environmental sensing application.We ran each experiment with
varying amounts of route changes.This parameter is referred to as pause time,and was set
at 0,30,60,120,and 300.A pause time of 0 means that the routes are constantly changing,
while a pause time of 300 means the routes will never change.For each pause time,we ran
with 10,20,and 30 nodes attempting to send traﬃc.The results are shown in the following
Our experiments measure three key parameters of the routing protocol,First,the average
end-to-end delay experienced by an application level packet.Second,the packet delivery
ratio (pdr) and third,the routing overhead involved.
Pause time (sec)
Average End-to-End Delay
ANTNET, 10 sources
ANTNET, 20 sources
ANTNET, 30 sources
DSR, 30 sources
AODV, 30 sources
Figure 2:Average delay with AODV,DSR,and AntNet
Figure 2 shows the average delay experienced when using the three routing protocols
respectively.In case of AODV or DSR the routes become quasi-static as the mobility in the
network decreases.The observed delay is constant because previously discovered routes can
be cached.Note that in our simulations the network changes relatively slowly,almost at
human speeds.In the case of AntNet,the delay is always higher because there is a strong
probability of a fraction of the packets being routed through longer paths.Thus in a static
network,AntNet exhibits a strong tendency to explore all available routes,leading to higher
end to end delays.However this very fact also exhibits AntNet’s robustness against severe
Figure 3 plots the packet delivery ratio for the three routing algorithms.It can be
observed in the case of AODV or DSR that the pdr converges to one for static networks.
Again this can be attributed to all packets in a ﬂow taking the same path.However,in
# Packets received / # Packets sent
Pause time (sec)
Packet Delivery Ratio
ANTNET, 10 sources
ANTNET, 20 sources
ANTNET, 30 sources
DSR, 30 sources
AODV, 30 sources
Figure 3:Packet Delivery ratio for AODV,DSR,and AntNet
the case of AntNet packets from the same ﬂow might take diﬀerent paths.In fact some of
them might also take bad paths and get lost.Moreover using AntNet a moderately loaded
network performs better than a sparsely loaded network because the additional packets covey
addition information about the network.
Number of Packets
Pause time (sec)
ANTNET, 10 sources
ANTNET, 20 sources
ANTNET, 30 sources
DSR, 30 sources
AODV, 30 sources
Figure 4:Routing overhead for AODV,DSR,and AntNet
Figure 4 shows the routing overhead for the three routing protocols with respect the mo-
bility within the network.Since AntNet sends out these periodic ants to collect information
about the network,its routing overhead is many orders of magnitude higher than either
AODV or DSR.Notably this overhead increases as the network becomes more stable,but is
independent of the traﬃc in the network.This is because ants are launched periodically irre-
spective of the application traﬃc.As the network becomes stable the algorithm behaves like
ants spreading out and foraging for food.In case a node is sending ants to an unreachable
destination,the ants are dropped.Note that in case of a static network all ants to this node
would be dropped whereas in a dynamic environment there would be a slight probability of
the ant ﬁnding its destination.
5 Conclusions and Future Work
In this work we evaluated the suitability of the AntNet routing protocol for wireless sensor
networks.However we found the performance of AntNet to be inferior to other established
routing protocols like AODV or DSR.AntNet’s primary disadvantage is that it has very high
overheads.Much of AntNet’s success in wired networks could not be directly translated in the
wireless domain because a of the shared nature of the medium i.e.the link quality between
a node and all its one hop neighbors is roughly the same.However AntNet’s probabilistic
routing scheme allow it to be very robust.It is therefore an attractive option for sensor
networks in hostile terrain.
Going forward,there are two avenues we would like to pursue.First is the idea of using a
hybrid approach such as used in AntHocNet.As forward ants are not launched until a route
is needed,protocol overhead is greatly reduced.This is the reactive part of the algorithm.
While the data is being transferred through the route,ants are launched to explore and
improve the route,you still have the robustness and resiliency of the traditional AntNet
implementation.This is the proactive part.This implementation should reduce the routing
overhead greatly and is worth looking into.
The second avenue we would like to explore is using ACO techniques to obtain energy
aware routing.Instead of having the ants update the pheromone tables based on fastest trip
time,the ants can update the tables to maximize the overall lifetime of the entire network.
 Collier,T.C.and Taylor,C.E.(2004) Self-organization in sensor networks.Journal of
Parallel and Distributed Computing,64(7):866–873.
 E.M.Royer and C-K Toh.A Review of Current Routing Protocols for Ad-Hoc Mobile
Wireless Networks.IEEE Personal Communications,Apr.1999.
 S.Goss,S.Aron,J.L.Deneubourg,J.M.Pasteels (1989).Self-organized shortcuts in the
 Grasse,P.P.(1959).La reconstruction du nid et les coordinations inter-individuelles
chez Bellicosi-termes natalensis et Cubitermes sp.La theorie de la stigmergie:Essai
d’interpretation des termites constructeurs.In Ins.Soc.,6,41-83.
 G.Di Caro and M.Dorigo,”AntNet:a mobile agents approach to adaptive routing”,
Tech.Rep.IRIDIA/97-12,Universit Libre de Bruxelles,Belgium.
 David B.Johnson.Routing in Ad Hoc Networks of Mobile Hosts.Proceedings of the
Workshop on Mobile Computing Systems and Applications,pp.158-163,IEEE Computer
Society,Santa Cruz,CA,December 1994.
 Perkins,Charles E.and Bhagwat,Pravin (1994).”Highly Dynamic Destination-
Sequenced Distance-Vector Routing (DSDV) for Mobile Computers.
 C.E.Perkins,”Ad-hoc on-demand distance vector routing,” in MILCOM ’97 panel on
Ad Hoc Networks,Nov.1997.
 Frederick Ducatelle,Gianni Di Caro,and Luca Maria Gambardella.Ant Agents for Hy-
brid Multipath Routing in Mobile Ad Hoc Networks.In WONS,pages 44-53,2005.
 ohn S.Baras and Harsh Mehta.A Probabilistic Emergent Routing Algorithmfor Mobile
Ad hoc Networks.In WiOpt’03:Modeling and Optimization in Mobile,Ad Hoc and
Wireless Networks,March 3-5,2003.
 J.Polastre,R.Szewczyk and D.Culler:Telos:Enabling Ultra-Low Power Research.
In Proceedings of the 4th International Symposium on Information processing in Sensor
Networks (IPSN/SPOTS ’05),April 2005.
 OMNeT++ Discrete Event Simulation System http://www.omnetpp.org/.
 Information Sciences Institute.NS-2 network simulator http://www.isi.edu/nsnam/ns/.
 V.Laxmi,Lavina Jain and M.S.Gaur,International Conference on Wireless Commu-
nication and Sensor Networks (WCSN),India,December 2006.
 FJ Arbona Bernet.Simulation of Ant Routing Protocol for Ad-hoc networks in NS-2.
Delft University of Technolog,2006.
 AntNet:Distributed Stigmergetic Control for Communications Networks,G.Di Caro
and M.Dorigo,Journal of Artiﬁcial Intelligence Research,9:317–365,1998.
 Deploying a Wireless Sensor Network on an Active Volcano,Geoﬀ Werner-Allen,Kon-
rad Lorincz,Mario Ruiz,Omar Marcillo,Jeﬀ Johnson,Jonathan Lees,and Matt Welsh.
In IEEE Internet Computing,Special Issue on Data-Driven Applications in Sensor Net-