Abstract
The wireless sensor networks are usually deployed in various application-specific contexts, which can be treated as distributed databases with big data. The event-involved query responses can be obtained by issuing query requests to this kind of database. However, the constraints of the energy and delay have had a great impact on the operation of wireless sensor networks. How to design the query-involved network model and the corresponding query processing algorithms is extremely challenging. This work investigates query processing problem in resource-constrained wireless sensor networks with the two-tier architecture and multiple query agents, where the multiple nodes of query agents are configured in the networks and the corresponding source cluster-heads send collected events to only one optimum query agent. To reduce the energy consumption and shorten the delivery delay, an efficient query processing algorithm inspired by the swarm intelligence of ants is proposed, which takes advantage of the beneficial clustering and routing emerging in a hybrid self-organized way from the positive interaction of ants. The experimental results demonstrated that the proposed algorithm can deliver collected events to the optimum query agents efficiently. Not only is the energy cost reduced but also the delivery delay is shortened significantly when transmitting the named events to the appropriate query agents.
1. Introduction
The technologies of wireless sensor networks (WSN) have been developed rapidly in the most recent years. Because WSN can cover large areas and extract localized features, the applications involved are from a wide variety of areas such as environment monitoring and security [1–3].
As WSNs are characterized by data-centric routing under most circumstances, any application involved requires data processing technologies, especially the query processing [4]. Because of the severe constraints on energy and computation that are characteristics of WSNs, the centralized querying approach is often infeasible for large-scale networks, and it is crucial to propose energy-efficient distributed in-network querying protocols while providing an acceptable quality of information [5]. A decentralized infrastructure for supporting querying in WSNs was introduced in [6], which utilizes sensor's spatial and semantic characteristics. The ACQUIRE mechanism in [7] provides superior query optimization for responding to particular kinds of queries. However, a one-size-fits-all approach is unlikely to provide efficient solutions for all types of queries [7]. In this paper, we focus on the solution for query processing with both the energy and the delay constraints in WSNs. To the best of our knowledge, when considering the multiple QoS constraints such as the query delay and the minimal energy required, the multiconstrained querying problem is NP-hard.
For a special application in WSNs, the event types are limited. When the events involved occur somewhere, the sensors nearby will collect the information and transmit it to the local cluster head. Each of the cluster-heads can identify the limited kinds of the events and transmit the event data to the queriers. Therefore, the process of issuing queries can be omitted, and the routing problem of how can the cluster-head find the optimum querier and deliver the events to it becomes the focused topic in this paper. To promote the query performances, the query model with multiagents is presented in this paper, in which certain number of nodes are selected as the query agents and once the named events are delivered to one of the agents, the query routing is then completed. As the query agents is selected randomly, the location of them is unknown beforehand; how to search the optimum query agent when collecting the interested events is a challenge.
A distributed multiple ant colonies any cast algorithm was proposed in [8]. Though aiming at finding replicated service, it is revelatory to search replicated query agents in WSNs.
In this paper, we propose a distributed hybrid ant algorithm based query processing algorithm with multiple agents (HAAQP), which intends to overcome the inefficiency of those previous querying algorithms by reducing the expected search cost and shortening the query delay.
The remainder of the paper is organized as follows. Section 2 describes the preliminaries and the problem formulation. The novel HAAQP algorithm is proposed in Section 3. In Section 4, the proposed algorithm is evaluated by simulations. Finally, Section 5 concludes the paper.
2. Preliminaries and Problem Formulation
2.1. Ant-Based Routing Model
Swarm intelligence is a relatively new approach to problem solving that takes inspiration from the social behaviors of insects. In particular, ants have inspired lots of methods and techniques among which the most successful is ant colony optimization (ACO). The large majority of the applications of ACO are to NP-hard problem. ACO was applied to routing in various networks [9, 10]. Several improved ant-based routing algorithms for WSNs were proposed in [11].
2.2. Ant-Based Clustering Model
A special kind of ants divides their eggs based on the size. An ant-based clustering algorithm was studied [12] inspired by such behavior. Ant-based clustering is characterized by a probabilistic approach, where clustering is repeatedly realized by ants, and stochastically selected eggs are picked up or dropped. By the combination of the two ant-based models, we propose a hybrid ant-based HAAQP algorithm to solve the multiconstrained querying problem for WSNs.
2.3. Network Model of WSN
As the WSNs considered in this paper are large-scale networks, the utilization of cluster can improve the scalability. A clustering protocol capable of providing uniformly distribution of cluster-heads was proposed in [13]. We adopt the similar approach for low-tier of the WSN. The cluster radius
To reduce the energy cost, only part of the sensors in each cluster stays alive. There are

The network environment of the proposed HAAQP algorithm.
In Figure 1, each cluster-head maintains several active sensors, and the sleeping sensors are omitted. The query agents
2.4. Generation and Aggregation of Events
For specific application in WSNs, suppose that the maximum number of event types and the event attributes are
The events are uniformly generated during the deployment period in WSN. To reduce the storage of sensors efficiently, the aggregation method is adopted according to the spatiotemporal attributes and sensing attributes of events [14].
When an event involved occurrs, any sensor obtaining all the attribute values can infer the event type by matching the event list inserted into the node in advance.
2.5. Problem Formulation
As the WSN is treated as a two-tier network, constrained query routing among the cluster-heads on the up-tier has become the focus to be considered. There are two constraints when delivering the events to the corresponding query agent. One is energy constraint
3. Hybrid Ant-Based Query Processing for WSNs
3.1. Management of Ants
Three kinds of ants are to be considered in HAAQP, namely, the forward ants (FAs), the backward ants (BAs) and the clustering ants (CAs). The FAs can be viewed as events to be transmitted. Once an event
Both the FAs and the BAs can update the pheromone. There are two kinds of pheromones in HAAQP, namely, the search pheromone τ and the clustering pheromone π. The BAs update both of the τ and π when they come back. Each cluster-head maintains a buffer of ants including the FAs and BAs. The ants that arrive to it are arrayed in the buffer ordered by the
3.2. Initiation of HAAQP
Suppose that the energy cost for querying is to be proportional to the number of transmissions. The query delay is the end-to-end delay between the source cluster-head and the optimum query agent. The initial values of the τ and π should be initiated beforehand. In the initial phase, each query agent
3.3. Path Construction Policy of HAAQP
When dealing with the initial or intermediate FAs, how to select the next hop of the cluster-head is important. Because the global information of the large-scale sensor network is unknown, only the local information of the neighbors can be used during the selection. As the ordinary sensors have been ignored on the up-tier of the network, the neighbors are sure to be the cluster-heads or query agents, which can improve the computational efficiency because the number of candidates to be selected is shrunk sharply. We first calculate the weight of the current
where
where

The path construction process of the proposed HAAQP algorithm.
3.4. Pheromone Update Rules of HAAQP
Two updating rules for search pheromone are introduced herein: the global updating and the local updating. Ants will intensify the pheromone of the link when moving forward each step, so that the ants sent from the same nest can tend to select the same path. Because each ant has different constraints according to different events, they perhaps select another path. Suppose that FA at
Note that
When an ant finds an eligible path, it intensifies the pheromone of the path and evaporates the pheromone of the involved links that are not in the path meanwhile. The global pheromone updating is defined as follows:
where p is the path from source cluster-head
In order to determine the membership of each cluster-head
where the
From (5), and (6), we can see that the search pheromone affects the clustering pheromone to some degree. If an optimum path to the query agent
3.5. Approaches of HAAQP Algorithm
The HAAQP algorithm for the WSNs is described as follows.
Step 1. Initialize the values of the search pheromone on each link on the up-tier when completing the two-tier structure of the WSN by existing clustering protocol. The values of the clustering pheromone on each cluster-head
Step 2. Each source cluster-head generates events with the query constraints of the
Step 3. In each buffer of the cluster-heads, the ant-manager deals with the intermediate FAs in order. When dealing with initial FAs, new intermediate FAs are generated and inserted into the buffer queue according to the
Step 4. Ant-manager goes on dealing with subsequent ants. They may be initial FAs, new intermediate FAs, or BAs, which is up to the
Step 5. Before dealing with ants of current cluster-head, whether the neighbors satisfying the constraints of the packets exist or not must be judged. If there is no such neighbor node, the ant dies; otherwise, we judge the type of ants and deal with them, respectively.
For the initial or intermediate FAs, the ants first determine whether the current cluster-head is a query agent or a neighbor of query agents. If yes, the events are accepted directly or through one hop. Meanwhile, the BAs are triggered to update the search pheromone on the corresponding paths. Otherwise, the ants select next hop according to the probability of each possible neighbor sensor and prevent loop. Ants update the local information on the selected link. When completing the FAs, the new FAs are generated. Judge whether the new FAs are satisfied with the constraints. If no, they will be discarded; otherwise, they are inserted into the queue according to their beginning time
For the BAs, they are adopted to output the paths by which events are delivered to the query agents and update the energy on the path and search pheromone on all the links.
For the CAs, they are launched to collect the value of the neighbors’ clustering pheromone in a fixed interval and determine the membership of the current cluster-head.
Step 6. If there are no ants to be processed, we count the total energy cost and the query delay in the simulation.
4. Simulations
We have simulated the HAAQP and evaluated the performance by comparing with the other query algorithms derived from [15–17], namely, the SARP-based query processing (SARPQP), the TBA-based query processing (TBAQP), and the ABS-based query processing (ABSQP). A topology generator is adopted to obtain various sensor networks. The number of sensor nodes N varies from 1000 to 6000, which is deployed in a square area with
The initial energy value of each sensor is 400 units. The values of

The average total energy cost of HAAQP and other algorithms.
Figure 3 shows the comparison of average total energy cost. It indicates that the ant-based HAAQP is more energy efficient than the other algorithms in most cases. The reason is that the ant-based search can provide more intelligence, especially for large-scale wireless sensor networks. The ABSQP algorithm is more energy efficient than both SARPQP and TBAQP for its heuristic design.
Figure 4 plots the curve of the energy cost of HAAQP with the values of the w and

The total energy cost of HAAQP with a different number of agents.

The average query delay of HAAQP and other algorithms.
Figure 5 shows the comparison of the average query delay. It indicates that the delay of HAAQP is smaller than that of other algorithms. This is because that the ant-based querying with positive feedback can find short enough paths under multiconstraints.
5. Conclusions
The multi-constrained query processing is one of the most challenging problems for resource-constrained WSNs with multiple query agents. Considering the constraints of the node energy and query delay of different applications, an ant-based query processing algorithm HAAQP with positive feedback is proposed for WSNs in this paper. The simulation results show that significant energy gains are achieved by HAAQP, as well as the query delay. Our future work is to optimize the parameters to achieve better performance.
Footnotes
Acknowledgments
This work is partly supported by the National Natural Science Foundation of China (Grant nos. 60903168, 60973129, 61379115, and 61100215), the Hunan Provincial Natural Science Foundation of China (Grant no. 12JJ6063), the Scientific Research Fund of Hunan Provincial Education Department of China (Grant no. 10B062), the Program for Excellent Talents in Hunan Normal University (Grant no. ET51102), the Foundation of Jiangsu High Technology Research Key Laboratory for Wireless Sensor Networks (Grant no. WSNLK201102), and the Foundation for Young Teachers in College of Mathematics and Computer Science of Hunan Normal University. The authors would like to thank the editor and the reviewers.
