# Game Algorithm for Resource Allocation Based on Intelligent Gradient in HetNet
## 3 Stackelberg Game Model and Problem Statement
### Optimization Problems  
In the above part, we have determined the optimized results reached by femtocells and a macro base station. In this part, we will elaborate on the specific methods. According to the Stackelberg game model, the leaders are normally the first one to make response, and the followers make a corresponding strategy choice based on it. Due to the fact that the Stackelberg model is a double oligarchies game model, game process has no obvious primary and secondary classes. In the paper, we will firstly determine the optimal strategy of macro base station. The femtocells serve a part of the macro users because the macro base station is at the expense of the spectrum. This process is the one by which the femtocell offloads load. Given that final user number of the macro base station is the result of femtocells uninstalling the load, user number of a macro base station is the linear function related with community expansion bias \(\beta\). Therefore, revenue expression of a macro base station can be rewritten with the following equation:  
\[ \begin{split}&\max l_{m}=f(\beta)\log(\frac{r_{m}}{r_{0}})\\ & s.t.\ 0\leq\alpha\leq 1\\ &\beta_{j}\geq 1,\ j=1,2,\ldots,N\end{split}  \tag{12}\]  
Moreover, \(U_{m}\) and \(W_{j}\) are relevant, so we will first introduce the optimal solution \(W_{j}^{*}\) of system bandwidth obtained by a femtocell. The second partial derivative of \(W_{j}\) obtained through \(U_{j}\) is \(\frac{\partial^{2}U_{j}}{\partial W_{j}^{2}}=-\frac{S_{F_{j}}}{W_{j}^{2}}- \frac{S_{F_{j}}^{c}}{W_{j}^{2}}<0\). \(U_{j}\) as a function of \(W_{j}\) is a concave function. That is to say, optimal solution \(W_{j}^{i}\) can be obtained through one-order function. \[\frac{\partial U_{j}}{\partial W_{j}}=\frac{S_{F_{j}}}{W_{j}}+\frac{S_{F_{j}}^ {c}}{W_{j}}-(1-\alpha)\omega \tag{13}\]  
Optimal solution for femtocell spectrum distribution can be obtained as shown in Equation (14):  
\[W_{j}=\left\{ \begin{array}{ll}\frac{\left[\beta S_{F_{j}}\right]}{(1-\alpha )\omega}&0\leq\alpha\leq 1-\frac{\left[\beta S_{F_{j}}\right]}{\omega\vartheta} \\ W&1-\frac{\left[\beta S_{F_{j}}\right]}{\omega\vartheta}\leq\alpha\leq 1\end{array} \right. \tag{14}\]  
When substituting Equation (14) into Equation (12), we can get the following results:  
\[ \begin{split}&\max l_{m}=f(\beta)\log[\frac{\beta(1-\alpha)W \log(1+SINR_{m_{j}})}{f(\beta)r_{0}}]-\sum\limits_{j=1}^{N}f(\beta_{j})\log[ \frac{\beta_{j}aS_{F_{j}}W_{j}\log(1+\frac{SINR_{j}^{*}}{W_{j}})}{(1-\alpha) \omega f(\beta_{j})r_{0}}]\\ & s.t.\ \ 0\leq\alpha\leq 1\\ &\beta_{j}\geq 1,\ j=1,2,\ldots,N\end{split}  \tag{15}\]  
For the optimization issues with constraints, normally the Lagrange function is used to build this function. To meet the demand of optimization results of constraint, the Lagrange function is used to build a modified target function \(\phi(\alpha)=U_{m}(\alpha)-\mu(\alpha-1)\), where \(\mu\) is a constant. The second partial derivative \(\phi(\alpha)\), \(\frac{\partial^{2}\phi(\alpha)}{\partial\alpha^{2}}=-\frac{S_{m}}{(1-\alpha)^{ 2}}-\sum_{j=1}^{N}\frac{(S_{F_{j}}^{c}}{\alpha^{2}}-\frac{S_{F_{j}}^{c}}{(1- \alpha)^{2}})\), related with \(\alpha\) is less than 0. It can be understood that this optimization issue is a concave function, the optimization for which can be obtained through the one-order function. To obtain the optimal spectrum distribution factor \(\alpha^{*}\) of Nash equilibrium, assume \(\partial\phi(\alpha)/\partial\alpha=0\), where:  
\[\frac{\partial\phi(\alpha)}{\partial\alpha}=-\frac{S_{m}}{1-\alpha}+\frac{ \sum_{j=1}^{N}S_{F_{j}}^{c}}{(1-\alpha)\alpha}-\mu \tag{16}\]Then we can obtain Nash equilibrium \(\alpha^{*}\), with the expression shown as below:  
\[\alpha^{*}=\sqrt{\frac{(\mu+S_{m})^{2}}{4\mu^{2}}-\frac{\sum_{j=1}^{N}S_{F_{j}}^{ \epsilon}}{\mu}+\frac{\mu+S_{m}}{2\mu}} \tag{17}\]  
After determining the optimal strategy of the macro base station, we will introduce an optimal strategy solution for femtocells. Previously, we have introduced a revenue function for femtocells, which includes two parts.