**8. The basic algorithm**

10 Will-be-set-by-IN-TECH

• *lt*(*C*) = *mins*∈*Cb*(*s*), the maximum lifetime of a cover. The bottleneck sensor of the cover

An optimal lifetime schedule of length 6 for this network is ({*s*1,*s*6}, 1), ({*s*1,*s*7}, 1), ({*s*1,*s*8}, 1), ({*s*2,*s*3}, 1), ({*s*2,*s*4}, 1), ({*s*2,*s*5}, 1)) where each tuple is a cover for the entire

Let the local lifetime dependency graph be *G* = (*V*, *E*) where nodes in *V* denote the local covers and edges in *E* exist between those pairs of nodes whose corresponding covers share one or more common sensors. For simplicity of reference, we will not distinguish between a cover *C* and the node representing it, and an edge *e* between two intersecting covers *C* and

one- or two-hop neighbors and the corresponding targets. Figure 2 shows the local lifetime dependency graph of sensor *s*<sup>1</sup> in the example network of Figure 1, considering its one-hop

• *w*(*e*) = *mins*∈*eb*(*s*), the weight of an edge *e* (if *e* does not exist, i.e., if *e* is empty, then *w*(*e*)

In Figure 2, the two local covers {*s*2,*s*3} and {*s*2,*s*4} for the targets of sensor *s*<sup>1</sup> have *s*<sup>2</sup> in common, therefore the edge between the two covers is {*s*2} and *w*({*s*2}) = 3. Therefore,*s*2's battery of 3 is an upper bound on the lifetime of the two covers collectively. It just so happens that the individual lifetimes of these covers are each 1 due to their bottleneck sensors and, therefore, a tighter upper bound on their total life is 2. In general, given two covers *C* and *C*�

. Each sensor constructs its local LD graph considering its

,

), *w*(*C C*�

)).

{*s*2,*s*3} is *s*<sup>3</sup> with the weakest battery of 1. Therefore, *lt*({*s*2,*s*3}) = 1.

{*s*1}, {*s*3}, {*s*4} and {*s*5}.

network followed by its duration.

*C*� and the intersection set *C C*�

is zero).

neighbors *N*(*s*1, 1) and its targets *T*(*s*1).

In the LD graph, we will use the following two definitions:

• *<sup>d</sup>*(*C*) = <sup>∑</sup>*e*∈*E and incident to C <sup>w</sup>*(*e*), the degree of a cover *<sup>C</sup>*.

**Figure 2.** The local lifetime dependency graph of sensor *s*<sup>1</sup>

a tight upper bound on the life of two covers is *min*(*lt*(*C*) + *lt*(*C*�

**7. Lifetime dependency (LD) graph**

which need to be avoided. Likewise, the possible covers for the only target of sensor *s*<sup>3</sup> are

For the purpose of this explanation, without loss of generality, let us assume that the covers are constructed over one-hop neighbors. The algorithm consists of two phases. During the initial setup phase, each sensor calculates and prioritizes the covers. Then, for each reshuffle round of predetermined duration, each sensor decides its on/off status at the beginning, and then those chosen remain on for the rest of the duration.

**Initial setup**: Each sensor *s* communicates with each of its neighbor *s*� ∈ *N*(*s*, 1) exchanging mutual locations, battery levels *b*(*s*) and *b*(*s*� ), and the targets covered *T*(*s*) and *T*(*s*� ). Then it finds all the local covers using the sensors in *N*(*s*, 1) for the target set being considered. The latter can be solely *T*(*s*) or could also include *T*(*s*� ) for all *s*� ∈ *N*(*s*, 1). It then constructs the local LD graph *G* = (*V*, *E*) over those covers, and calculates the degree *d*(*C*) of each cover *C* ∈ *V* in the graph *G*.

The "priority function" of a cover is based on its degree (lower the better). Ties among covers with same degree are broken first by preferring (i) those with longer lifetimes, then (ii) those which have fewer remaining sensors to be turned on, and finally (iii) by choosing the cover containing the smaller sensor id. A cover which has a sensor turned off becomes infeasible and falls out of contention. Also, a cover whose lifetime falls below the duration of a round is taken out of contention, unless it is the only cover remaining.

**Figure 3.** The state transitions to decide the On-Off Status

**Reshuffle rounds**: The automaton in Figure 3 captures the algorithm for this phase. A sensor *s* starts with its highest priority cover *C* as its most desirable configuration for its neighborhood. If successful, the end result would be switching on all the sensors in *C*, while others can sleep. Else, it transitions to the next best priority cover *C*� , *C*��, etc., until a cover gets satisfied. The transitions are as follows.





The transitions from *C*� are analogous to that from *C*, with the possibility of even going back to *C*.

**Correctness:** We sketch a proof here that this algorithm ensures that, in each reshuffle round, all the targets are covered and the algorithm itself terminates enabling each sensor to decide and reach on/off status.

For contradiction, let us assume that in a given round a target *t* remains uncovered. This implies that either this target has no neighboring sensor within sensing range and thus network itself is dead, or else all the neighboring sensors which could have covered *t* have turned off. In the latter case, each of the sensor *s* whose *T*(*s*) contains t has made the transition from its current best cover *C* to off status. However, *s* only does that if *C* covers all its targets in *T*(*s*) and *s* ∈/ *C*. The last such sensor *s* to have turned off ensures that *C* is satisfied, which implies that all targets in *T*(*s*) including *t* are covered, a contradiction. Next, for contradiction, let us assume that the algorithm does not terminate. This implies that there exists at least one sensor *s* which is unable to decide, i.e., make a transition to either on or off status. There are three possibilities: (i) all the covers of *s* have become infeasible, or

(ii) *s* is continually transitioning to the next best cover and none of them are getting satisfied, or

(iii) *s* is stuck at a cover *C*.

For case (i), for each cover *C*, at least one of its sensor *s*� ∈ *C* has turned off. But the set of targets considered by sensor *s* is no larger than *T*� = *<sup>s</sup>*�∈*N*(*s*,1) *<sup>T</sup>*(*s*� ). Since *s* itself can cover *T*(*s*), there exist a target *t* ∈ *T*� − *T*(*s*), from *T*(*s*� ), that none of the cover sets at s are able to cover. This implies that *s*� is off, else {*s*,*s*� } would have formed part of a cover at *s* covering *t* (given that *s* constructs all possible covers). This leads to the contradiction, as before turning off, *s*� ensures that *t* ∈ *T*(*s*� ) is covered.

For case (ii), each transition implies that a neighbor sensor has decided its on/off status, thereby making some of the covers at *s* infeasible and increasingly satisfying portions of some other covers, thus reducing the choices from the finite number of its covers. Eventually, when the last neighbor decides, *s* will be able to decide as well becoming on if any target in *T*(*s*) is still uncovered, else going off.

For case (iii), the possibility that all sensors are stuck at their best initial covers is conventionally broken by a sensor *s* ∈ *C* with least id in its current best cover *C* pro actively becoming on, even though *C* may not be completely satisfied. This is similar to the start-up problem faced by others distributed algorithms such as DEEPS with similar deadlock breaking solutions. At a later stage, if *s* is stuck at *C*, it means that either all its neighbors have decided or one or more neighbors are all stuck. In the former case, there exists a cover *C* at *s* which will be satisfied with *s* becoming on (case i). The latter case is again resolved by the start-up deadlock breaking rule by either *s* or *s*� pro actively becoming on.

**Message and time complexities**: Let us assume that each sensor *s* constructs the covers over its one-hop neighbors to cover its targets in *T*(*s*) only. Let *S* = {*s*1,*s*2, ...,*sn*} <sup>Δ</sup> =*maxs*∈*<sup>S</sup>* |*N*(*s*, 1)|, the maximum number of neighbors a sensor can communicate with. The communication complexity of the initial setup phase is *O*(Δ), assuming that there are constant number of neighboring targets that each sensor can sense. Also, for each reshuffle round, a sensor receives *O*(Δ) status messages and sends out one. Assuming Δ is a constant practically implies that message complexity is also a constant. Let maximum number of targets a sensor considers is *<sup>τ</sup>* =*maxs*∈*<sup>S</sup>* |*T*(*s*)|, a constant. The maximum number of covers constructed by sensor *s* during its setup phase is *O*(Δ*τ*), as each sensor in N(s,1) can potentially cover all its targets considered. Hence the time complexity of setup phase is *O*((Δ*τ*)2) to construct the LD graph over all covers and calculate the priorities. For example, if *τ* = 3, the time complexity of the setup phase would be *O*(Δ6). The reshuffle rounds transition through potentially all the covers, hence their time complexity is *O*(Δ*τ*).
