# A Hierarchical Resource Allocation Scheme Based on Nash Bargaining Game in VANET
## 2 Hierarchical Resource Allocation Scheme Based on Nash Bargaining Game
### The Formulation of Hierarchical Resource Allocation Scheme in VANET
#### 2.2.1 Resources Allocation Scheme for RSUs in the First Layer  
Different RSUs share the centralized spectrum resources of central cloud resources pool, the first layer of the hierarchical resource allocation scheme is the problem of allocating spectrum resources to RSUs from the central cloud. We assume that \(K=\{1,2,...,k\}\) is the set of RSUs, the spectrum resource requirements of the \(k\)th RSU is \(b_{k}\). According to Shannon theory [PERSON] (1948), we use the transmission rate \(R_{k}\) to represent the benefit function of each RSU  
\[R_{k}=b_{k}\text{log}_{2}(1+c_{1}\frac{\bar{P}_{k}\bar{G}_{k}}{\sigma^{2}}) \tag{2}\]  
where \(\sigma^{2}\) is the white Gaussian noise, \(\bar{P}_{k}\) and \(\bar{G}_{k}\) represent the transmission power and channel gain of the \(k\)th RSU, respectively. \(c_{1}\) is the modulation factor of orthogonal amplitude modulation [PERSON] (1948), which can be denoted as  
\[c_{1}=c_{2}In(\frac{c_{3}}{BER_{k}}) \tag{3}\]  
where \(c_{2}=1.5\), \(c_{3}=0.2\). \(\text{BER}_{k}\) is the maximum error rate that the \(k\)th RSU can tolerate. According to the definition of NBS, the cooperative game problem of the first layer centralized resource allocation can be expressed as \(F(\mathbf{R},\mathbf{R}^{min})\). \(\mathbf{R}\) is a set of benefits that each RSU gets when participating in the game. The minimum \(\mathbf{R}^{min}=(R_{1}^{min},R_{2}^{min},...,R_{k}^{min})\) is the disagreement point. We assume the total spectrum resources of the central cloud is \(B^{sum}\), the Nash bargaining game problem can be formulated as  
\[\begin{array}{ll}\text{max}&f_{1}(\mathbf{b})=\prod\limits_{k=1}^{K}\left(R _{k}(b_{k})-R_{k}^{min}\right)\\ s.t.&\text{C1}:~{}~{}R_{k}(b_{k})\geq R_{k}^{\text{min}}\\ &\text{C2}:~{}~{}\sum\limits_{k=1}^{K}b_{k}\leq B^{sum}\\ &\text{C3}:~{}~{}b_{k}\geq 0\end{array} \tag{4}\]  
\(f_{1}(\mathbf{b})\) is the target function for resource allocation at the first layer. \(\mathbf{b}\) is the spectrum resources vector assigned to each RSU, which is \((b_{1},b_{2},...,b_{k})\). The first constraint \(C_{1}\) in Formula (4) is used to guarantee the existence of the optimal allocation vector. The second constraint \(C_{2}\) indicates that the number of spectrum resources shared by RSUs cannot exceed the total spectrum resources in central cloud. According to the properties of logarithmic functions and Lagrange multiplier method, the Lagrange function form of this spectrum allocation problem can be formulated as  
\[L_{1}(\mathbf{b},\lambda)=\ln\left(f_{1}(\mathbf{b})\right)-\lambda\left( \sum\
olimits_{k=1}^{K}b_{k}-B^{sum}\right) \tag{5}\]  
\(\lambda\) is lagrangian multiplier, according to the definition of the KKT condition [PERSON] (1955), Formula (5) should satisfy the following three conditions  
\[\left\{\begin{array}{l}\partial L_{1}(b,\lambda)/\partial b_{k}=0\\ \lambda\left(\sum\
olimits_{k=1}^{K}b_{k}-B^{sum}\right)=0\\ \lambda\geq 0\end{array}\right. \tag{6}\]  
After formula derivation, we can get \(b_{k}\) and \(\lambda\)  
\[b_{k}=\frac{1}{\lambda}+\frac{R_{k}^{min}}{\gamma_{k}} \tag{7}\]\[\lambda=\frac{\gamma_{k}}{b_{k}\gamma_{k}-R_{k}^{min}} \tag{8}\]  
in Formula (7), \(\gamma_{k}=\text{log}_{2}\left(1+c_{1}\frac{\bar{R}_{k}\bar{C}_{k}}{\sigma^{2}}\right)\). From Formula (6), due to \(\lambda\) is a nonnegative variable, we can find that \(\sum_{k=1}^{K}b_{k}-B^{sum}=0\). Hence, through formula derivation and calculation, the optimal spectrum resources allocated to the \(k\)th RSU can be obtained  
\[b_{k}^{*}=\frac{1}{K}\left(B^{sum}-\sum_{k=1}^{K}\frac{R_{k}^{min}}{\gamma_{k} }\right)+\frac{R_{k}^{min}}{\gamma_{k}} \tag{9}\]  
After completing the spectrum resources allocation for RSUs in the first layer, we need to continue to study the allocation of spectrum resources for VUEs within the coverage of RSUs.