Journal of Sensors

Volume 2015 (2015), Article ID 438290, 4 pages

http://dx.doi.org/10.1155/2015/438290

## An Improved Ant Colony Routing Algorithm for WSNs

Beijing University of Civil Engineering, Beijing 10044, China

Received 12 December 2014; Accepted 4 March 2015

Academic Editor: Qing-An Zeng

Copyright © 2015 Tan Zhi and Zhang Hui. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Ant colony algorithm is a classical routing algorithm. And it are used in a variety of application because it is economic and self-organized. However, the routing algorithm will expend huge amounts of energy at the beginning. In the paper, based on the idea of Dijkstra algorithm, the improved ant colony algorithm was proposed to balance the energy consumption of networks. Through simulation and comparison with basic ant colony algorithms, it is obvious that improved algorithm can effectively balance energy consumption and extend the lifetime of WSNs.

#### 1. Introduction

Ant colony algorithms that emerged by M. Dorigo et al. [1, 2] observe the behaviors of ants foraging for food. It has been quite popular for a wide variety of discrete optimization problems such as the traveling salesman problem, quadratic assignment problem, and job-shop scheduling [3]. Due to the characteristics of self-organization, autooptimizing, and dynamic topology, an ant colony algorithm is applied to the Ad Hoc network, wireless sensor network, and so on. Ant colony based routing algorithm is improved continuously. Kassabalidis et al. [4] proposed Ant-Net algorithm which realizes routing optimization through the forward ants and return ants (forward ants collect node information; return ants use this information update routing table). And ABC algorithm [5] (ant based control algorithm) is based on probability of mode selection and updates the path. This algorithm is only one kind of ants released from source nodes and these ants arrived at destination node after death. The node’s routing table will be updated, when the ant arrives at the destination node.

In the paper, we propose improved ant colony algorithm to acquire the optimal path by routing optimization. We try to save the energy consumption and prolong network life under the condition that the path meets the needs.

#### 2. Dijkstra Algorithm

##### 2.1. Dijkstra Algorithm

Dijkstra algorithm is proposed by Dutch computer scientist Edsger Wybe Dijkstra to solve problem about the shortest path from an original point to other points in the directed graph.

Every point updates the shortest path information from the original point. It is usually defined as follows.

Suppose and are two sets that represent original point and other points.

At the initial moment, is subsets and coverage of and are subsets and coverage of .

*Step 1.* The distance is the shortest distance from original point to other points except to . Calculating , we could get point which is the closest point to point in the set .

*Step 2.* Stop if the set is null; otherwise return to Step 1, where , .

#### 3. Improved Ant Colony Routing Algorithm

In the ant colony algorithm model, wireless sensor network could be described as an undirected graph. At the beginning, the lack of initial pheromone leads to low solving speed and high consumption, which has affected the overall performance of ant colony algorithm [6, 7]. In order to solve the problem, the improved ant colony algorithm based on Genetic-Ant Colony algorithm [8] is presented. However, it might cause an increase of the break in data transmission after crossover and mutation. In the paper, the idea have been proposed about Dijstra algorithm to improved ant colony algorithm distributing the nodes into the directed graph. It could increase the initial efficiency of algorithm and ensures the stability.

##### 3.1. Pheromone Initial Optimization

Node number and communication radius are determined. Let , , be the set recording the previous node number and the node coefficient. Let be the traffic demand between the node and the node .

*Step 1*. End point communicates with adjacent nodes. The adjacent nodes record the number of termination point and update node coefficient.

If is less than the , the is set as one and is put into the set .

*Step 2.* Get the number of nodes which could direct communication with start point. The initial value of is zero, and the value plus one when is less than the .

*Step 3.* Node communicates with adjacent node . When or , the node updates and records number of node until start point gets number of its adjacent nodes .

Through the operation, the node gets the information about routes from the node to the end point. The routes have no back haul.

##### 3.2. Path Choices

Simulated with the search food process of ant colony, the model for basic ant colony algorithm is as follows.

Suppose is a set and are subsets and coverage of and, at the initial moment, they are selected; ant will be randomly placed on the -subsets, assuming that the initial information of each subset . The probability of ant transfer from the subset to subset is [9]Among them, is the iteration number, is ID () for ants, and is the iteration number; allowed is the next subset selected from ant ; is the pheromone strength from subset to subset ; is the inspired degree of ant shifted from subset to the subset . These two parameters and are accumulation of information and inspired information in the process of ant’s sports, reflecting the relative importance of ants to choose the next subset.

In order to balance the energy consumption of nodes, improved ant colony algorithm entered the energy factor based on the basic ant colony routing algorithm to find shorter and high energy path. Then, the improved probability from node to node is defined as follows: Using the relative factor represents normalization of method, where is relative energy factor which equals residual energy of node divided by the initial node energy and multiplied by 1.2. The parameters are accumulation of information and inspired information in the process of ant’s sports, it reflects the relative energy consumption of ants to choose the next subset.

##### 3.3. Pheromone Update

Subset is determined, and ant will stop when elements that selected subset contained target node; this will mark the end of the cycle. After all the ants have completed a cycle, the pheromone of subsets is adjusted according to the following equations:Among them, is the attenuation coefficient of the pheromone; usually to avoid unlimited accumulation of informational on subset; is the number of subsets and selected in this cycle; is the pheromone strength; it affected the convergence speed of algorithm to a certain extent.

#### 4. Simulation Result

Computation on simulation examples and comparison with basic ant colony routing algorithm show that improved ant colony routing algorithm is effective. As shown in Figure 1, we simulate a stationary network with 48 sensor nodes deployed in the target region of square region. We also initialize that battery energy of each sensor is 1 J and the sensing radius of each node is 30 m. The default value of ant colony algorithm parameters is set to , , , , , and .