# An Information Entropy Based Event Boundary Detection Algorithm in Wireless Sensor Networks
## 4 Proposed Algorithm
### Determining Rules  
Consider Figure 5, where the actual boundary meets the disk of \(S_{i}\) at dots \(P_{1}\) and \(P_{2}\) while the event boundary width line meets the disk at dots \(P_{3}\) and \(P_{4}\). Therefore, the actual boundary intersects the neighbouring area of \(S_{i}\) in two areas. Let \(A_{1}\) represent the left part of \(\mathbb{N}_{S_{i}}\) separated by actual boundary. The remaining area of \(\mathbb{N}_{S_{i}}\) is represented by \(A_{2}\). So we estimate the probability of node distribution using geometric probability.  
As in Figure 5, we consider a node \(S_{i}\) that satisfies \(\|S_{i},B\|=r\) as a critical node and its entropy \(H\) as the determining threshold \(H_{th}\). \(A_{1}\) has an area  
\[A_{1}=\frac{1}{2}\pi R^{2}+S_{P_{1}P_{2}P_{3}P_{4}} \tag{4}\]  
where \(S_{P_{1}P_{2}P_{3}P_{4}}\) means the area of sector \(P_{1}P_{2}P_{3}P_{4}\), and  
\[S_{P_{1}P_{2}P_{3}P_{4}}=r\sqrt{R^{2}-r^{2}}+R^{2}\text{arcsin}\frac{r}{R} \tag{5}\]  
so that we can estimate the probability of affected nodes in \(\mathbb{N}_{S_{i}}\) as  
\[p_{th}=\frac{1}{2}+\frac{S_{P_{1}P_{2}P_{3}P_{4}}}{\pi R^{2}} \tag{6}\]  
Figure 4: Entropy vs. Number of Neighbour Nodes.  
Figure 5: An illustration of critical node.  
From the above discussion, it can be seen that the formulation of \(H_{th}\) is influenced by the relationship between \(r\), \(R\) and \(\rho\). By setting the boundary width \(r\) in a certain range, we can get the appropriate threshold \(H_{th}\) and then achieve the corresponding detection results. This allows an outline that fits the event boundary to be customizable.  
The EEBD algorithm consists of three steps. Firstly, each affected node \(S_{i}\) collects information from its neighbour nodes. Then it computes the value of \(H_{i}\) according to (3), that is  
\[H_{i}=-(p\log p+q\log q) \tag{12}\]  
where  
\[p=\frac{number\;of\;affected\;node}{total\;neighbor\;number} \tag{13}\]  
\[p=1-q \tag{14}\]  
Then, sensor node \(S_{i}\) reports the value of \(H_{i}\) and listens to its neighbours node information. In the third step, given boundary width r and communication radius R to calculate the entropy threshold \(H_{th}\) which is defined in (8). If \(H_{i}\geq H_{th}\), node \(S_{i}\) finally marks itself as a boundary node. The steps of EEBD algorithm are as shown below.  
Figure 8: An illustration of the range boundary width.  
Figure 7: An illustration of extreme boundary width.  
```
Input : Node \(S_{i}\), boundary width \(r\), node density \(\rho\), communication radius R and \(M_{S_{i}}\)= {} Output : broadcast the ID if it is the real event boundary senor node  For each sensor node  Initialize : compute \(H_{th}\) according to \((8)\), \(H_{i}=0\);  step 1;  Discover the affected sensor nodes if sensing data \(>\mu_{th}\)  flag(\(i\)) \(\gets 1\) else  flag(\(i\)) \(\gets 0\) end  Broadcast \(M_{S_{i}}:=\{S_{i},H_{i},flag(i)\}\) to its neighbour nodes if flag(\(i\)) == 1 \(H_{i}\leftarrow-(p\log p+q\log q)\)  Update \(M_{S_{i}}\) with new \(H_{i}\)  end  step 2;  Broadcast message\(M_{S_{i}}:=\{S_{i},H_{i},flag(i)\}\)  Listen to its neighbour nodes  step 3 if\(H_{i}\geq H_{th}\)  broadcast \(S_{i}\) as the final boundary node to the \(\sin\text{k}\), \(B(S_{i},r)\)
```  
**Algorithm 1**Entropy based Event Boundary Detection (EEBD) Algorithm