# An Efficient Resource Allocation Algorithm for Device-To-Device Communications
## 2 System Model and Problem Planning  
### System Model  
This paper studies the resource allocation problem of D2D users multiplexing the uplink channel of heterogeneous cellular networks. Assuming that the total number of channels is \(\mathbf{N}\), the macro cellular user channel can only be multiplexed by one micro cell user, but can be reused by multiple D2D users, assuming users of one Microcell or D2D users can only multiplex one channel resource. In the heterogeneous cellular network shown in Figure 1, there are three communication mode users and two base stations, and the macro base station is located in the cell center, and the micro cell base station is randomly distributed in the cell by the Poisson point process with density \(\lambda_{s}\), and the cellular user and D2D users are randomly distributed in the cell by the Poisson point process with density \(\lambda_{c}\) and \(\lambda_{d}\), respectively. Each base station can acquire channel state information (CSI) of each communication link. The set \(M=\{1,2,\ldots,C\}\), \(W=\{1,2,\ldots,J\}\), \(H=\{1,2,\ldots,D\}\) represent the macrocell user set, the microcell user set and the D2D user set, respectively. According to the reference [17; 18], the path loss model is shown in Equation (1). \[P_{L}=36.7\log(d)+22.7+26\log(f_{c}) \tag{1}\]  
where \(d\) represents the distance between the transmitter and the receiver (in m), while \(f_{c}\) is the carrier frequency. The channel gain is composed of path loss and small-scale fading, so the channel gain can be expressed as Equation (2). \[G^{a,b}=P_{L}^{a,b}h^{a,b} \tag{2}\]  
where \(P_{L}^{a,b}\) and \(h^{a,b}\) represent the path loss and small-scale fading coefficient between \(a\) and \(b\), respectively. Figure 1: Proposed System Model. In order to study the most severe interference, it is assumed that all \(N\) channel resources are occupied by \(P\) macro cell users [22; 23; 24; 25; 26]. If a macro cell user can only occupy one channel, then \(N=C\). \(J\) microcell users and \(D\) D2D users respectively multiplex these \(N\) channel resources. When the binary variables \(X_{c}^{n}\), \(X_{j}^{n}\) and \(X_{d}^{n}\) are 1, the macro cell user \(c\), the micro cell user \(j\) and the D2D user \(d\) use channel \(n\), otherwise 0. The macrocell user \(c\) has a SINR on channel \(n\) which is given by:  
\[SINR_{c}^{n}=\frac{Pc^{c}G^{c,B}}{\sum_{j\in W}X_{j}^{nPj}G^{j,B}+\sum_{d\in H }X_{d}^{nPd}G^{d,B}+N_{0}} \tag{3}\]  
where \(Pc^{c}\) is the transmit power of the macro cell user \(c\); \(P^{d}\) and \(P^{j}\) are the transmit power of the D2D user \(d\) and the microcell user \(j\); \(G^{c,B}\) is the channel gain of the macro cell user \(c\) to the macro base station \(B\); \(G^{j,B}\) is the channel gain of the microcell user \(j\) to the macro base station \(B\); \(G^{d,B}\) is the channel gain of the D2D user \(d\) to the macro base station \(B\); \(N_{0}\) is the noise power. The SINR of the microcell user \(j\) on channel \(n\) is:  
\[SINR_{j}^{n}=\frac{p^{j}G^{j,b_{j}}}{\sum_{c\in M}X_{c}^{n}Pc^{c,b_{j}}+\sum_{d \in H}X_{d}^{nPd}G^{d,b_{j}}+N_{0}} \tag{4}\]  
where \(b_{j}\) is a microcell base station to which the microcell user \(j\) accesses; \(G^{j,b_{j}}\) is the channel gain of the microcell user \(j\) to the microcell base station \(b_{j}\); \(G^{d,b_{j}}\) is the channel gain of the macro cell user \(c\) to the microcell base station \(b_{j}\); \(G^{d,b_{j}}\) is the channel gain between the D2D user \(d\) and the microcell base station \(b_{j}\). When multiple D2D users multiplex the same channel resource, D2D users are not only interfered with by macro cell users and micro cell users but also interfered with by other D2D users on this channel, so D2D users \(d\) are on channel \(n\).