# Optimal Routing for Time-Driven EH-WSN under Regular Energy Sources
## 5 Criterion for Optimal Routing
In this case, regardless of the specific inter-layer connections between this layer and layer \(l_{L}\), we have \(\sum_{x_{k}\in l_{L-1}}\sigma(x_{k})=n_{L}\): Since all input links to nodes in layer \(l_{L-1}\) come from nodes in layer \(l_{L}\), and each node generates one packet per reporting period, the overall traffic load carried out by layer \(l_{L-1}\) coincides with the number of nodes in layer \(l_{L}\). Accordingly, the average traffic load supported by layer \(l_{L-1}\) is \(\overline{\sigma_{L-1}}=\frac{\sum_{x_{k}\in l_{L-1}}\sigma(x_{k})}{n_{L-1}}= \frac{n_{L}}{n_{L-1}}\). Next, since all input links to nodes in layer \(l_{L-2}\) come from nodes in layer \(l_{L-1}\), we can state that \(\sum_{x_{k}\in l_{L-2}}\sigma(x_{k})=\sum_{x_{k}\in l_{L-1}}(1+\sigma(x_{k}))\), because each node \(x_{k}\in l_{L-1}\) generates one packet and forwards a number of packets equal to its traffic load. Moreover, we can state that \(\sum_{x_{k}\in l_{L-1}}(1+\sigma(x_{k}))=n_{L-1}+\sum_{x_{k}\in l_{L-1}}\sigma (x_{k})=n_{L-1}+n_{L}\), which means that, with only inter-layer connections, the traffic load supported by layer \(l_{L-2}\) is equal to the total number of nodes in layers \(l_{L-1}\) and \(l_{L}\). In turn, this implies that the average traffic load supported by nodes in layer \(l_{L-2}\) is given by \(\overline{\sigma_{L-2}}=\frac{n_{L-1}+n_{L}}{n_{L-2}}\). So, from the point of view of layer \(l_{L-2}\), all nodes in layers \(l_{L-1}\) and \(l_{L}\) can be grouped into a single \(l_{L-1}\cup l_{L}\) super-layer. Then, by iterating this procedure over subsequent layers, we can end up with a general expression for the average traffic load supported by any layer: \(\overline{\sigma_{i}}=\frac{\sum_{j=i+1}^{L}n_{j}}{n_{j}},\ i=1\ldots L-1\). Finally, the average traffic load supported by the entire network can be expressed as \(\overline{\sigma}=\sum_{i=1}^{L}\overline{\sigma_{i}}\cdot\frac{n_{i}}{N}= \frac{1}{N}\sum_{i=1}^{L-1}\sum_{j=i+1}^{L}n_{j}\). The following lemma demonstrates that a routing tree based exclusively on inter-layer connections minimizes the average traffic load:  
Figure 4: Layer decomposition of a connected network. Lines represent feasible links for the given transmission range. Only inter-layer links are drawn. BS denotes the base station. **Lemma 2**. : _Let \(\overline{\sigma}^{(c)}\) the average traffic load that results from applying a given routing criterion \(c\) to construct the spanning tree. If \(\overline{\sigma}^{*}\) denotes the average traffic load obtained by applying the \"only inter-layer connections\" criterion, the following statement is true: \(\overline{\sigma}^{*}=\min\limits_{c\in\mathbb{C}}\left\{\overline{\sigma}^{(c )}\right\}\), with \(\mathbb{C}\) the set of all possible criteria._  
Proof. : In general, any routing criterion different from \"only inter-layer connections\" will give rise to at least \(L-1\) inter-layer connections (as there must be at least \(1\) inter-layer connection between two successive layers) combined with several intra-layer and/or backward inter-layer connections (see Figure 5). Let us first focus only on intra-layer connections. Figure 5 shows the simplest variation that can be introduced into a spanning tree that initially contains inter-layer connections exclusively. As it can be noticed, node \(u\) belonging to layer \(l_{i}\) is reconnected to node \(v\) in the same layer. The new connection, labeled (1), only causes an increase in the traffic load supported by node \(v\). In effect, if \(\sigma_{old}(x_{k})\) and \(\sigma_{new}(x_{k})\) denote, respectively, the traffic load of any given node \(x_{k}\) before and after the reconnection, we have:  
* \(\sigma_{new}(u)=\sigma_{old}(u)=\sigma(u)\). * \(\sigma_{new}(v)=\sigma_{old}(v)+1+\sigma(u)\), with \(\sigma_{old}(v)=1+\sigma(x)\). * \(\sigma_{old}(y)=1+\sigma_{old}(v)+1+\sigma(u)=3+\sigma(x)+\sigma(u)\). * \(\sigma_{new}(y)=1+\sigma_{new}(v)=1+\sigma_{old}(v)+1+\sigma(u)=3+\sigma(x)+ \sigma(u)=\sigma_{old}(y)\).