#### 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 .

Comparing the life cycle of two algorithms, we suppose energy consumed is 0.1 J by receiving and sending information. As is shown in Figure 2, the solid lines signify that improved ant colony routing algorithm and the dotted line represent the basic ant colony routing algorithm. The total energy of the algorithms is the same at the beginning. As time moved on, the improved ant colony routing algorithm has longer running times. After many time tests, as is shown in Figure 3, improved ant colony routing algorithm has longer life cycle, and it is a good way to save resources.

On the other hand, Table 1 shows the comparison with the average routing path of the two algorithms. The average routing path of improved ant colony algorithm has reduced to about a third of basic ant colony algorithm. The improvement measures make the routing reduce. At the same time, the improved algorithm also reduces the energy consumption. We can see that the improved ant colony routing algorithm has more optimum routing path to guarantee the message fluency.

#### 5. Conclusions

The wireless sensor network has distinguishing characteristics such as weak node calculation ability and energy limited node, so we should make it efficiency and save sources in the design of wireless sensor network routing algorithm. Ant colony algorithm is a new heuristic searching algorithm, which has many advantages in route optimization but wastes some time and energy due to pheromone deficiency. Therefore, this paper puts forward improved ant colony routing algorithm, which is inspired by the Dijkstra algorithm changing the wireless sensor network undirected graph to directed graph and energy equilibrium consumption ideas to improve the ant colony algorithm.

Compared with basic ant colony routing algorithm, improved ant colony routing algorithm is an algorithm with low energy and has high performance.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

This work is supported by Beijing Education Science and Technology Development Program (KM201110016015).