# Mean-Field Stackelberg Game-Based Security Defense and Resource Optimization in Edge Computing
## 4 Mean-Field Games Equilibrium and Optimal Strategies
### Mean-Field Equilibrium of Attacker  
In this section, we discuss the equilibrium problem faced by the attacker and try to obtain the corresponding optimal strategy. The local optimal solution will be analyzed and an approximation mean-field solution will be obtained.  
Due to the nature of the mean-field game under consideration, the attacker aims to minimize the following equation:  
\[J_{0}(x_{0},u_{i},u_{0})=E{\int_{0}^{T}}\Big{(}\alpha_{0}\|x_{0}(t)-z(t)\|^{2}+ \beta_{0}\|u_{0}(t)\|^{2}+\gamma_{i}u_{i}(t)\Big{)}dt \tag{27}\]  
subject to the attacker's state equation:  
\[dx_{0}(t)=\bigg{[}a_{0}x_{0}(t)+b_{0}u_{0}(t)+\sum_{i=1}^{N}\kappa_{i}\Big{(} \beta_{i}^{-1}p_{i}(t)b_{i}-\beta_{i}^{-1}\lambda_{i}u_{0}(t)\Big{)}\bigg{]}dt \tag{28}\]  
and the mean-field approximation constraint:  
\[dz(t)=\Big{[}a_{i}z(t)+b_{i}\Big{(}\beta_{i}^{-1}p(t)b_{i}-\beta_{i}^{-1} \lambda_{i}u_{0}(t)\Big{)}+c_{i}\|z(t)-Az(t)\|^{2}+cu_{0}(t)\Big{]}dt \tag{29}\]  
\[dp(t)=[a_{i}p(t)+a_{0}(z(t)-Az(t))]dt \tag{30}\]  
where \(p(T)=0\), \(E[x_{0}(0)]=x_{0}\), and \(E\Big{[}\|x_{0}(0)\|^{2}\Big{]}<\infty\). In (27), the mean-field term is replaced with the approximated term \(z(t)\), which is dependent on the strategy of the attacker \(u_{0}(t)\) as can be obtained from (29). Note that the mean-field game equilibrium problem for the defenders has been discussed by an approximated condition. Since the optimization problem for the attacker (27) has the initial and boundary conditions, it is much more tractable than the control problem of defenders. Based on the mean-field approximation problem in Section 4, the mean-field constraints (29) and (30) can be replaced by  
\[dz(t)=\Big{[}\Big{(}a_{i}-\beta_{i}^{-1}b_{i}^{2}V_{i}(t)\Big{)}z(t)+\beta_{i} ^{-1}b_{i}^{2}\varphi(t)+c_{i}\|\overline{z}(t)-Az(t)\|^{2}+\Big{(}c-\beta_{i }^{-1}\lambda_{i}\Big{)}V_{i}(t)\Big{]}dt \tag{31}\]  
\[d\varphi(t)=\Big{[}\Big{(}a_{i}-\beta_{i}^{-1}b_{i}^{2}V_{i}(t)\Big{)}\varphi (t)-\phi_{i}Az(t)-V_{i}(t)\Big{(}\beta_{i}^{-1}\lambda-c\Big{)}u_{0}(t)\Big{]}dt \tag{32}\]  
where \(z(0)=x_{0}\) and \(\varphi(T)=0\).  
**Proposition 2**. _For the optimal attack problem for \(u_{0}(t)\), the pair \((x_{0}^{*},u_{0}^{*})\) is the optimal solution for the game model (2) and (4) if and only if_  
\[u_{0}^{*}(t)=-\beta_{0}^{-1}p(t)b_{0}+\beta_{0}^{-1}\,\rho_{0}(t)\sum_{i=1}^{ N}\beta_{i}^{-1}\lambda_{i}^{2}-\rho_{1}(t)\ \beta_{0}^{-1}{\sum_{i=1}^{N}\beta_{i}^{-1}b_{i}\ \lambda_{i}} \tag{33}\]  
_where \((x_{0}^{*},\rho_{0},\rho_{1})\)is a solution to the equation as follows:_  
\[dx_{0}^{*}(t)=\Big{[}a_{0}x_{0}^{*}(t)+b_{0}u_{0}^{*}(t)+{\sum_{i=1}^{N} \lambda_{i}}\Big{(}\beta_{i}^{-1}p(t)b_{i}-\beta_{i}^{-1}\ u_{0}^{*}(t)\Big{)} \ \Big{]}dt \tag{34}\]  
\[d\rho_{0}(t)=\bigg{[}-a_{0}\rho_{0}(t)+c_{0}(Az(t)-x_{0}^{*}(t))+\sum_{i=1}^{ N}\lambda_{i}\rho_{1}(t)\bigg{]}dt \tag{35}\]  
\[d\rho_{1}(t)=\Big{[}a_{i}\rho_{1}(t)+b_{i}\Big{(}\beta_{i}^{-1}p(t)b_{i}-\beta _{i}^{-1}\lambda_{i}u_{0}^{*}(t)\Big{)}+c_{i}\|\overline{z}(t)-Az(t)\|^{2}+cu _{0}^{*}(t)\Big{]}dt \tag{36}\]  
\[dp(t)=[-a_{0}p(t)+\alpha_{0}(x_{0}^{*}(t)-Az(t))]dt \tag{37}\]  
_where \(x_{0}(0)=x_{0}\), \(p(T)=0\), \(\rho_{0}(T)=0\), \(\rho_{1}(0)=0\), and \(z(0)=x_{0}\)._