Study on the Routing Technology of Wireless Sensor Network Based on Ant Colony Optimization

This article puts forward the routing algorithm of wireless sensor network based on ant colony optimization. The algorithm uses the characteristics of ant colony algorithm that is easy to realize local work, integrates link quality into the pheromone formation and supports multiple routes. When choosing routing, the probability is calculated that the node is selected as the next hop according to the pheromone concentration on the route. The ant colony optimization is self-organized, dynamic and multi-path, so it is very suitable for the routing of wireless sensor network. This algorithm has low routing cost, good self-adaption and supports multiple paths. It can balance energy consumption of the network and prolong the survival time of the network. The thesis makes comparative analysis of the simulation experiment and experimental result, proves that the ant colony algorithm can find the optimal routing in wireless sensor network and reaches the design objective of routing algorithm of wireless sensor network.


Introduction
At present, the routing protocol of wireless sensor network is the hot spot of domestic and international research.In system structure of wireless sensor network, the design of routing protocols in network layer is critical.Routing protocols have advantages and disadvantages under different application environment and performance evaluation index.Besides, the routing protocols are different according to different application and network infrastructure.In traditional wireless networks such as Ad-hoc, the primary goal of network protocol designing is to provide high quality service and use network bandwidth fairly and efficiently.The primary mission of this network routing protocol is to look for the route with low delay of communication time from the source node to the destination node, avoid communication congestion and balance network flow.The network research does not pay attention to the energy consumption.The node energy in sensor network which is limited without energy supplement, so the routing protocol needs to improve the effectiveness of the energy in the node.At the meantime, the sensor network nodes have large number and wide distribution and each node can only get local topological information.The routing protocol must choose the route from the source node to the destination node on the basis of topological information of local network [1] [2] [3].
Italian scholar Dorigo Maniezzo first put forward the ant colony algorithm.In 1991, he simulated food recruitment of ants and put forward the artificial ants stem algorithm on the basis of researching on real collective behavior of ants in the natural world.In the article concerning the ant colony algorithm, M. Dorigo thinks: the most important characteristic in ant colony algorithm is that the ants use some kind of hormone as the medium, indirect and asynchronous contact way to spread information.When hunting for food, the ants will leave chemical substances called pheromone.It can be found by the ants that arrive later in the same ant colony and influence the action of them.But the pheromone will reduce gradually as time goes by.The pheromone left by ants that arrives later will strengthen the original pheromone.In this way, the hormone on the path with more ants passing by will be more.The possibility that it will be chosen by the ants will be more.In the end, all the ants will crawl on the shortest path.M. Dorigo makes the best of the similarities between the process that the ants hunt for food and the famous TSP to solve TSP problems through simulating the process that the ants search for food (finally it is found out the shortest path from the ant cave to the food source through information exchange and mutual cooperation between individuals) [4] [5] [6] [7].

Fundamental of Ant Colony Algorithm
The ant is a social insect.The behavior of a single ant is very simple, but the ant colony formed by the single simple individual shows extremely complicated behavior and can finish complex tasks.Besides, ants can adapt to the changes of environment.For example, when obstacles burst in on the path that the ant colony moves on, the ants can find the optimal path again very fast [8].A large number of studies have found that the reason why the ant colony shows complex and orderly behavior is that the exchange of information and mutual cooperation among individuals play an important role.In the process of movement, ants can leave a substance called Pheromone on the route that they pass.They can perceive the existence and its strength of this substance when moving and use it to guide the moving direction of them.Ants are inclined to move towards the direction with high strength of this substance.They search for food through ex-changing of this information.
Next, we give a very simple biological prototype to understand the principle of ant colony algorithm, as shown in Figure 1.We suppose the ant colony find food in all directions randomly.When an ant finds the food, it will go back home along the road it comes and leaves pheromone on the way home.The pheromone will volatilize as time goes on and the concentration will decrease constantly.If two ants find the food and go back home, they can walk along the route of ABC or AC from the ant cave to the food.The route of ABC is longer than that of AC.Three ants move food, and the first and the second start first.The probability of choosing the route of ABC or AC is the same.We suppose the first ant takes the route of AC and the second ant takes the route of ABC.Each ant will release pheromone of certain concentration on the route it passes.The biological nature of ants will make it advance towards the route with higher concentration of pheromone.In this way, when the first ant has begun to return, the second ant is still on the way [9].At this time, because the route of AC has pheromone while the route of ABC does not have pheromone at the end of food source, the first ant still return on the route of AC.When the first ant arrives at home, the third ant starts.It will move forward along the route of AC, which has remnants of pheromone for twice (the ant goes there for one time and returns for one time).The route of ABC has remnants of pheromone only for one time.So the concentration of pheromone on the route of AC is higher than that of the route of ABC.Therefore, the ants will proceed along the route with higher concentration of pheromone.In this way, the ant colony will finally move forward along the route of AC, and then the ants at the back will gradually reach the food source along the short line from A to C.

Realization of Ant Colony Algorithm
Now we use the analysis of TSP problem (the shortest loop of n cities) to explain how to realize the basic ant colony algorithm [10].
We place m ants in n cities chosen randomly.Each ant chooses the city it hasn't visit according to certain basis: at the same time, after finishing one step (walk from one city to another city) or one cycle (finish the visit to n cities), update the concentration of residual information on all the routes.There are two bases to choose the next city: -the concentration of residual information on the route connecting city i and j at  the moment of t, namely the information provided by the algorithm itself; the heuristic information transferred from city i to city j is exposed by the problems that need solution through certain algorithm.In TSP problem, we often think to the distance between city i and city j) to present the degree of expectation from city i to city j.So the probability ( ) p t that ant k in city i chooses city j as the target city is: In the formula, α refers to the effect that the concentration of pheromone accumulated in the process of advancement has on the route it chooses; β refers to the relative degree of importance of expectation; k i N refers to all the possible target cities that the ants have not visited yet, ( ) k ij p t refers to the probability that the ant moves from city i to city j at the moment of t.That is to say, the probability that the "ants" choose a city is the function of the heuristic information provided by the problem itself and the quantity of residual information on the route from the current city that the "ants" are in to the target city [11].
In order to avoid the problem that the excessive residual information overwhelms the heuristic information, after each ant visits n cities (after a cycle finishes), it is necessary to update the residual information and weaken the old information by imitating the characteristics of human.Meanwhile, add the information ij t related to the latest route the ant visits, so we get: ( ) ( ) In the formula, ρ refers to the reserve part of residual information: 1-ρ refers to the part that the residual information is weakened.To prevent infinite accumulation of information, ρ must be lower than 1; represents the concentration of residual information that ant k leaves on the route from i to j during the time quantum from t to (t + n).
The flow of simple ant colony algorithm is shown in Figure 2.

Advantages to Apply the Ant Colony Algorithm to the Routing of Wireless Sensor Network
The ant colony algorithm is a branch of swarm intelligence.The simple individuals make the whole colony reach consistent behavior or pattern through communication and the adaptability to the environment [12].The living example realized by the ant colony algorithm above shows why this algorithm can be applied to the wireless sensor network very well.Let's discuss the reasons according to the characteristics of wireless sensor network: 1) Power-limited In wireless sensor network, the computing power, memory power and energy of nodes are limited, so the design of routing protocol should be simple to reduce the calculated quantity and storage content and energy consumption.In the ant colony algorithm, each individual only has simple function and works according to simple rules.
Designing the routing algorithm through this thought will make the routing algorithm of wireless sensor network simpler.This is one of the reasons to use ant colony optimization to solve routing problems of wireless sensor network.

2) Dynamic topology
In wireless sensor network, a node often loses efficacy and has too low energy or new nodes join, so the topological structure changes and a certain path loses efficacy.This characteristic is the main reason that many routing protocols cannot achieve good results after being used in wireless sensor network.The ant colony algorithm enjoys nat-ural superiority in solving dynamic problems.The ant colony algorithm bases on the Agent Systems and relies on independent work and indirect communication (through pheromone) of ants to finish a task.When some ants cannot work and the environment changes, other ants remain in operation according to the rules set in advance, free from the disturbance of other individuals and the external environment.Therefore, the ant colony algorithm can adapt to the change of network topology and find new path within the shortest time.

3) Local work
The ant colony algorithm works on the basis of local information.Because of limited memory power, nodes in wireless sensor network only record the routing information of neighbor nodes.Different from the past routing methods, the routing algorithm based on the ant colony optimization only needs local information to transfer to the neighbor node or in the whole network without the need of setting up the routing table or other whole information.

4) Support multi-path
The routing table of each node records the pheromone concentration on the path of neighbor nodes.The node chooses the next hop through calculating the probability on the basis of the pheromone concentration.Every path may be chosen.Therefore, this routing method support multi-path.

5) Self-adapt
The characteristics of the ant colony algorithm with self-organization, self-adapt and dynamic optimization make it adapt to the dynamic changes of network automatically.The algorithm has strong robustness.
The wireless sensor network does not have centralized control.It needs mutual cooperation of each node in the network to finish a task.The failure of single node should not influence other nodes and the work of the whole network.The ant colony algorithm has strong reliability and expandability.It provides a base to seek the solution of complex distributed problems without centralized control and global model.

Design of Routing Algorithm of Wireless Sensor Network
Based on Ant Colony Algorithm

1) Description of the thought of algorithm
The algorithm mainly focuses on the problem that the aggregation node often needs to send the inquiry command to all nodes in the sensing field in the application of data query of wireless sensor network.If we use the traditional flooding method to spread the inquiry command to the whole network to build the travel path from the aggregation node to observation area, the route setup will consume a lot of energy.Therefore, it seems very important about how to find the optimal path that rapidly transfers the data from the aggregation node to target area.It requires putting forward a routing algorithm that uses ant colony algorithm to look for the optimal path from aggregation node to the target node, to finish the special task of data query in the surveyed area [13].
Basic thoughts of the algorithm: a) produce the optimal path from Sink node to the target node through a group of "ants" artificial traversal network node; b) build an increasing number of paths through local search of ants; c) guide the search of each ant by using the information acquired to make paths converge and finally achieve the purpose of data collection; d) the algorithm does not need the sensor nodes in the network to maintain the network state; e) the ants does not need to traverse all nodes in the node topological graph.So it has better scalability.The test result also shows new routing algorithm has better performance.
Based on the above analysis, the ant colony optimization sets up the optimal path from the sensing field to the aggregation node according to the geographical location information of nodes in the sensing field, avoids the transmission mode of flooding, and then reduces energy consumption of the network.
2) Algorithm design First of all, make the following assumptions when the algorithm is suitable for wireless sensor network: a) The initial energy values of nodes are the same and the energy is limited; b) Each node has operational capability to process certain information; c) Each node has the only one ID number; d) Each node adopts omnidirectional antenna and has certain communication range; e) There is not unilateral link between nodes, namely node A can communicate with node B, and vice versa.
We suppose the sensor nodes can get the information of geographical coordinates through GPS.Each node maintains a coordinates table of its neighbor node and can update information in the table through exchanging a few data with the neighbor node periodically.When the energy of nodes is lower than a certain value, the communication distance between this node and its neighbor node is a maximum number given.When the voltage value is too small (lower than 2.7), the node cannot work normally, so it must save some energy to meet the energy requirements in data collection.Besides, the energy consumed by the node in sending data is in direct proportion to the square of physical distance, and the voltage cannot show linear changes, introduce a function in the routing algorithm.In this function, when the node voltage is close to the threshold voltage, the communication distance changes very fast.The topological structure of the sensor network can be regarded as an undirected graph G = (V, E).V refers to the set of vertexes formed by sensor nodes.E refers to the set of sides formed by all the links.According to the denseness of the deployment of sensor network node, we suppose figure G is connected, giving the following definitions:   (2-4) Among which, K is the proportionality coefficient, ( ) V is the current voltage value of the sensor.Initialize it as 3 V.When the system operates, 0 V refers to the voltage value of wireless sensor node sent to the aggregation node regularly.

V
is the threshold voltage and it is constant.Initialize it as 2.7 V. In the Formula (2-2), it is considered that the energy consumed in spreading information between nodes is in direct proportion to the square of the distance between nodes, and the rate of convergence of K value is considered.
In view of the fact that the energy of nodes in the wireless sensor network is limited, suppose when the node voltage is lower than the threshold voltage, the node cannot transit data normally. 3

Deficiencies of the Basic Ant Colony Routing Algorithm
Because the ant colony routing algorithm is abstracted on the basis of artificial ant co-lony, when solving actual problems, it cannot have the capacity and efficiency of ants in reality.It is a new type of algorithm.The research on ant colony routing algorithm is not mature.Compared with genetic algorithm and simulation algorithm, the ant colony routing algorithm does not have complete and solid basis of mathematical theory.So this algorithm has many deficiencies and problems and needs improvement.It mainly shows as follows: 1) In the initial stage of the algorithm, the solution speed is slow.The main reason is that in the initial stage of the algorithm, the concentrations of pheromone on those routes are similar, so the ants search blindly to a large extent.After a long period of time, the concentration of the pheromone has obvious guiding function.
2) On resource management.The ant colony routing algorithm belongs to planar routing protocol.The disadvantages of planar routing protocol include there is no managed node in the network, lack of optimal management of communication resource, do not help to improve the level of energy consumption.
3) Because the ant colony algorithm is a positive feedback algorithm, it is easy to fall into local optimization when the algorithm speed convergence is fast.4) Stagnation in the working process.This problem is similar to the rapid convergence of the algorithm.In the working process of the algorithm, after certain cycles, the ant colony could stagnate near some locally optimal solutions.Besides, because the pheromone in this area is strengthened repeatedly, it is difficult for ants to leave this area.Even though they break away from this area, the network will delay and the number of the cycles will increase, reducing the performance of the algorithm.
For these problems, we can adopt some assistant rules and methods to optimize and improve.Modify artificial ant colony, routing selection and pheromone volatilization to optimize the basic ant colony algorithm and improve the performance of ant colony algorithm to a certain degree [14].

1) Selective probability model for the ant colony to move forward
The feasible approach to improve the existing ant colony algorithm has been able to let the ant colony algorithm overcome the shortcomings and maintain the advantages, with rapid convergence and strong robustness.These algorithms find the optimal path with the maximum average energy after fully considering the rest energy on the selected path.But they do not take the transmission power consumption of nodes on the selected path into account but purely pursue the maximum of the average rest energy, so that the path is long and there are too many nodes participating in the transmission.The total energy consumption is too much when the information is transferred on the path.
For this problem, the thesis puts forward the routing algorithm of ant colony optimization (O_ARA) of multi-population.This algorithm designs the selective probability model of an ant that can evenly consider the transmission power consumption and node energy to move forward.It can balance the energy consumption of network, pro-long the whole life cycle of the network and get optimized paths as well as effectively solve problems such as congestion and stagnation.
In the O_ARA, k ant in m population decides to move to the next node according to the rule of the probability behavior choice defined below.The probability that k ant in i node chooses to visit the next node of j is: Among which, m ij τ is the pheromone concentration of m population on the route from i node to j node; ij η is the heuristic information of transmission power con- sumption.The transmission power consumption of nodes mainly has relationship with the square or biquadrate of the distance.So the heuristic information of the energy consumption of the node is defined as: While ij E represents the heuristic information of the node, making C refers to the primary energy of the node.j e refers to rest energy of j node; the pa- rameters of α and β refer to adjustable weights of pheromone concentration and heuristic information respectively.For k ant, the smaller the 2 ij d and 4 ij d (namely the smaller the energy consumption of the node), the bigger the j e will be (namely the rest energy of the node is bigger), and then the k ij p will be bigger.Obviously, the two heuristic functions show the degree of expectation of the ant moving from i node to j node.
k i allow refers to the neighbor node allowing access of k ant in i node.We define the j node meeting the following three requirements will belong to k i allow : a) j node is in the effective communication radium of i node; b) j node is not visited by k ant; c) the distance between j node and the source node is bigger than the distance between i node and the source node, and j node is nearer to the target node than i node.
The third requirement mentioned above is mainly used to control the moving direction of ants to make them move towards the direction nearer to the target node, so that the ants can reach the target node faster, accelerating the convergence rate of the algorithm.1 λ and 2 λ meet: The model flexibly uses routing strategy, tries to find out the transmission path that consumes the least transmitted energy and makes the rest energy of node become maximum, and then prolongs the survival time of the whole network.
2) Algorithm description Using the new selective probability model that the ant moves forward, we put forward the O_ARA ant colony strategy.The steps are as follows: Place ants of m populations in the source node.Each population has n ants.Ants of different populations are different.Ants in the same population are the same.Every once in a while, ants of different populations begin to move and look for the path to reach the target node.The information carried by each ant includes: ID number of the source node, ID number of middle nodes that the ants pass, average rest energy of middle nodes, the minimum rest energy of middle nodes and the distance between middle nodes.
When the ant in i node chooses the next access node, the pheromone belongs to this population.Different populations release different pheromones when passing this node.Ants of a specific population can only choose the next access node according to the pheromone of their own population.After reaching the next node, locally update the pheromone of this population according to the following rule: ( ) Among which, ξ and 0 τ are two parameters.ξ meets 0 1 ξ < < .0 τ is the ini- tial value of the pheromone.
After the ants reach the target node, store the information it carries in the target node, choose the optimal path, and record the optimal path of this time; send ants to the optimal path and update the pheromone of this population according to the following rules: Among which, bs T refers to the optimal path; refers to the increment of the pheromone; bs C is the length of the optimal path; the parameter ρ refers to the speed of the volatilization of the pheromone.
After the ants return to the starting point, send out the second batch of ants until it reaches the stop condition.Finally, each population can get one optimal path.Many populations can get multiple optimal paths.
Because the node of wireless sensor network is easy to break down, it is crucial to use multi-path transmission to improve the reliability of data transmission.This optimization scheme sets independent routings of ants in different populations to improve the network reliability.

Simulation Testing of Routing Algorithm of Wireless Sensor Network Based on the Ant Colony Algorithm
For wireless sensor network, at present, there isn't unified standard to evaluate different 2) Average delay: The ratio of the total hop count used in transmitting valid data and the data volume transmitted.
Formulas in the algorithm involve many parameters.The setting of these parameters not only refers to the empirical value but also makes appropriate changes according to the context of this article.The primary energy of each wireless sensor node is 5 Joule.The energy threshold is 0.5 Joule.The memory of data packet transmitted at the network layer is 32 bytes.The value of ρ in the calculation formula of pheromone is set as 0.3.The values of parameters α and β are 1 and 0.01 respectively when the rest energy is bigger than the energy threshold, and 0.01 and 0.01 respectively when the rest energy is smaller than the energy threshold.Add 0.02 to the pheromone concentration when a data packet passes on the node link.If the rest energy of the neighbor node of a node is smaller than the energy threshold, reduce the pheromone concentration on the path to 0.1 times of the original value, namely the volatilization coefficient is 0.1.The Sink broadcasts Ant Packet query message every 10 seconds.Randomly choose 20 original nodes to send data to the Sink node.This is the data and diagram of contrast concluded after simulating the routing algorithm of wireless sensor network based on the ant colony algorithm (ARA) and direct diffusion (DD) algorithm and Flooding algorithm.Figure 4 shows the simulation data of the average energy consumption of the three algorithms under different network sizes.It is the results concluded by taking the average value after letting each algorithm run for 30 times under each network size.The diagram shows the average energy consumption of DD is half of that of the Flooding.The average energy consumption of ARA algorithm is the smallest, about 15% lower than that of DD.Besides, because the average energy consumption of ARA algorithm is the smallest, the life cycle of its node and network will be the longest.It reaches the purpose of design that the wireless sensor network protocol reduces energy consumption, strengthens the effectiveness of energy and maximizes the life cycle of the network.Figure 5 shows the comparison of average delay that the three algorithms receive data packet under different network sizes.Similarly, we take the average value after operates network sizes for 30 times.According to the figure, the average delay of Flooding is the biggest and the average delay of DD is the smallest.This is because the data packet in DD algorithm is transmitted to Sink node along the shortest path with the biggest gradient.Its average delay is the most ideal among the three algorithms.The average delay of AR algorithm is bigger than that of DD, but they are very close.This is because when ARA algorithm chooses routing, it chooses the shortest path and considers the rest energy of the node.In addition, because it chooses the next hop according to certain probability, the data packet is not transmitted along the same path.The path selected in each time is not the shortest, so the delay increases.
Moreover, according to the simulation data, with the increase of network size, the average energy consumption of ARA algorithm slightly increases, DD slightly decreases and Flooding obviously increases.In terms of the average delay of data packet, DD does best.With the increase of network size, the average delay of ARA slightly increases but keeps the same on the whole.The average delay of Flooding is the biggest.And with the increase of network size, its average delay also increases constantly.It shows the routing algorithm of wireless sensor network based on ant colony algorithm has good performance in average energy consumption of network and time delay and good expandability in network size.son why it consumes less energy than ARA is that ARA finds the shortest path, but the shortest path does not mean it consumes the least energy.Therefore, the O_ARA algorithm considering the energy consumption and rest energy of the node can get less average energy consumption.

Simulation Comparison of the Optimized Ant Colony Algorithm
Figure 7 is the comparison of average delay that the two algorithms receive data packet under different network sizes.According to the figure, the average delay of the improved ant colony routing algorithm is lower than that of the basic ant colony routing algorithm.This is because the improved ant colony algorithm adopts the strategy of controlling the moving direction of ants, to let ants move toward the direction closer to the target node, so that the ants can reach the target node faster, accelerating the convergence rate of the algorithm.

The Implementation Result of Ant Colony Optimization
This is the figure of simulation experiment result of algorithm after adopting the optimization algorithm, the figure of the shortest path under matlab environment, the length of the shortest path in each cycle and the length of the average path [Figure 8].
The experiment shows the algorithm realized in matlab conforms to the thought of the basic ant colony algorithm with good operation.It is an optimized and new way for routing algorithm of wireless sensor network.According to the above simulation results, it shows that the improvement strategy greatly enhances the global searching ability of basic ant colony algorithm and accelerates the speed to obtain the optimal solution [Figure 9].It helps the application and extension of ant colony algorithm, makes it more suitable for some complex environment and ensures the timeliness, stability and reliability of data collection and transmission in the observation environment.

Conclusion
According to this article, compared with other classical algorithms, the average energy consumption and the average delay of the improved O_ARA algorithm perform better than basic ant colony algorithm.The improved ant colony algorithm adopts the strategy of controlling the moving direction of ants, to make the ants move towards the direction closer to the target node, so that the ants can reach the target node faster, accelerating the convergence rate of the algorithm.It makes the path with the least trans- mission energy consumption consider the energy consumption and rest energy of the node.The simulation data prove that the optimal path with the least average energy consumption can be found.We refer to the famous algorithm of business problem to draw the conclusion.The simulation based on matlab proves it.It is not the shortest path but the optimal path if the energy consumption is taken into consideration.The ant colony optimization has considered many factors.In the research, we conclude the experimental results by comparing the thoughts of routing algorithms and verifying simulation data under classical parameters.We need to further research about how to efficiently adjust and set parameters and build parameter system adapted to network routing.

Figure 1 .
Figure 1.Figure of path for ants to find food.
Figure 1.Figure of path for ants to find food.

1 ) 3 )
Initialize A(t) {initialize the ant colony and put m ants in n cities randomly.The pheromones on different paths in the initial time are the same, namely A(t) = C (C is constant)} 2) Evaluate A(t) {evaluate the adaptability of each ant according to the objective function} Release pheromone {release pheromone of certain proportion on the route the ant passes according to the adaptability.The higher the adaptability, the more the pheromone will be released} 4) The movement of ants {ants choose route according to the pheromone left by the previous ants and their own judgment} 5) The volatilization of the pheromone {the pheromone will dissipate as time goes by}.

Figure 2 .
Figure 2. Flow of simple ant colony algorithm.
Neighbor nodes: suppose a node and b node are in the effective communication range of each other, and then they are called neighbor nodes.Physical distance: suppose a node borders upon b node, then the actual distance from a to b is the physical distance between a node and b node, expressed as: , .L a b Among which, a(x, y) is the coordinates of a node, b(x, y) is the coordinates of b node.

3 )
Threshold voltage: refers to the minimum voltage value to let the sensor in normal operation.Communication distance: suppose a node borders upon b node, we call , WL a b as the communication distance of a node and b node.
Algorithm flowThe specific implementation flow of the algorithm is described as follows: ; //iAntCount is the number of ant; iMoteCount = 30; //iMoteCount is the number of sensor nodes; iLoopCount = 200; //iLoopCount is the count of loop; } Save the position coordinates sent by each node to the database.The Formula (2-4) calculates the communication distance between two nodes and update within the stipulated time.If the node not updated exists in the limited time, set this node not accessible, namely, set the communication distance from any node to this node as a maximum constant.a) Start the cycle and set the maximum cycle index; b) All ants traverse network nodes successively; c) Choose the next node to reach according to the result of Formula (2-1); d) Add the current node to the tabu list; e) If the current node is the target node, the next ant begins to traverse.f) Update the pheromone on the path each ant passes.g) Repeat step 3 until outputting the result.The algorithm flow is shown in Figure 3.The routing algorithm of wireless sensor network based on the ant colony algorithm chooses the routing through setting up gradient in the whole network and the phero-

1 )
routing protocols.According to physical truth, we use the following parameters to measure the effect of routing protocol of wireless sensor network based on ant colony algorithm: Average energy consumption: When Sink node receives a data packet from each source sensor node, each source sensor node sends the average energy that the data packet needs to consume to the Sink node.It is an important indicator to embody the effectiveness of energy of the algorithm.The ratio of energy consumption of the whole data network and the data volume transmitted is still an important indicator to embody the effectiveness of energy of the algorithm.

Figure 6 Figure 5 .
Figure6is the simulation result of the average energy consumption of O_ARA and ARA algorithms under different network sizes (number of nodes).Similarly, we take the average value after operates each algorithm for 30 times under different network sizes.According to the figure, compared with the basic algorithm, the average energy consumption of the improved ant colony routing algorithm slightly reduces.The rea-

Figure 8 .
Figure 8.The length of the shortest path in each cycle and the length of the average path.