# A Hierarchical Resource Allocation Scheme Based on Nash Bargaining Game in VANET
## 3 Algorithm Simulation and Results Analysis
### Simulation Results
Therefore, when researching the resource allocation scheme of the VUE layer, we must consider the matching degree between VUEs and RSUs. Figure 6 shows the effect of the communication distance between VUEs and RSUs. When the communication distance between each VUE and RSUs is the same, the transmission time slot size obtained by each VUE is determined by the minimum transmission rate requirements of each VUE. Therefore, VUE3 will be allocated to the maximum transmission time slots, which has the maximum transmission rate requirements for requesting the video services. In addition, as the distance between VUE3 and RSU increases gradually, in order to meet the minimum rate demand of VUE3, the transmission time slot size allocated to VUE3 must increase at the same time. On the contrary, the transmission time slots allocated to VUE1 and VUE2 will be reduced appropriately. The rate reduction can be accepted by these VUEs because their rates are still greater than their minimum rates requirements. Therefore, proposed scheme can achieve fair and reasonable allocation of resources according to the minimum needs of VUEs. Figure 4: The spectrum allocation results of RSUs vary with the minimum rate requirements of RSU1. Figure 5: Spectrum resources obtained by RSUs under different distribution schemes. Thereafter, we compare the effectiveness of proposed hierarchical resource allocation scheme with other resource allocation schemes, such as equal distribution scheme and throughput maximum scheme. To prove the advantages of our proposed scheme, we study the trend of VUE3's transmission rate when the distance between VUE3 and RSU3 increases gradually. In Figure 7, when the distance between VUE3 and RSU3 increases gradually, the path loss of data transmission also increases. Therefore, the transmission rate of the VUE3 will decrease gradually in these three resource allocation schemes. When the distance between VUE3 and RSU3 is greater than 180m, the transmission rate of the VUE3 will be lower than 1 Mbps in equal distribution scheme and throughput maximum scheme. That means the minimum rate requirements of VUE3 cannot be guaranteed. However, in our proposed scheme, when the distance between the VUE3 and the RSU3 is greater than 180 m, the minimum rate demand of the VUE3 can still be met. We evaluate the performance of the proposed method in guaranteeing the fairness of VUEs. The fairness index \(\phi\) can be mathematically defined as [24]  
\[\phi=\frac{\left(\sum\limits_{i=1}^{N}{(r_{i}/r_{i}^{\min}))}^{2}}{(N\cdot( \sum\limits_{i=1}^{N}{(r_{i}/r_{i}^{\min})^{2})})} \tag{25}\]  
where \(\phi\in(0,1]\). If \(\phi=1\), the ratios of VUEs' rates to the corresponding minimum rate are the same, which implies that the resource allocation is perfectly fair. From Figure 8, we can find that the proposed scheme outperforms the equal distribution scheme and the throughput maximum scheme in fairness. This is because the proposed scheme realizes the dynamic allocation of resources based  
Figure 6: The time fraction allocation of VUEs when VUE3 moves away from the RSU. Figure 7: The comparison between the proposed method with existing methods on effectiveness. on Nash bargaining game. However, in equal distribution scheme, each VUE is assigned the same resources. When the number of VUEs increases, the resources allocated to each VUE decreases. Then, the minimum rate requirements of some VUEs cannot be met. As a result, the fairness index decreases with the number of VUEs. In throughput maximum scheme, it will first satisfy the minimum demand of the VUEs, who have the poor communication condition. Then, more resources will be allocated to the VUEs with better communication condition. However, when the number of VUEs is large enough, in order to maximize system throughput, the minimum demand of the VUEs who have the poor communication condition cannot be met. Therefore, the fairness index begin to drop.