# Lyapunov-Guided Energy Scheduling and Computation Offloading for Solar-Powered WSN
## 3 Problem Formulation  
Considering the constraints of long-term power consumption, instantaneous power consumption, and time constraints of the network under renewable energy access, we optimize the long-term energy efficiency of the network. The long-term network energy efficiency EE is defined as the ratio of the total long-term network computation to the total long-term energy consumption, i.e.,  
\[\eta_{EE}=\frac{\lim\limits_{T\rightarrow\infty}\frac{1}{T}\sum\limits_{t=1}^{T} \sum\limits_{k=1}^{K}\mathbb{E}\{\Phi_{k}^{t}\}}{\lim\limits_{T\rightarrow \infty}\frac{1}{T}\sum\limits_{t=1}^{T}\mathbb{E}\{E_{total}^{t}\}}=\frac{ \sum\limits_{k=1}^{K}\overline{\Phi}_{k}^{t}}{\overline{E}_{total}^{t}} \tag{11}\]  
where \(\sum\limits_{k=1}^{K}\overline{\Phi}_{k}^{t}\) and \(\overline{E}_{total}^{t}\) denote the limits on the time-averaged expectation of the total network computation and total energy, respectively. From Equations (1), (5) and (6), we know that the HAP and each sensor node have a strong energy/data causal constraint, i.e., the offloading result for the current time frame of the node will affect the available energy of the HAP/node in the next time frame through the computational energy consumption, which affects its offloading decision. For example, assuming that current time frame \(t\) has an initial available energy \(E_{k}^{t-1}\) and computational offload energy consumption \(E_{k,con}^{t}\), the initial available energy of the next time slot approaches 0, making the next time frame unable to complete the computational offload task. It can be seen that the offloading decision becomes more complicated due to the existence of energy causal constraints and strong coupling between different time frames. To obtain the optimal long-term network offloading energy efficiency, we convert the energy causal constraints in Equations (1), (5) and (6) into the following C7-C9 queue stability constraints. We consider the maximization of network energy efficiency under solar energy constraints to optimize sensor node partial task offloading strategies and network resource allocation. The problem is described as shown in P1. \[ \begin{split}&\text{P1}:=\max\limits_{\Omega}\eta_{EE}\\ & s.t.\\ &\text{C1}:\tau_{k}\geq 0\\ &\text{C2}:\sum\limits_{k=0}^{K}\tau_{k}\leq T\\ &\text{C3}:0\leq p_{k}\leq p_{k}^{\text{max}}\\ &\text{C4}:0\leq p_{S}\leq p_{S}^{\text{max}}\\ &\text{C5}:0\leq f_{k}\leq f_{k}^{\text{max}}\\ &\text{C6}:E_{S}^{t}\leq B^{\text{max}}\\ &\text{C7}:0\leq\lim\limits_{T\rightarrow\infty}\frac{1}{T}\sum \limits_{t=1}^{T}\mathbb{E}\{E_{S}^{t}\}<\infty\\ &\text{C8}:\lim\limits_{T\rightarrow\infty}\frac{1}{T}\sum \limits_{t=1}^{T}\mathbb{E}\{E_{k}^{t}\}<\infty\\ &\text{C9}:\lim\limits_{T\rightarrow\infty}\frac{1}{T}\sum \limits_{t=1}^{T}\mathbb{E}\{Q_{k}^{t}\}<\infty\end{split}  \tag{12}\]  
where \(\Omega=\{\mathbf{P},\mathbf{\Gamma},f\}\), in which \(\mathbf{\Gamma}=\{\tau_{0}^{t},\ldots,\tau_{K}^{t}\}\) denotes the time slot allocation policy; \(\mathbf{P}=\{p_{0}^{t},\ldots,p_{K}^{t}\}\) denotes the energy broadcast transmission policy. Constraints C1 and C2 are time constraints. Constraints C3 and C4 limit the maximum transmit power of the node and HAP, respectively. Constraint C5 denotes the CPU computation frequency constraints of the node. Constraint C7 denotes the long-term energy consumption constraints of the HAP, which is the key to guaranteeing the stability of the HAP energy buffer queue and also constrains the available energy of the HAP at any moment not to exceed the maximum storage limit of the battery. Constraints C8-C9 are prerequisites for ensuring the stability of the node energy buffer queue and the data buffer queue. Clearly, problem P1 is a non-convex fractional programming problem with a strong coupling between the optimization variables \(\{\mathbf{P},\mathbf{\Gamma}\}\) and the objective function, making it hard to solve directly.