# Novel Reliable and Energy-Efficient Routing Protocols for Wireless Sensor Networks
## 5 Optimal Path Selection Based on Energy Entropy  
We can further generalize this method by introducing an entropy-like measure on energy distribution. The equality of residual energy of relay nodes can be extended for uniform distribution of residual energy across all the path's nodes. This uniformity can be achieved by maximizing entropy. At instant \((K=0)\), the entropy is maximum because all the nodes have the same initial energy; to keep the entropy at maximum, the gradient of the entropy should be minimized. We can calculate the entropyof the normalized residual energy distribution on the nodes of the network \(\overline{c}(k)=c_{1}(k),c_{2}(k),\ldots,c_{N}(k)\) at time instant \(k\). Hence, the entropy characterizing the current energy distribution is:  
\[\mathrm{H}(\overline{c})=\sum_{i=1}^{N}\frac{c_{i}(k)}{\sum_{j=1}^{N}c_{j}(k)} \log\frac{\sum_{j=1}^{N}c_{j}(k)}{c_{i}(k)} \tag{14}\]  
The gradient of the entropy can be calculated as follows:  
\[\overline{\
abla}=\
abla\mathrm{H}(\overline{c})=\frac{\partial H}{\partial c _{1}},\frac{\partial H}{\partial c_{2}},\ldots,\frac{\partial H}{\partial c_{ N}}. \tag{15}\]  
Suppose that source node \(s\) is sending a packet via the relay nodes \(l_{1},\ldots,l_{m}\) where \(l_{m}\) is the last relay node, then the residual energy of nodes involved in packet forwarding will change as:  
\[c_{l_{j}}(k+1)=\ c_{l_{j}}(k)-\left(-d_{l_{j}l_{j+1}}\frac{\theta\sigma_{Z}^{ 2}}{\ln\left(P_{l_{j}l_{j+1}}\right)}\right) \tag{16}\]  
Further, the gradient of the entropy of the power distribution on a relay node is given as:  
\[\frac{\partial_{H}}{\partial_{c_{l}}}=\frac{\sum_{j=1}^{N}c_{j}(k)-c_{l}(k)}{ \left(\sum_{j=1}^{N}c_{j}(k)\right)^{2}}\log[\frac{\sum_{j=1}^{N}c_{j}(k)}{c_ {l}(k)}]+\frac{c_{l}(k)-\sum_{j=1}^{N}c_{j}(k)}{\left(\sum_{j=1}^{N}c_{j}(k) \right)^{2}}, \tag{17}\]  
While the gradient of the entropy of the power distribution on the other nodes of the path is given as:  
\[\frac{\partial_{H}}{\partial_{c_{i}}}=\frac{-c_{i}(k)}{\left(\sum_{j=1}^{N}c_ {j}(k)\right)^{2}}\ast\mathrm{Log}[\frac{\sum_{j=1}^{N}c_{j}(k)}{c_{i}(k)}]+ \frac{c_{i}(k)}{\left(\sum_{j=1}^{N}c_{j}(k)\right)^{2}}. \tag{18}\]  
Thus, the change of the entropy is:  
\[\Delta\mathcal{H}{=\overline{V}^{T}\ast\Delta\overline{c}(k)}.\]  
The optimal path is the one that keeps this gradient minimum, thus enforcing only small changes in the energy entropy, guaranteeing that the energy distribution falls as close to its maximum as possible. In this way, a more or less uniform residual energy distribution can be maintained while sending packets to the BS. The optimum choice of relay nodes (i.e., the optimal path) which minimizes the change in the gradient can thus be obtained as:  
\[l_{opt}=min(\Delta H=\overline{\
abla}^{T}\ast\Delta\overline{c}(k)). \tag{19}\]  
After each round, the BS updates the residual energy vector of all nodes, \(c(k)=(c_{1}(k),\ldots,c_{i}(k),\ldots,c_{N}(k))\), finds the optimal path from node \(i\) to the BS, and calculates the relay nodes of the path using OREBP. The BS broadcasts a new look-up-table containing the optimal routes of each node. This can help reduce the computational load on the nodes and improve their energy efficiency.  
We will refer to this method of routing the packets to the BS as the Optimal Remaining Energy-Based Protocol (OREBP). The needed calculations increase as the number of maximum hops (\(m\)) increases; as the maximum number of hops (\(m\)) increases, more possible paths are available and more optimality is achieved.