# Lyapunov-Guided Energy Scheduling and Computation Offloading for Solar-Powered WSN
## 3 Problem Formulation
### Problem Reformulation Based on Lyapunov Optimization Theory
\begin{array}{ll}\Delta_{V}L[\mathbf{G}^{t}]\leq C+&\sum\limits_{k=1}^{K}E_ {k}^{t-1}\mathbb{E}\{\left.E_{k,har}^{t}-E_{k,con}^{t}\right|\mathbf{G}^{t}\} \\ &+\sum\limits_{k=1}^{K}Q_{k}^{t-1}\mathbb{E}\{\left.D_{k}^{t}-\Phi_{k}^{t}| \mathbf{G}^{t}\right\}\\ &+\Big{(}E_{S}^{t-1}-2B^{\text{max}}\Big{)}\mathbb{E}\{\left.E_{S,har}^{t}-E_{ MEC}^{t}-P_{S}^{t}\tau_{0}\right|\mathbf{G}^{t}\}\\ &-V\ \mathbb{E}\big{\{}\sum\limits_{k=1}^{K}\overline{\Phi}_{k}^{t}-\eta_{EE}^{t }\overline{E}_{total}^{t}\Big{|}\mathbf{G}^{t}\}\end{array}  \tag{20}\]  
**Proof. ** For any non-negative real number, the scaling rules of sum can be applied to find the energy of all nodes and HAPs as in Equations (21)-(23), respectively. \[\frac{1}{2}\sum\limits_{k=1}^{K}\biggl{[}\left(E_{k}^{t}\right)^{2}-\left(E_{ k}^{t-1}\right)^{2}\biggr{]}\leq\frac{1}{2}\sum\limits_{k=1}^{K}\left(E_{k, con}^{t}\right)^{2}+\frac{1}{2}\sum\limits_{k=1}^{K}\left(E_{k,har}^{t}\right)^{2}+ \sum\limits_{k=1}^{K}E_{k}^{t-1}\Big{(}E_{k,har}^{t}-E_{k,con}^{t}\Big{)} \tag{21}\]  
\[\frac{1}{2}\sum\limits_{k=1}^{K}\biggl{[}\left(Q_{k}^{t}\right)^{2}-\left(Q_{ k}^{t-1}\right)^{2}\biggr{]}\leq\frac{1}{2}\sum\limits_{k=1}^{K}\left(D_{k}^{t} \right)^{2}+\frac{1}{2}\sum\limits_{k=1}^{K}\left(\Phi_{k}^{t}\right)^{2}+ \sum\limits_{k=1}^{K}Q_{k}^{t-1}\bigl{(}D_{k}^{t}-\[PERSON]_{k}^{t}\bigr{)}^{2} \tag{22}\]  
\[\begin{array}{l}\frac{1}{2}\Bigl{[}\left(B^{\text{max}}-E_{S}^{t}\right)^{2}- \left(B^{\text{max}}-E_{S}^{t}\right)^{2}\Bigr{]}\leq\frac{1}{2}\biggl{[}\left(E_ {S}^{t}\right)^{2}-\left(E_{S}^{t-1}\right)^{2}\biggr{]}-2B^{\text{max}}\Bigl{(} E_{S,har}^{t}-E_{MEC}^{t}-P_{S}^{t}\tau_{0}\Bigr{)}\\ \\ =\frac{1}{2}\bigl{(}P_{S}^{t}\tau_{0}\bigr{)}^{2}+\frac{1}{2}\Bigl{(}E_{S,har}^{ t}-E_{MEC}^{t}\Bigr{)}^{2}+\Bigl{(}E_{S}^{t-1}-2B^{\text{max}}\Bigr{)}\Bigl{(}E_{S, har}^{t}  
where \(C\) is an upper bound of \(C^{t}\) which satisfies  
\[ \begin{array}{rl}C\geq C^{t}=&\frac{1}{2}\sum\limits_{k=1}^{K}\left(E_{k,con}^{ t}\right)^{2}+\frac{1}{2}\sum\limits_{k=1}^{K}\left(E_{k,har}^{t}\right)^{2}+ \frac{1}{2}\left(P_{S}^{t}\tau_{0}\right)^{2}+\frac{1}{2}\left(E_{S,har}^{t}-E_ {MEC}^{t}\right)^{2}\\ &+\frac{1}{2}\sum\limits_{k=1}^{K}\left(D_{k}^{t}\right)^{2}+\frac{1}{2}\sum \limits_{k=1}^{K}\left(\Phi_{k}^{t}\right)^{2}\end{array}  \tag{25}\]  
Further, the drift minus utility DMU function \(\Delta_{V}L[\mathbf{G}^{t}]\) is obtained to satisfy  
\[ \begin{array}{rl}\Delta_{V}L[\mathbf{G}^{t}]\leq C+&\sum\limits_{k=1}^{K}E_ {k}^{t-1}\mathbb{E}\{\,E_{k,har}^{t}-E_{k,con}^{t}\Big{|}\mathbf{G}^{t}\}\\ &+\sum\limits_{k=1}^{K}Q_{k}^{t-1}\mathbb{E}\{\,D_{k}^{t}-\Phi_{k}^{t}\big{|} \mathbf{G}^{t}\}\\ &+\Big{(}E_{S}^{t-1}-2B^{\max}\Big{)}\mathbb{E}\{\,E_{S,har}^{t}-E_{MEC}^{t}- P_{S}^{t}\tau_{0}\Big{|}\mathbf{G}^{t}\}\\ &-V\,\mathbb{E}\{\,\sum\limits_{k=1}^{K}\overline{\Phi}_{k}^{t}-\eta_{EE}^{t} \overline{E}_{total}^{t}\Big{|}\mathbf{G}^{t}\}\end{array}  \tag{26}\]  
\(\square\)  
Based on Equation (20) and in accordance with the principle of opportunistic minimization of expectations [35], we convert the long-term optimization problem P1 in this section into an online single time slot optimization problem by using the Lyapunov optimization method. If the single time slot optimization problem is solved optimally on each time slot, the optimal solution to the original problem can be achieved successively, and the original problem P1 can be converted into  
\[ \begin{array}{rl}\text{P2}:\min\limits_{\Omega}\sum\limits_{k=1}^{K}E_{k}^{ t-1}\Big{[}E_{k,har}^{t}-E_{k,con}^{t}\Big{]}+\left(E_{S}^{t-1}-2B^{\max} \right)\Big{[}E_{S,har}^{t}-E_{MEC}^{t}-P_{S}^{t}\tau_{0}\Big{]}\\ \hskip 113.811024 pt-V\left[\sum\limits_{k=1}^{K}\overline{\Phi}_{k}^{t}-\eta_ {EE}^{t}\overline{E}_{total}^{t}\right]+\sum\limits_{k=1}^{K}Q_{k}^{t-1}\big{[} D_{k}^{t}-\Phi_{k}^{t}\big{]}\\ \hskip 113.811024 pts.t.\text{C1}\sim\text{C6}\end{array}  \tag{27}\]