# Social-Aware-Based Resource Allocation for NOMA-Enhanced D2D Communications
## 3 Social-Aware-Based Resource Allocation
### Optimization Model  
After D2D clusters have been formed, users in the cell are divided into five categories: (1) cellular users whose channel resources can be reused by D2D users, (2) D2D content requesters in D2D clusters, (3) D2D content providers in D2D clusters, (4) D2D content requesters who failed to find a D2D content provider and can only request BS for content files via traditional cellular communication, and (5) unselected D2D content providers. Assume that each cellular user is assigned with a dedicated channel. A D2D cluster can only reuse one cellular channel while each cellular channel can be reused by multiple D2D clusters. Therefore, the signal received by BS on the cellular channel \(SC_{m}\) can be defined as  
\[y_{m}=\sqrt{P_{c}}g_{m,B}x_{m}+\sum\
olimits_{m}\sum\
olimits_{k}\eta_{m,n} \mu_{n,k}\sqrt{P_{d}^{k}}g_{k,B}x_{k}+\zeta_{m} \tag{2}\]  
where \(P_{c}\) and \(P_{d}^{k}\) represent the transmit power of the cellular user and the D2D content provider. \(g_{m,B}\) and \(g_{k,B}\) are the channel gain between cellular user \(C_{m}\) and BS and D2D content provider \(DT_{k}\) and BS, respectively. \(\eta_{m,n}\) indicates whether D2D cluster \(D_{n}\) reuse cellular channel \(SC_{m}\), i.e., \(SC_{m}\) is reused by \(D_{n}\), \(\eta_{m,n}=1\); otherwise \(\eta_{m,n}=0\). \(\mu_{n,k}\) indicates whether \(DT_{k}\) belongs to \(D_{n}\), i.e., \(DT_{k}\) belongs to \(D_{n}\), \(\mu_{n,k}=1\); otherwise \(\mu_{n,k}=0\). \(x_{m}\) and \(x_{k}\) are the signals sent by \(C_{m}\) and \(DT_{k}\). \(\zeta_{m}\) denotes the additive white Gaussian noise (AWGN) on \(SC_{m}\). Hence, the signal-to-interference-plus-noise-ratio (SINR) and data rate of \(C_{m}\) are defined as  
\[\gamma_{m}=\frac{P_{c}g_{m,B}}{\sum\
olimits_{n}\sum\
olimits_{k}\eta_{m,n} \mu_{n,k}P_{d}^{k}g_{k,B}+\sigma^{2}} \tag{3}\]  
\[R_{m}=\log_{2}(1+\gamma_{m}) \tag{4}\]  
where \(\sigma^{2}\) represents the noise power. Considering that multiple D2D content providers send files to the D2D content requester simultaneously with NOMA in D2D clusters, the signal received by the D2D content requester can be defined as  
\[y_{n}=\sum\
olimits_{k}\mu_{n,k}\sqrt{P_{d}^{k}}g_{n,k}x_{k}+\sum\
olimits_{ m^{\prime}}\sum\
olimits_{k^{\prime}}\rho_{n,n^{\prime}}\sqrt{P_{d}^{k^{\prime}}}g _{n,k^{\prime}}x_{k^{\prime}}+\sqrt{P_{c}}g_{m,n}x_{m}+\zeta_{n} \tag{5}\]  
where \(g_{n,k}\) and \(g_{m,n}\) are the channel gain between \(DT_{k}\) and D2D content provider \(DR_{n}\), \(C_{m}\), and \(DR_{n}\). \(\rho_{n,n^{\prime}}\) represents whether \(D_{n}\) and \(D_{n^{\prime}}\) use the same cellular channel, i.e., \(D_{n}\) and \(D_{n^{\prime}}\) use the same cellular channel, \(\rho_{n,n^{\prime}}=1\); otherwise \(\rho_{n,n^{\prime}}=0\). \(\zeta_{n}\) represents the AWGN at \(DR_{n}\). Using SIC in NOMA, the optimal decoding order is the descending order of channel gain. Therefore, the SINR and data rate of D2D content provider \(DT_{k}\) in D2D cluster \(D_{n}\) can be defined as  
\[\gamma_{d}^{k}=\frac{P_{d}^{k}g_{n,k}}{\sum\limits_{k^{\prime} \in D_{n}}P_{d}^{k^{\prime}}g_{n,k^{\prime}}+\sum\
olimits_{n^{\prime}}\sum \
olimits_{k^{\prime\prime}}\rho_{n,n^{\prime}}\mu_{n^{\prime},k^{\prime\prime }}P_{d  
\[\mu_{n,k}\in\{0,1\}\quad\forall n,k \tag{14}\] \[\rho_{n,n^{\prime}}\in\{0,1\}\quad\forall n\] (15) \[0\leq P_{d}^{k}\leq P_{\max}\quad\forall k \tag{16}\]  
where Equation (8) is the optimization goal we set to maximize the sum rate of all D2D content providers in D2D clusters. Constraint (9) limits the interference D2D users cause to cellular users and ensures the cellular users' QoS. Constraint (10) ensures the D2D users' QoS. Constraint (11) indicates \(\eta_{m,n}\) should be either 1 or 0, representing whether reusing \(SC_{\rm m}\). Constraint (12) represents each D2D cluster can be assigned with one cellular channel. Constraint (13) represents each cellular channel can be reused by no more than \(w\) D2D clusters in order to reduce interference on cellular channels and decrease computational complexity.