Wireless Communications and Mobile Computing

Volume 2018, Article ID 3830285, 12 pages

https://doi.org/10.1155/2018/3830285

## Speeding Up Exact Algorithms for Maximizing Lifetime of WSNs Using Multiple Cores

^{1}College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 211106, China^{2}State Key Laboratory for Novel Software Technology, Nanjing University, Nanjing 210023, China^{3}Collaborative Innovation Center of Novel Software Technology and Industrialization, Nanjing 210023, China

Correspondence should be addressed to Xiaojun Zhu; nc.ude.aaun@uhzx

Received 30 January 2018; Revised 18 April 2018; Accepted 8 May 2018; Published 5 June 2018

Academic Editor: Hongyi Wu

Copyright © 2018 Pengyuan Cao and Xiaojun Zhu. 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

Maximizing the lifetime of wireless sensor networks is NP-hard, and existing exact algorithms run in exponential time. These algorithms implicitly use only one CPU core. In this work, we propose to use multiple CPU cores to speed up the computation. The key is to decompose the problem into independent subproblems and then solve them on different cores simultaneously. We propose three decomposition approaches. Two of them are based on the notion that a tree does not contain cycles, and the third is based on the notion that, in any tree, a node has at most one parent. Simulations on an 8-core desktop computer show that our approach can speed up existing algorithms significantly.

#### 1. Introduction

In wireless sensor networks, each sensor node has only a limited amount of energy. When a node sends or receives messages, it consumes the corresponding amount of energy. Thus, the amount of traffic of a node influences how long the node can work, which in turn determines the lifetime of the network. To this end, finding a routing tree to get longer lifetime is a key issue, which is known to be NP-hard [1]. Recall that algorithms that can guarantee finding the optimal routing tree are called* exact algorithms*. It is clear that, unless P=NP, all exact algorithms for the lifetime maximization problem are not polynomial time algorithms.

In fact, all existing exact algorithms run in exponential time [1–3]. A straightforward approach is to perform exhaustive search over the solution space (e.g., [2]). This process can be improved by dynamically eliminating suboptimal solutions in the search process [1], or integrating fast integer linear programming solvers [3]. However, these algorithms implicitly use only one CPU core and do not use the full potential of current multicore CPUs. Indeed, most computers, even smartphones, are equipped with multiple cores.

In this work, instead of designing a new algorithm, we consider speeding up existing exact algorithms by using multicore CPUs to their full potential. The basic idea is to decompose the problem into independent subproblems and then solve them on different cores using existing exact algorithms. The challenge is how to decompose the problem. We propose three decomposition methods for different exact algorithms. The first is based on the fact that a tree does not contain (undirected) cycles, so we can break the network into subnetworks whenever we encounter an undirected cycle. This approach applies to all algorithms that consider the network as either an undirected graph or a directed graph. The second is based on directed cycle, and the network is divided whenever we find a directed cycle. The third is based on the fact that every node has only one parent node, so the network is divided according to different parent choices of a given node. The second and the third approaches apply to algorithms that consider the network as a directed graph.

Our contributions can be enumerated as follows:(1)We consider using the multicore of current computers to speed up existing algorithms. The proposed approaches are applicable to all exact algorithms based on one CPU core.(2)We propose three problem decomposition approaches. These approaches can decompose the problem into subproblems, which can be solved on different cores using any exact algorithm. We also propose a mechanism to expose information of solved subproblems to help solve other subproblems.(3)We implement our approach on an 8-core desktop computer and perform numerical simulations. The results suggest that, in general, the proposed approaches can reduce the empirical time of existing exact algorithms, especially when the problem size is large.

The rest of the paper is organized as follows. Section 2 reviews related work. Section 3 reviews the definition of the problem and proposes a solution framework. Section 4 proposes three decomposition approaches. Section 5 discusses several problems. Section 6 presents numerical simulation results. Finally, Section 7 concludes the paper.

#### 2. Related Works

Finding routing paths of messages to maximize lifetime is a critical problem in wireless sensor networks (e.g., [1–3, 5–7]). Unfortunately, it is NP-hard in most scenarios when nodes can or cannot perform data aggregation. Researchers resort to polynomial-time approximation algorithms by sacrificing accuracy (e.g., [8]), or exponential-time exact algorithms by sacrificing running time (e.g., [1, 3]). While both algorithms have important applications, we focus on exact algorithms in this paper.

A simple method is to enumerate all spanning trees [2], which has a very poor running time. To improve the efficiency, [1] decomposes the underlying network graph into biconnected subgraphs to reduce problem size. A limitation is that the technique does not work when the graph is already biconnected. Reference [3] proposes to incorporate graph decomposition with integer linear programming. The basic idea is to decompose the graph into biconnected subgraphs and formulate the problem on each subgraph as an integer linear programming problem, which is solved by an integer linear programming solver. Besides routing, energy efficiency is also considered in other contexts such as compressive sensing-based encryption [9] and rechargeable sensor networks [10].

Contrary to these works, our work in this paper focuses on how to use the multiple cores in current computers to their full potential. The proposed approaches can be incorporated with existing exact algorithms. Though the idea of using multicores in wireless sensor networks is not new, existing works do not focus on our problem. For example, [11] uses the cores within a GPU to speed up lifetime simulation for sensor nodes, and [12] designs multicore sensor node hardware.

#### 3. A Framework to Use Multicores

We first review the problem and then introduce the solution framework. A sensor network contains sensors nodes , and a sink node . Each sensor node senses the environment periodically, generating a data packet in each period. It needs to send the data packet to the sink node. The network can be represented as an undirected graph , where is the set of nodes and is the set of communication links. Sensor node has initial energy and the sink node has infinite initial energy; i.e., . The energy consumed for receiving a message is and that for transmitting a message is . For any tree rooted at the sink, in each time period, the energy consumed by node is , where is the number of descendants of node in tree . The lifetime of node in tree is the number of rounds it can support until it runs out of energy: The lifetime of tree is the smallest node lifetime; i.e., Lifetime maximization problem is to find a tree that has the maximum lifetime. It has been proven to be NP-hard [1].

In this work, we assume that an operating system does not perform automatic multicore optimization; i.e., a single thread program can use at most one CPU core. To this end, we perform a simple experiment as follows. We run a dead loop program on two computers, one of which has 4 cores and the other has 8 cores. Both computers are equipped with the Windows operating system. The CPU utilization ratio is roughly 25% on the 4-core computer and is about 13% on the 8-core computer, which is consistent with our assumption. Note that if there are multiple threads, then the operating system will distribute the threads on different cores automatically.

##### 3.1. Problem Decomposition Overview

We refer to the set of feasible solutions of a lifetime maximization problem as its solution space, i.e., the set of directed trees pointing to the sink. A subproblem is a lifetime maximization problem with smaller solution space. The basic idea is to find a set of subproblems whose solution space contains at least one optimal solution. A decomposition method is* feasible* if three conditions are satisfied.(i)Each subproblem is feasible; i.e., each subproblem contains at least one feasible solution.(ii)At least two subproblems are returned, unless the original problem has only one feasible solution; i.e., the original network graph is itself a tree.(iii)The union of the solution spaces of all subproblems contains at least one optimal solution to the original problem.

Figure 1 illustrates the basic idea. Given a problem, we apply a feasible decomposition method to get a set of subproblems. Then we solve these subproblems concurrently, compare the optimal solutions to subproblems, and select the best one, which is the optimal solution to the original problem.