# An Efficient Resource Allocation Algorithm for Device-To-Device Communications
## 1 Introduction  
Mobile communication networks are moving toward lower energy consumption, greater resource utilization, and higher network capacity. In order to meet the above requirements, device-to-device (D2D) communication technology has emerged [1; 2; 3; 4; 5]. Traditional cellular network users need to forward data through the base station to communicate, and D2D users can perform direct communication at close range. Therefore, compared with cellular communication, D2D communication has a smaller communication delay, which can improve the spectrum efficiency and achieve higher throughput and energy efficiency by multiplexing the spectrum resources of cellular users [6; 7; 8; 9]. Since multiplexing cellular spectrum resources can cause serious interference between cellular communication andD2D communication [10], a large amount of research work uses resource allocation to mitigate interference [11; 12; 13; 14]. Some possible variations of the allocation algorithm are TCP analysis, proportional fairness, and out-of-band communications which deal with different mobility patterns. Reference [15] proposed a resource allocation algorithm based on local search, which can only obtain local optimal solutions. Reference [16] proposes a distributed resource allocation algorithm but does not explicitly provide the performance gain obtained compared to other algorithms. Reference [17] proposed an interference-aware resource allocation algorithm based on the backpack theory, but in many cases, the algorithm cannot get a feasible allocation result. In reference [18], resources are first allocated to D2D users, and then resources are allocated to cellular users according to the allocation of D2D users on each resource block. However, in practice, cellular users are generally required to communicate first, so cellular users are proportional. Fair weight requires changes to weight and reduces fairness. The one-to-one Gale-Shapley algorithm (delayed acceptance algorithm) proposed by [PERSON] and [PERSON] was originally applied to reasonably solve the marriage matching problem between men and women so that a reasonable match between men and women is achieved [19]. Reference [20] proposed a stable matching scheme based on a delay acceptance algorithm to allocate resources for D2D users, but the scheme has the following shortcomings:  
1. Establishing a user's preference list based on distance is not the best option;
2. It does not take into account the limitations of cellular subscriber quality when assigning resources to cellular users at one time;
3. Only one D2D pair is allowed to share the spectrum resources of one cellular user, so as the number of D2D users increases, the spectrum utilization cannot be improved;
4. The simulation environment only considers a single-cell cellular network and does not consider the case of heterogeneous cellular networks. In this paper, the algorithm in reference [20] is improved for these four shortcomings, and a resource allocation scheme based on the many-to-one Gale-Shapley algorithm in a heterogeneous cellular network environment is proposed. The contributions of the proposed algorithm are enumerated as follow:  
* It effectively solves the resource allocation shortcomings of D2D users multiplexed with cellular user channels in heterogeneous cellular network environments. * The algorithm allows multiple D2D users to share the channel resources of one cellular user and ensures the quality of service (QoS) of the cellular users and D2D users by setting the signal to interference and noise ratio (SINR) threshold, in order to improve the utilization of the wireless spectrum. * A D2D user and channel preference list are established based on the implemented system capacity to maximize the system total capacity objective function. * The KM algorithm is used to allocate channels for D2D clusters to maximize the total capacity of D2D users [21].