# Energy Storage Overflow-Aware Data Delivery Scheme for Energy Harvesting Wireless Sensor Networks
## 3 ESO-Aware Data Delivering Scheme
### The EAMP
Then, the crossover operation yields two chromosomes: \(\varphi^{(a^{\prime})}=(\varphi_{1}^{(a^{\prime})},\varphi_{2}^{(a^{\prime})}, \cdots,\varphi_{k}^{(a^{\prime})})\) and \(\varphi^{(b^{\prime})}=(\varphi_{1}^{(b^{\prime})},\varphi_{2}^{(b^{\prime})}, \cdots,\varphi_{k}^{(b^{\prime})})\), in which we set  
\[\left\{ \begin{array}{l}\varphi_{i}^{(a^{\prime})}=\varphi_{i}^{(a)},i=1,2, \cdots,v;\\ \varphi_{i}^{(a^{\prime})}=\varphi_{i}^{(b)},i=v+1,v+2,\cdots,\delta^{\prime };\\ \varphi_{\delta^{\prime}+1}^{(a^{\prime})}=L-\sum\limits_{i=1}^{\delta^{\prime }}\varphi_{i}^{(a^{\prime})};\\ \varphi_{i}^{(a^{\prime})}=0,i=\delta^{\prime}+2,\delta^{\prime}+3,\cdots,k, \end{array} \right. \tag{20}\]  
and  
\[\left\{ \begin{array}{l}\varphi_{i}^{(b^{\prime})}=\varphi_{i}^{(b)},i=1,2, \cdots,v;\\ \varphi_{i}^{(b^{\prime})}=\varphi_{i}^{(a)},i=v+1,v+2,\cdots,\delta^{\prime \prime};\\ \varphi_{\delta^{\prime\prime}+1}^{(b^{\prime})}=L-\sum\limits_{i=1}^{\delta^ {\prime\prime}}\varphi_{i}^{(b^{\prime})};\\ \varphi_{i}^{(b^{\prime})}=0,i=\delta^{\prime\prime}+2,\delta^{\prime\prime}+ 3,\cdots,k,\end{array} \right. \tag{21}\]  
where  
\[\left\{ \begin{array}{l}\delta^{\prime}=\max\{x|\sum\limits_{i=1}^{v}\varphi_ {i}^{(a^{\prime})}+\sum\limits_{i=v+1}^{x}\varphi_{i}^{(b)}\leq L,x\leq k-1\}; \\ \delta^{\prime\prime}=\max\{x|\sum\limits_{i=1}^{v}\varphi_{i}^{(b^{\prime})} +\sum\limits_{i=v+1}^{x}\varphi_{i}^{(a)}\leq L,x\leq k-1\}.\end{array} \right. \tag{22}\]  
The aim of introducing \(\delta^{\prime}\) and \(\delta^{\prime\prime}\) in (22) is to make the two generated chromosomes \(\varphi^{(a^{\prime})}\) in (20) and \(\varphi^{(b^{\prime})}\) in (21) satisfy the first constraint (i.e., Equation (1)) in OP (18). In fact, the crossover operation tries shifting the genes after the crossover point in the two chromosomes. Unfortunately, the newly generated chromosomes may not satisfy the first constraint if the genes after the crossover point are all shifted. Therefore, one of the new chromosome first, say \(\varphi^{(a^{\prime})}\), inherits the first \(v\) genes in \(\varphi^{(a)}\), and then we pick the genes behind the crossover point \(v\) such that the sum of the picked genes and the ones already in \(\varphi^{(a^{\prime})}\) does not exceed \(L\). Then, we generate a new gene to satisfy that the sum of the genes already in \(\varphi^{(a^{\prime})}\) is equal to \(L\) so that the first constraint is met. Then, the remaining genes, if any, are set to 0 so that the constraint is still met. In the case when any of the chromosomes in (20) and (21) does not satisfy the other two constraints of the OP, the involved chromosome(s) will be replaced with the one(s) generated using the aforementioned feasible chromosome generating process. (4) Mutation operation. Each chromosome is mutated with a small probability. For a chromosome to be mutated, we pick an integer \(v\) in \(\{1,\,2,\,\ldots,\,k\}\) randomly. If \(v<k\), the mutation operation switches \(\varphi_{v}^{(j)}\) and \(\varphi_{v+1}^{(j)}\), which leads to a new chromosome as \((\varphi_{1}^{(j)},\cdots,\varphi_{v+1}^{(j)},\varphi_{v}^{(j)},\cdots,\varphi_ {k}^{(j)})\). Otherwise, \(\varphi_{k-1}^{(j)}\) and \(\varphi_{k}^{(j)}\) are switched, which yields \((\varphi_{1}^{(j)},\varphi_{2}^{(j)},\cdots,\varphi_{k}^{(j)},\varphi_{k-1}^{ (j)})\). If the newly generated chromosome does not satisfy any of the constraints of the OP, it is replaced with the one generated by using the aforementioned feasible chromosome generating process. After the GA terminates, the solution of the OP is found. The results shown in Section 4 are obtained from the above GA. Following [7] and [24], we assume that the incoming energy is known by each sensor node over a finite time horizon, and the sink knows the residual energy and incoming energy of all the nodes through the previous information exchange. The sink is assumed to have sufficient power supply and it stores the information of the multiple disjointed paths.