# Resource Allocation in Wireless Powered IoT System: A Mean Field Stackelberg Game-Based Approach
## 4 Game Analysis and Implementation Algorithm
### Mean Field Control of Sensor Nodes
In (12), the optimal power strategy \(p_{i}^{*}(t)\) is a function of the energy state \(x_{i}^{*}(t)\) and the value function \(V_{i}(t)\), where the value function \(V_{i}(t)\)should satisfy the following relation:_  
\[\lambda_{i}(t)=-V_{i}(t)x_{i}^{*}(t)+\phi_{i}(t) \tag{13}\]  
_and:_  
\[-\frac{dV_{i}(t)}{dt}=\
u_{i}^{-1}\beta_{i}^{2}{V_{i}}^{2}(t)+2\alpha_{i}V(t)- \mu_{i} \tag{14}\]  
_where \(\phi_{i}(T)=0\), \(V_{i}(T)=0\). Based on Proposition 2, we can obtain the state feedback equilibrium of the optimal control strategy in Equation (7). Meanwhile, the corresponding optimal state trajectory, the corresponding energy variations in Equations (8) and (9) can be re-written as follows_:  
\[dx_{i}^{*}(t)==\Big{[}\Big{(}\alpha_{i}+\beta_{i}^{2}\
u_{i}^{-1}V_{i}(t) \Big{)}x_{i}^{*}(t)-\beta_{i}^{2}\
u_{i}^{-1}\phi_{i}(t)-\beta_{i}\
u_{i}^{-1 }\eta_{i}p_{0}(t)+\rho_{i}h_{i}p_{0}(t)\Big{]}dt \tag{15}\]  
\[d\phi_{i}(t)==\Big{[}-\Big{(}\alpha_{i}+\beta_{i}^{2}\
u_{i}^{-1}V_{i}(t) \Big{)}\phi_{i}(t)+\mu_{i}H_{i}z(t)-V(t)\beta_{i}\
u_{i}^{-1}\eta_{i}p_{0}(t)- \rho_{i}h_{i}p_{0}(t)\Big{]}dt \tag{16}\]  
Next, in order to get the mean field estimation, we should apply the strong law of large numbers (SLLN) to the control strategies given in the above. For each sensor node, the optimal power strategy can be given by Equation (7), and the associated energy state is given by Equation (8). Let \(\lambda^{N}(t)=(1/N)\sum_{i=1}^{N}\lambda_{i}(t)\), then \(z(t)=\lim_{N\rightarrow\infty}x^{N}(t)\), and \(\lambda(t)=\lim_{N\rightarrow\infty}\lambda^{N}(t)\) can be given by:  
\[dz(t)=\Big{[}\alpha_{i}z(t)+\beta_{i}\Big{(}-\beta_{i}\
u_{i}^{-1}\lambda(t)- \
u_{i}^{-1}\eta_{i}p_{0}(t)\Big{)}+\rho_{i}h_{i}p_{0}(t)\Big{]}dt \tag{17}\]  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]0  
With the functions given in Equations (15)-(18) can also be written as:  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]1  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]2  
where \(\phi(t)=\lim_{N\rightarrow\infty}(1/N)\sum_{i=1}^{N}\phi_{i}(t)\) and \(\phi(T)=0\). When the number of the sensor nodes \(N\) is arbitrary large, we can find the mean field estimation based on Equation (19) and (20). Additionally, we can find that the mean field estimation is dependent on the HAP's power control strategy. **Proposition 3**. : _For any power strategy of the HAP, we have:_  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]3  
_Recall the optimal power strategy for the sensor node \(i\), \(1\leq i\leq N\), in Proposition 1_:  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]4  
_where \(\left(x_{i}^{*},\lambda_{i}\right)\) is determined in Equations (8) and (9). The above optimal control strategy given in Equation (22) is an open loop solutions controlled by the power control strategy of the HAP._  
**Theorem 2**. : _For any power strategy of the HAP for energy transfer, the information transmission strategy for each sensor node \(\{i,1\leq i\leq N\}\), constitutes an \(\varepsilon\)-Nash equilibrium, that is, for any \(i\), \(1\leq i\leq N\), we have:_  
\[z(t)=x^{N}(t)=(1/N)\sum_{i=1}^{N}x_{i}(t)\]5  
_where \(\varepsilon=\mathrm{O}\!\left(1/\sqrt{N}\right)\)._