1 Introduction

The development of the wireless sensor network (WSN) technology is instrumental in the emerging of Ineternet of Things (IoT) applications [1], ranging from smart cars to smart cities [2]. A WSN [3, 4] consists of many sensor nodes (or simply sensors) and few sink nodes (or simply sinks). Sensors are small, inexpensive, bettery-powered microelectromechanical system (MEMS) devices; they are deployed extensively in the region of interest (ROI) for sensing physical phenomena, such as temperature, humidity, illumination, and vibration, within their disk-shaped sensing areas. Sensors can process and transmit sensed data to sinks through multi-hop wireless communications. Sinks have more energy and are more powerful than sensors; they can send commnads to and gather data from sensors, and can also connect to the backend system, such as a mainframe or a Cloud system [5, 6], through wired or long-haul wireless communications (e.g., satallite links).

Numerous studies [723] investigate how to use WSNs to establish barrier coverage (or virtual barriers) for detecting intruders crossing a belt-shaped ROI, like a boundary, coastline, country border, and battlefield perimeter. Kumar el al. in [7] investigated how to construct barrier coverage of high detection degrees by deterministically deploying sensors. A WSN monitoring the ROI is said to form k-barrier coverage (or barrier coverage of the detection degree k) if any intruder crossing the ROI can be detected by at least k sensors. The authors in [7] also proposed an algorithm, called the global determination algorithm (GDA), to determine whether a WSN of randomly deployed sensors can form k-barrier coverage. For doing barrier coverage research, some papers (e.g., [7]) adopted the binary sensing model, which assumes a sensor can (resp., cannot) detect an intruder if the distance between the sensor and the intruder is smaller (resp., larger) than the sensor sensing range. On the contrary, some papers (e.g., [8]) adopted the probabilistic sensing model, which assumes the probability that a sensor can detect an inturder is no longer 1 or 0, but is a value between 0 and 1 depending on the distance between the sensor and the intruder. Papers [912] discussed how to construct barrier coverage or its variants (e.g., local barrier coverage) for WSNs of differenct deployment patters (e.g., line-based and curve-based deployment). Papers [1317] investigated how to form barrier coverage or find/mend barrier gap for different types of WSNs, such as those with directional sensors, camera sensors, and mobile sensors. Papers [1820] studied sleep-wakeup scheduling to maximize the lifetime of WSNs by using redundant senosrs. Paper [21] estimated the desired sensor density that achieves barrier coverage with s-t connectivity in a thin strip (i.e, the belt-shaped ROI) of finite length, where s-t connectivity stands for the existence of a connected route between the two far ends of the thin strip.

To the best of our knowledge, only one paper [22] addressed barrier coverage optimization under the consideration of network connectivity. Lai et al. [22] proposed an algorithm, called the Optimal Node Selction Algorithm (ONSA), to achieve sink-connected barrier coverage with the maximized detecton degree by activating the minimal number of sensors of a WSN containing randomly deployed sensors and sinks. ONSA selects the minimum number of sensors as detecting sensors to turn on their sensnig modules and communication modules to form barrier coverage with the maximized degree for detecting intruders (or intrusion events) and sending/forwarding intrusion notifications toward the sinks. Furthermore, ONSA selects the minimum number of extra sensors as forwarding sensors to turn on only their communication modules for forwrading intrusion notificaitons so that every detecting sesnor has a route to send intrusion notications to a sink. Fig. 1 shows a WSN of 8 detecting sensors, 3 forwarding sensors and 2 sinks to form sink-connected 2-barrier coverage for a rectangular ROI, where the sensor communication range is a little larger than the sesning range. ONSA is optimal in the sense that it activates the minimum number of sensors to form sink-connected barrier coverage with the maximimal detection degree. However, since ONSA aims at minimizing the number of detecitng sensors and the number of forwarding sensors, the detection quality and the transmisison quality of barrier coverage may not be good enough. This motivates us to find methods to optimize the detection quality and the transmission quality of barrier coverage.

Fig. 1
figure 1

An example of sink-connected 2-barrier coverage of a WSN

This paper tries to optimize barier coveage in terms of the detection quality and the transmission quality, in addition to the detection degree and number of sensors, under the consideration of sink-connectivity and heterogeneous sensing ranges. An algorithm, called the Optimal Barrier Coverage Algorithm (OBCA), is proposed to use the minimum number of sensors to jointly optimize the detection degree, detection quality, and transmission quality of barrier coverage of a WSN consisting of randomly deployed sensors and sinks under the probabilistic sensing model. To optimize the detection quality, OBCA tries to maximize the minimum detection probability of detecting an intruder. A formula is proposed for OBCA to find the minimum detection probability between two sensors with different sensing ranges. With the formula, OBCA can be applied to heterogeneous WSNs whose sensors have various sensing ranges. To optimize the transmission quality, OBCA tries to minimize the average latency for transmitting data to sinks. The Expected Transmission Time (ETT) [24] is used to estimate the transmission latency of each direct wireless communication link between two sensors or between a sensor and a sink. The transmission latency to send an intrusion notification from a detecting sensor to a sink over a multi-link routes thus can be estimated by summing ETT values of all links on the route. By ETT values, OBCA derives a route for each detecting sensor such that all the derived routes have the minimized ETT summation average per route. In summary, in addition to the barrier coveage degree, OBCA has the following considerations never addressed before. First, it considers heterogeneous sensing ranges under the probabilistic sensing model for measuing the detection quality. Second, it considers the ETT estimation for measuring the transmission quality of intrusion notifications. Third, it tries to optimize the detection degree, detection quality, and transmission quality at a time.

The rest of this paper is organized as follows. Section 2 describes some related work. The network model and problem formulation are shown in Section 3. The correctness proofs and time-complexity analyses of OBCA are given in Section 4. OBCA’s simulation results and comparisons with related algorithms, namley ONSA and GDA, are demonstrated in Section 5. Finally, Section 6 concludes the paper.

2 Related work

This section describes some relevant studies addressing barrier coverage problems. Kumar et al. in [7] applied the concept to WSNs and proposed a mechanism to deterministically deploy k-barrier coverage (or k virtual barriers) in WSNs consiting of the minimum number of sensors. They also suggested a global algorithm to make the decision about whether a WSN consisting of randomly deployed sensors can form k-barrier coverage or not, and proved that the decision can only be made globally but not locally. Yang et al. [8] proposed the concept of barrier information coverage to exploit collaborations and information fusion between neighboring sensors for reduceing the number of active sensors needed to cover a belt-shaped ROI. They proposed a solution to identify the barrier information coverage set to information-cover the ROI with a small number of active sensors. Chen et al. in [9, 10] introduced the notion of L-local barrier coverage guaranteeing the detection of intruders whose trajectory is confined to a narrow slice of length L. Therefore, it is possible for a sensor to locally decide whether L-local barrier coverage is achieved. Saipulla et al. in [11] studied the barrier coverage in WSNs of line-based sensor deployment in which sensors are distributed along a line with random offsets. They also derived a tight lower-bound for the existence of barrier coverage in WSNs of line-based deployed sensors. He el al. in [12] considered curve-based sensor deployment. They identified the characteristics for optimal curve-based deployment and proposed algorithms to achieve the optimal deployment.

Saipulla et al. [13, 14] observed that barrier gaps may appear in WSNs if sensors are randomly deployed and if some sensors fail or run out of energy. They proposed algorithms to find barrier gaps and relocate mobile sensors with limited mobility to mend the gaps improve barrier coverage. Chen et al. in [15] and Tao et al. in [16] discussed barrier gap finding and mending problem for WSNs consisting of directional sensors. Chen et al. proposed a gap-finding algorithm to find barrier gaps and proposed two gap-mending algorithms to mend the gaps by rotating sensors. Tai et al. proposed algorithms to find barrier gaps and to mend them with the minimal number of extra directional sensors. Deng et al. in [17] proposed barrier gap-mending algorithms for WSNs consisting of static and mobile sensors with adjustable sensing ranges to maximize network lifetime or to minimize the maximal energy consumption to move sensors.

Papers [1820] studied sleep-wakeup schedules used to maximize the lifetime of WSNs. Kumar et al. [18] proposed an optimal sleep-wakeup scheduling algorithm for k-barrier coverage. The basic concept is to derive sensors that form m-barrier coverage (m > > k) of a given WSN, and then divide the senosrs into disjoint m/k sets such such that sensors in every set are alternatively scheduled to be activated to form k-barrire coverage to prolong the network lifetime by an optimal factor of m/k. Luo et al. [19] proposed schemes to construct imperfect barrier coverage for prolonging the network lifetime achieved by the above-mentioned scheduling algorithm [18]. DeWitt et al. [20] addressed the sleep-wakeup scheduling problem for WSNs with energy harvesting sensors to prolong the network lifetime.

Some research discussed connectivity properties of barrier coverage. Balister et al. [21] estimated the desired sensor density that achieves barrier coverage with s-t connectivity in a thin strip of finite length, where s-t connectivity stands for the existence of a connected route between the two far ends of the thin strip. They developed a definition of break (a disruption in connectivity) to do the estimztion. Lai et al. in [22] proposed an algorithm, called the Optimal Node Selection Algorithm (ONSA), to construct barrier coverage with the maximized detection degree by activating the minimal number of sensors of a WSN consisting of randomly deployed sensors. Furthermore, the constructed barrier coverage has the sink connectivity property, which means that every sensor on virtual barriers has a route leading to a sink for sending intrusion notifications. Since ONSA is the algorithm most related to our work, we describe its details in the following paragraph.

The algorithm ONSA has two stages. The first stage is to construtc the barrier coverage of the maximum degree with the minimum number of sensors (i.e., detecting sensors). The second stage is to construct routes with the minimum number of sensors (i.e., forwarding sensors) per route for detecting sensors to send messages to sinks. In the first stage, ONSA constructs the coverage graph according to the sesning area relationship of sesnors. There are edges (or arcs) going from sensor node n i to sensor node n j and from n j to n i if the sensing areas of n i and n j overlap. The coverage graph has a virtual source node s and a virtual target node t. A sensor node whose sensing area covers either of the ROI width sides has an edge either incident from s or incident to t. It then performs node disjoint transformation on the graph. The transformation changes a node X with multiple inbound edges and multiple outbound edges into a pair of virtual nodes X’ and X” which have an edge going from X’ to X” associated with Capacity = 1 and Cost = 0. The edges incident to the target node are also associated with Capacity = 1 and Cost = 0, while all other edges are associated with Capacity = 1 and Cost = 1. ONSA then runs the minimum-cost maximum-flow algorithm to return the maximum flow passing through the minimum number of nodes, which corresponds to the maximum degree of barrier coverage constructed out of the minimum number of nodes. In the second stage, ONSA constructs the transmission graph according to the transmission relationship of nodes. There is an edge (or arc) going from node n i to node n j if n j can send messages to n i successfully. The coverage graph has a virtual source node s and a virtual target node t. Every detecting node has an edge (or arc) incident from s; and every sink node has an edge (or arc) incident to t. ONSA then performs the node-dege transformation on the graph. Except for the sink node, every node X is changed into a pair of virtual nodes X’ and X” which have an edge going from X’ to X” associated with Capacity = ∞ and Cost = 1. The edges incident from s are also associated with Capacity = 1 and Cost = 0, while all other edges are associated with Capacity = ∞ and Cost = 0. ONSA then runs the minimum-cost maximum-flow algorithm to return the flow plan which can be used to establish a route towards a sink node for every detecting node. The flow plan incurs the minimum cost, which implies the number of nodes per route (the hop counts per route) is minimized.

3 Network model and problem formulation

3.1 Network model

We consider a WSN consisting of many sensors and few sinks, where sensors can detect intruders and send intrusion notifications toward one of the sinks. The sensors and sinks are assumed to be randomly deployed and modeled as graph nodes or vertices. Below, we define the coverage graph CG and the transmission graph TG to represent the sensing area (or sensing coverage) overlap relationships and the tranmission relationships of nodes, respectively.

3.1.1 Coverage graph

A coverage graph CG = (N∪{u,v}, CE) is a directed graph, in which N is the sensor set (or node set), CE is the coverage edge set, and u and v are two virtual nodes. The edge set CE represents the sensing area coverage overlap relationships of sensors. For two nodes n i and n j in N, there exist edges (n i , n j ) and (n j , n i ) in CE if n i and n j have overlapping sensing coverage. Fig. 2 shows the covearge graph CG of a WSN deployed over a rectangular ROI. The graph CG has virtual nodes u and v associated with the width sides; an edge (n i , u) or (n i , v) exists in CE if n i ’s sensing area overlaps either width side, where 1 ≤ i ≤ 10.

Fig. 2
figure 2

A WSN coverage graph with 2 node-disjoint barrier paths

A barrier path of a coverage graph CG is defined to be a path starting from u, going along edges in E c through nodes in S, and stopping at v. Note that all nodes in a barrier path form a virtual barrier. A coverage graph is similar to a flow network [23] and a barrier path is similar to a flow in this network. In the flowing context, the terms “barrier path” and “flow” will be used exchangeably. The coverage graph and its barrier paths are very useful for measuring the degree of barrier coverage. By the theorems developed in [7], a WSN forms k-barrier coverage if and only if there exist k node-disjoint barrier paths in the coverage graph associated with the WSN. For example, the WSN in Fig. 2 forms 2-barrier coverage, since there are two node-disjoint barrier paths u-n 1-n 2-n 3-n 4-v and u-n 5-n 6-n 7-n 8-v in the associated coverage graph.

Below we present some definitions for measuring the detection quality of barrier coverage uder the probabilistic sensing model.

Definition 1: Detection probability

The detection probability of an intruder x sensed by a sensor s is defined as an exponential function P(d, r, α) shown in Eq. (1).

$$ P\left( d, r,\alpha \right)=\left\{\begin{array}{c}\hfill {e}^{-\alpha \cdot d},\kern2.25em d\le r\kern0.5em \hfill \\ {}\hfill 0,\kern3.75em d> r\hfill \end{array}\right. $$
(1)

where d is the distance between s and x, as illustrated in Fig. 3(a), and α, 2 ≤ α ≤ 5, is a sensibility parameter related to the physical characteristics of the sensing module of s, and r is the sensing range (i.e., the radius of the circular sensing area) of the sensing module.

Fig. 3
figure 3

Illustration of the detection probaiblity and the detection quality between sensors with various sensing ranges

The function in Eq. (1) can reasonably characterize some sensing modules of different sesning ranges, such as infrared and ultrasound devices [24]. For example, a senosr node with the sesning range of 10 m is assumed to have the detection probability of e -αd if the intruder is d × (10 m) away from the sensor, where α = 2 and d ≤ 1. If the intruder is 10 m away from the sensor, the detection probability is e -αd = 2.71828–2×1 = 0.13533. If the intruder is 5 m away from the senosr, the detection probability is e -αd = 2.71828–2×0.5 = 0.36787. However, if the intruder is more than 10 m away from the senosr, the detection probability is assumed to be 0. On the contrary, a senosr node with the sesning range of 8 m is assumed to have detection probability of e -αd if the intruder is d × (10 m) away from the sensor, where α = 2.5 and d ≤ 0.8. For example, if the intruder is 8 m away from the sensor, the detection probability is e -αd = 2.71828–2.5×0.8 = 0.13533. If the intruder is 5 m away from the senosr, the detection probability is e -αd = 2.71828–2.5×0.5 = 0.28650. Similarly, if the intruder is more than 8 m away from the senosr, the detection probability is assumed to be 0.

Definition 2: Detection quality of edges

For the edge (n i , n j ) between sensors n i and n j whose sensing areas overlap, we define the detection quality Q(n i , n j , r i , r j i , α j ) (or Q(n i , n j ) for short) of the edge (n i , n j ) to be the minimum detection probability that an intruder can be detected by either n i or n j , where r i and r j are senseing ranges of n i and n j , and α i and α j are sensibility of n i and n j .

Let x be the point on the edge (line) between n i and n j that has the minimum detection probability. We can infer that P(d, r i , α i ) = P(l-d, r j , α j ), where l is the length of the line segment \( \overset{-}{n_i{n}_j} \). As shown in Fig. 3(b), we have α i d = α j ⋅(l-d), which in turn implies the following equation:

$$ d=\frac{\alpha_j}{\alpha_i+{\alpha}_j}\ l $$
(2)

Definition 3: Detection quality of edge sets

The detection quality DQ of a given edge set E is defined as the minimum detection quality of all edges in E, as showin in Eq. (3).

$$ DQ(E)={MIN}_{\left({n}_i,{n}_j\right)\in E} Q\left({n}_i,{n}_j\right) $$
(3)

3.1.2 Transmission graph

A transmission graph TG = (NM, TE) is a directed graph, where N is the sensor node set, M is the sink node set, and TE is the transmission edge set to represent transmission relationships between nodes. For two nodes n i and n j in NM, an edge (n i , n j ) exists in TE if node n i can successfully transmit data to node n j over a direct wireless communication link. Based on the transmission graph TG of a WSN, we define the sink-connectivity and the expected transmision time as follows.

Definition 4: Sink-connectivity

For a WSN associated with the transmission graph TG = (NM, TE), a set Z (Z ⊆ N) of sensor nodes is sink-connected if every sesnor node in Z has a route that starts from the node, passes only nodes in Z, and reaches a sink node in M. For the WSN in Fig. 4, the node set {n 4, n 7, n 8, n 13} satisfies the sink-connected property, but the node set {n 7, n 8} does not satisfy this property.

Fig. 4
figure 4

The partial transmission graph with edges associated with ETT values for a WSN with sensors n 1,.., n 14 and sinks k 1 and k 2

Definition 5: Expected transmission time

We use the concept of the expected transmission time (ETT) proposed in [25] to evaluate the expected time for transmitting a data packet over a direct wireless communication link or an edge in TG. The expected transmission time ETT e of an edge e is calculated on the basis of the forward transmission ratio and the reverse transmission ratio of the link. For an edge e = (n i , n j ) from node n i to node n j , the forward transmission ratio FTR(n i , n j ) is the measured probability that a data packet sent by n i is successfully received by n j . On the other hand, the reverse transmission ratio RTR(n j , n i ) is the measured probability that an acknowledge packet sent by n j is successfully received by n i . Note that we assume sensors’ transmission modules are always on or some mechanisms are used to turn on the transmission modules when packets are ready to be transmitted.

For simplicity, we assume the forward packet (e.g., an intrusion notification message) and the reverse packet (e.g., an acknowledgement message) have the same length L. Similarly, we assume the forward packet and the reverse packet have the same data transmission rate B. The expected transmission time ETT e (n i , n j ) of an edge e = (n i , n j ) for node n i to successfully transmit a forward packet to node n j and to receive the packet acknowledgement is formulated in Eq. (4).

$$ {ETT}_e\left({n}_i,{n}_j\right)=\frac{1}{FTR\left({n}_i,{n}_j\right)\times RTR\left({n}_j,\kern0.75em {n}_i\right)}\times \frac{L}{\ B} $$
(4)

Based on Eq. (4), the total expected transmission time ETT r (R) for transmitting a data packet through a route R containing many edges is formulated according to Eq. (5).

$$ {ETT}_r(R)={\sum}_{\left({n}_i,{n}_j\right)\in R}{ETT}_e\left({n}_i,{n}_j\right) $$
(5)

Definition 6: Route set

For a WSN with the transmission graph TG = (NM, TE), a route set RS associated with sensor sets X and Y (X, Y ⊆ N) is defined to be a minimal set of routes such that every sensor in X has exactly a route leading to a sink in M going through only sensors in (XY).

Under the assumption that all sensors in X have the same probability to send equal-sized packets to sinks, the average expected transmission time ETT(RS) of the route set RS is formulated according to Eq. (6).

$$ ETT\left( R S\right)={AVG}_{R\in RS}{ETT}_r(R) $$
(6)

3.2 Barrier coverage optimization problem

This paper is to solve the (k,q,t)-barrier coverage optimization problem defined below. Given a WSN with the coverage graph CG and the transmission graph TG, the (k,q,t)-barrier coverage optimization problem is to find a detecting (sensor) set DS, a forwarding (sensor) set FS, and a route set RS associated with DS and FS for achieving the following two goals:

  • G1: DS is the set having the maximum number k of node-disjoint barrier paths in CG with the maximized detection quality q.

  • G2: RS is the set having the minimized average expected transmission time t, where t = ETT(RS) in TG.

4 The proposed algorithm

4.1 Algorithm design

In this subsection, we describe the proposed algorithm, OBCA. Given the sensor node set N, sink node set M, sensing coverage relationship edge set CE, and transmission relationship edge set TE, OBCA can derive a detecting set DS, a forwarding set FS, and a route set RS associated with DS and FS to achieve the two goals G1 and G2 of the (k,q,t)-barrier coverage optimization problem.

OBCA is cloasely related to the maximum-flow algorithm (MFAlg) and the minimum-cost maximum-flow algorithm (MCMFAlg) for flow networks. A flow network is a directed graph where each edge has a capacity to receive a flow such that the amount of the flow cannot exceed the capacity. The graph has two special nodes, the source node u and target node v. The max-flow problem is to find a flow plan (FP) with the maximum flows going from u to v, where an FP is a function assigning the amout of flow on every edge under the capacity restriction. The Edmonds-Karp algorithm [23], which can be integreated into OBCA, is a famous algorithm to solve the max-flow problem. Futhermore, for a flow network where each edge has a capacity and a cost per unit of the flow going through the edge, the min-cost max-flow problem is to find an FP with the maximum flow going from u to v with the minimum cost. The Orlin-Ahuja algorithm [26], which can also be integrated into OBCA, is a famous algorithm to slove the min-csot max-flow problem. Fig. 5 shows the overview flowchart of OBCA, and Fig. 6 shows the detailed pseudo code of OBCA.

Fig. 5
figure 5

The flowchart of OBCA

Fig. 6
figure 6

The pseudo code of OBCA

The details of the OBCA pseudo code are described below:

  • N, M, CE, TE are the input of OBCA. They are the sensor node set, the sink node set, the coverage edge set to represent the sensing area coverage overlap relationships of sensors, and the transmission edge set to represent transmission relationships between nodes, respectively.

  • k, q, t, DS, FS, RS are the ouput of OBCA. They are the optimized degree, optimized detection quality, optimized transmission quality, detecting node set, forwarding node set and route set of barrier coverage.

  • The first task of OBCA is to construct the coverage graph CG = (N∪{u,v}, CE) according to N, M, and CE (line 1). Note that two virtual nodes u and v are added into the graph, and all edges adjacent to u and v are associated with Capacity = 1 and Cost = 0, and all all other edges in CE are associated with Capacity = 1 and Cost = detection quality formulated in Eq. (2).

  • OBCA then performs the node-disjoint transformation on CG to generate the transformed coverage graph CG* (line 2). As shown in Fig. 7, the node-disjoint transformation changes a node x with multiple inbound flows and multiple outbound flows into a pair of virtual nodes x’ and x” which has an edge going from x’ to x” associated with Capacity = 1 and Cost = 0. The purpose of the transformation is to guarantee that the flows in the FP generated later are node-disjoint. Since there is only one edge with Capacity = 1 between x’ and x” in the transformed CG*, there is only one flow going through x in the original CG. Fig. 8 shows The example of the node-disjoint transformation on the coverage graph of Fig. 2.

  • OBCA performs a max-flow algorithm (e.g., the Edmonds-Karp algorithm [23]) on CG* to find an FP for coerage FPC with the maximum number k of flows. Since every flow goes from the virtual node u to the vitural node v through differrent intermediate nodes, so flows are equivanlent to disjoint barrier paths and k is equivalent to the coverage degree. The node set DS and the maximum detection quality q asscociated with FPC are also derived (line 3).

  • In the repeat-until loop (lines 4–11), OBCA tries to increase the detection quality q without decreasing the dtection degree k. This is achieved by removing all the edges having the detection quality smaller than or equal to q (line 5), and then re-running the max-flow algorithm to dereive new flow plan FPC’ (line 6). If the new flow plan has the same detection degree as k (line 7), then the new flow plan FPC’ has better detection quality than FPC but has the same detection degree as FPC, and thus FPC is replaced by FPC’ and all associated variables are updated accordingly (line 8). In such a case, the variable LoopStop is set as false (line 8); otherwise it is set as true (line 10) to stop the loop. Note that the loop continues until LoopStop is true (line 11).

  • After the best detection degree k and the best detection quality q is derived, OBCA tries to find the best transmission quality t. It first constructs the transmission graph TG = (NM, TE), where each edge in TE is associated with Capacity = ∞ and Cost = ETT value formulated in Eq. (4) (line 12).

  • Afterwards, OBCA performs the transmisison graph to flow network transformation (i.e., TG-FN-Transform) to transform the transmission graph TG into a flow network TG* by adding a virtual source node u and a virtual target node v, and by adding an edge from node u to every node in DS with Capacity = 1 and Cost = 0, and adding an edge from every sink node in M to node v with Capacity = ∞ and Cost = 0 (line 13). Fig. 9 shows the example of the transmisison graph to flow network transformation on the transmission graph of Fig. 4.

  • OBCA performs a min-cost max-flow algorithm (e.g., the Orlin-Ahuja algorithm [26]) on TG* to decide the minimum cost flow plan for transmission FPT (line 14).

  • OBCA sets the transmission (node) set associated with FPT as TS, sets the route set associated with FPT as RS, and sets the smallest average transmission time t as the ratio of the total cost associated with FPT over |RS|, the cardinatity of RS (line 15). Note that a node in DS has exactly a route going from the node to a sink node through only nodes in DSFS due to the setting of the edge capacity.

  • OBCA returns the largest detection degree k, the highest detection quality q, the highest transmission quality t, the detecting set DS of sensors, the forwarding set FS of sensors, and the route set RS of routes having the minimized average expected transmission time t (line 16).

Fig. 7
figure 7

Illustration of the node-disjoint transformation

Fig. 8
figure 8

The example of the node-disjoint transformation on the coverage graph of Fig. 2

Fig. 9
figure 9

The example of the transmisison graph to flow network transformation on the transmission graph of Fig. 4

4.2 Correctness proofs

In this subsection, we prove the OBCA algorithm can return a detecting set DS, a forwarding set FS, and a route set RS for achieving the two goals of the the (k,q,t)-barrier coverage optimization problem.

Theorem 1

Let CG be a coverage graph, CG* be the graph transformed from CG by the node-disjoint transformation, and FPC be the max-flow FP on CG* derived by OBCA. The detecting set DS associated with FPC forms the barrier covergae of the maximum detection degree and the maximum detection quality in CG.

Proof:

The barrier paths associated with FPC are node-disjoint in CG, as each node on CG with multiple inbound edges and multiple outbound edges is converted into two virtual nodes in CG* between which exists only one virtual link of capacity 1. The number of barrier paths is maximum, as the paths are derived from FPC, which is a max-flow FP. The edges in the barrier paths have the highest detection quality, as OBCA repeatly removes every edge of the quality less than q, which is the detection quality of the first max-flow FP, and then repeatedly derive new max-flow FPs with the number of flows being k, which is the number of flows of the first derived max-flow FP.

Theorem 2

Let TG be a transmission graph with the sink node set M, TG* be the graph transformed from TG by the transmission graph to flow network transformation, FPT be the max-flow FP on TG* derived by OBCA, and DS, FS and RS be the detecting set, the forwarding set, and route set returned by OBCA, repectively. RS has a route going from a node in DS towards a sink in M through only nodes in FS, and the average tranmssion time of routes in RS is minimum.

Proof:

In the transmission graph to flow network transformation, an edge with Capacity = 1 and Cost = 0 is added to connect the virtual source node u to every node in DS, and an edge with Capacity = ∞ and Cost = 0 is added to connect a sink node in M to the virtual target node v, and all other edges are with Capacity = ∞ and Cost = ETT value formulated in Eq. (4). RS has a route going from a node in DS towards a sink in M through only nodes in FS, as RS is associated with FPT, the min-cost max-flow FP with the number of flows being |RS|, the number of routes in RS. The total cost C of FPT is minimum; thus C/|RS| is minimum, implying the average tranmssion time of routes in RS is minimum.

4.3 Time complexity analysis

In this subsection, we analyze the time complexity of OBCA. Note that we below use X to represent the set X and its cardinality (i.e., |X|). The time complexity of OBCA is dominated by the repeat-until loop (lines 4–11) calling MFAlg (line 6) and the call of MCMFAlg (line 14). The loop has at most CE iterations, as OBCA eliminates one edge from CE at every iteration, where CE is the edge set of the flow network CG transformed from the coverage graph CG. MFAlg can be implemented by the Edmonds-Karp algorithm [23], which is of O(VE 2) time complexity for vertex set (or node set) V and edge set E. Thus, the loop is with the time complexity O(V c E c 3), where V c and E c are the node set and the edge set of the flow network CG*. MCMFAlg can be relaized by combining the Edmonds-Karp algorithm [23], which is of O(VE 2) time complexity, and the min-cost flow Orlin-Ahuja algorithm [26], which is of O(E ⋅ log V ⋅ (E + V ⋅ log V)) for a graph of vertex set V and edge set E. The time complexity of OBCA is thus O(V c E c 3 + E t ⋅ log V t ⋅ (E t  + V t ⋅ log V t )), where V c (resp., V t ) is the vertex set in CG* (resp., TG*) and E c (resp., E t ) is the edge set in CG* (resp., TG*) and TG* is the flow network transformed from the transmission graph TG.

5 Simulations and experimental results

We conduct simulation experiments for the proposed OBCA algorithm, and compare the simulation results with those of the Global Determincation Algorithm (GDA) [7] and the Optimal Nodes Selection Algorithm (ONSA) [22]. The algorithm GDA uses the maximum-flow algorithm to determine the highest degree of barrier coverage for a WSN with randomly deployed senosr nodes. The algorithm ONSA is an optimization algorithm with the goal to maximize the degree of barrier coverage with the minimum number of detecting nodes, and to make the detecting nodes sink-connected with the minimum number of forwarding nodes. We use C# language to incorparate the Google or-tool [28], which has the minimum-cost maximum-flow function call, to develop a simulator for evaulating the performance of OBCA, ONSA and GDA. In the simulations, 100, 150, or 200 sensor nodes are assumed to be deployed in a 150 m × 12 m rectangle-shaped ROI. Two sink nodes are assumed to be located at (50 m, 6 m), and (100 m, 6 m), respectively, which correspond to the midle position in the vertical direciton and to the left, and right positions in the horizontal direciton of the rectangular ROI. Senosr nodes are heterogeneous. Their sensing ranges are arbitrarily set as 8 m or 10 m. All sensors, either sensors or sinks, are assumed to be equipped with the IEEE 802.15.4 unslotted CSMA/CA network interface. The states of nodes and links are assumed to be fixed during the simulation duration. The transmitting power and receiving power of the radio module are set according to the off-the-shelf transceiver, Texas Instruments CC2420 [27], which is compliant with IEEE 802.15.4. Since a receiver in IEEE 802.15.4 has to acknowledge the receipt of a packet, we consider homogeneous transmission ranges for the sake of simplicity. Heterogeneous transmission ranges can be adopted. However, the packet acknowledgement should be omitted or the transmission graph should be constructed according to the smallest transmission range between senosrs. Please refer to Table 1 for all simulation parameter settings.

Table 1 Simulation settings

Fig. 10 shows the barrier coverage degrees returned by OBCA, ONSA and GDA. They are the same for the three algorithms, so only one bar is dipicted in Fig. 10. Fig. 11 shows the comparisons of OBCA, ONSA and GDA in terms of the detection quality. By Fig. 11 we can observe that OBCA has the highest average detection quality, and ONSA and GDA have similar average detection quality. This is because OBCA optimizes the detection quality by removing the edges with the quality lower than the best ever found quality to re-run the max-flow algorithm while retaining the same detection dgree. ONSA executes the minimun-cost maximum-flow algorithm for obtaining the maximum detection degree with the minimum number of nodes. GDA executes the maximum-flow algorithm only once for obtaining the maximum detection degree. Both ONSA and GDA do not consider the detection quality. Fig. 12 shows the comparisons of OBCA, ONSA and GDA in terms of the number of detecting nodes involed in constructing the barrier coverage. Since ONSA tries to minimize the number of detecting nodes, it has the minimum number of nodes in the barrier coverage. GDA arbitraly uses senosr nodes to obtain the maximum detection degree, it has slightly more detecting nodes than ONSA. OBCA aims at maximizing the detection quality, and it thus uses the maximum number of detection nodes in constructing the barrier coverage.

Fig. 10
figure 10

The barrier coverage degrees of GDA, ONSA and OBCA

Fig. 11
figure 11

Comparisons of GDA, ONSA and OBCA in terms of the detection quality

Fig. 12
figure 12

Comparisons of OBCA, ONSA and GDA in terms of the average number of nodes

Fig. 13 shows the comparisons of OBCA and ONSA in terms of the transmission quality, i.e., the average ETT value. We do not compare GDA, since it does not consideration intrusion notification transmssion. By Fig. 13 we can observe that OBCA has shoter ETT than ONSA. This is because OBCA executes the min-cost max-flow algorithm with the cost being the ETT, but ONSA executes the min-cost max-flow algorithm with the cost being 1 for passing one node. That is to say, OBCA tries to minimize the ETT value, while ONSA tries to minimize the number of nodes per route for forwarding intrudion notificaiton towards the sink. Thus, OBCA is better than the ONSA in terms of the average ETT.

Fig. 13
figure 13

Comparisons of OBCA and ONSA in terms of the average ETT

Fig. 14 shows the comparisons of OBCA and ONSA in terms of the energy consumption per intrusion event. The comparisons only consider the energy consumed when sensor nodes are sending/receiving/forwarding packets at the appearance of an intrusion event. By Fig. 14 we can observe that OBCA has lower total energy consumption than ONSA. This is because the ETT of OBCA is smaller than of ONSA, and the successful probability of trnasmitting packets of OBCA is thus higher. Therefore, OBCA sends fewer packets than ONSA. Although OBCA involves more senosr nodes than ONSA, OBCA outperforms ONSA in terms of the energy consumption.

Fig. 14
figure 14

Comparisons of OBCA and ONSA in terms of the energy consumption per intrusion event

6 Conclusions

In this paper, we formulate the (k, q, t)-barrier coverage optimization problem considering how to construct barrier coverage in WSNs for (1) maximizing the detection degree k of the barrier coverage, (2) maximizing the detection quality q of detecting intruders crossing the ROI, and (3) minimizing the expected transmission time t for sensors to send sensed data to sinks. An algorithm, called optimal barrier coverage algorithm (OBCA), is proposed to solve the problem on the basis of the max-flow algorithm and the min-cost max-flow algorithm running for flow networks with the polynomial time complexity. The algorithm is formally proved to solve the problem correctly.

We also propose a model to formulate the minimum detection probability between two WSN sensors with different sensing ranges. With the model, OBCA can be applied to heterogeneous WSNs whose sensors have various sensing ranges. We simulate OBCA and compare the simulation results with those of related algorithms, namely ONSA and GDA. The comparisions show that OBCA outperforms ONSA and GDA in terms of the detection quality, expected transmission time, and energy consumption for sending/forwarding notifications per intrusion event. OBCA needs more than ONSA and GDA. This is not problematic since some sensors, such as PIR sensors [29], just incur very low energy consumption.