# 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.2 Resources Allocation for VUEs in the Second Layer
It is not consistent with the actual situation. In order to solve the above problems, we firstly construct the matching degree index between VUEs and RSUs. The evaluation of matching degree index is based on computing the L-dimensional Euclidean distance between services features offers and demands, where L is the number of services features. We use binary variables \(SF_{l,o}^{k,i}\) to represent whether the \(l\)th services feature can be provided to \(i\)th VUEs by the \(k\)th RSU, such as low-latency, low-jitter and high-throughput. The value of \(SF_{l,o}^{k,i}\) is 1, which indicates that the \(k\)th RSU can provide the \(i\)th VUEs with the \(l\)th services feature. The value of \(SF_{l,o}^{k,i}\) is 0, which indicates that the \(k\)th RSU can not provide the \(i\)th VUEs with the \(l\)th services feature. On the other hand, we use binary variables \(SF_{l,d}^{k,i}\) to represent whether the \(l\)th services feature will be demanded by the \(i\)th VUEs from the \(k\)th RSU. The value of \(SF_{l,d}^{k,i}\) is 1, which indicates that the \(l\)th services feature will be demanded by \(i\)th VUEs. To facilitate analysis, we use the variable \(D_{i}^{k}\) to represent the ability of the \(k\)th RSU providing service features for the \(i\)th VUE  
\[D_{i}^{k}=\sum\limits_{l=1}^{L}\left|SF_{l,d}^{k,i}-SF_{l,o}^{k,i}\right| \tag{12}\]  
Obviously, as the value of \(D_{i}^{k}\) gradually increases, the ability of the \(k\)th RSU providing service features for the \(i\)th VUEs becomes worse. Therefore, we use exponential function to build the matching degree index between RSUs and VUEs. The matching degree index between the \(i\)th VUE and the \(k\)th RSU can be formulated as  
\[\alpha_{i}^{k}=\beta_{k}e^{-\sqrt{\sum\limits_{l=1}^{L}\omega_{l}\left(SF_{l,d}^{k,i}-SF_{l,o}^{k,i}\right)^{2}}} \tag{13}\]  
where \(\omega_{l}\) is the normalized weight, \(\beta_{k}\in[0,1]\) is a reputation parameter of the \(k\)th RSU, which is related to services features provided in the past. Thereafter, considering the matching degree index between VUEs and RSUs, Equation (11) can be transformed into \[ \begin{split}\max\;\;f_{3}(\mathbf{c}^{k},\mathbf{p}^{k})=\prod\limits_{ i=1}^{N_{k}}\left(a_{k}^{k}\sum\limits_{j=1}^{\frac{c^{k}_{i}}{a_{ij}}}w_{k}^{0}\text{log}_{2} \left(1+\eta\frac{p_{i,j}|\mathcal{S}_{ij}|^{2}d_{i,j}^{-\beta}}{\sigma^{2}} \right)-r_{i}^{min}\right)\\ s.t.\;\;\text{C4}:\;\sum\limits_{j=1}^{c^{k}_{i}}w_{k}^{0}\text{ log}_{2}\left(1+\eta\frac{p_{ij}|\mathcal{S}_{ij}|^{2}d_{i,j}^{-\beta}}{\sigma^{2}} \right)\geq r_{i}^{min}\\ C5:\;\sum\limits_{i=1}^{N_{k}}\sum\limits_{j=1}^{c^{k}_{i}}p_{i,j }\leq p^{max}\\ C6:\;\sum\limits_{i=1}^{N_{k}}c^{k}_{i}\leq C^{k}\\ C7:\;c^{k}_{i}\in{}^{+},\;\;p_{i,j}\in\text{R}^{+}\\ C8:\;P^{k}_{i}=\sum\limits_{j=1}^{c^{k}_{i}}p^{k}_{i,j}\\ C9:\;a_{i,j}\in\{0,1\}\\ C10:\;a^{k}_{i}\in[0,1]\end{split}  \tag{14}\]  
The NBS optimization problem in formulation 14 is a mixed integer nonlinear programming problem (MINLP), which is NP-hard. In order to reduce the computation complexity, we adopt the time-sharing relaxation [22] to transform the MINLP problem into a nonlinear real-number programming problem. We introduce allocation time variable \(\tau_{i}^{k}\), which means the fraction of time when VUE \(i\) occupies the all subchannels of the \(k\)th RSU. Now, the optimization problem 14 can be transformed into two sub-problems: optimal power allocation and optimal time allocation. we assume that \(\tau_{i}^{k}\in[0,1]\) represents the time length occupied by the \(i\)th VUE in the \(k\)th RSU. We assume \(h_{i,j}=\frac{|\mathcal{S}_{ij}|^{2}\cdot d_{i,j}^{-\beta}}{\sigma^{2}}\). Then, the optimization problem can be formulated as  
\[\begin{split}\max\;\;f_{4}(\mathbf{r}^{k},\mathbf{p}^{k})=\prod \limits_{i=1}^{N_{k}}\left(\tau_{i}^{k}\cdot a_{i}^{k}\sum\limits_{j=1}^{c^{k }_{i  
The Lagrangian multiplier vector is \(\theta=\{\theta_{1},\theta_{2},...,\theta_{N_{k}}\}\). According to KKT conditions, the following conditions must be satisfied  
\[\left\{