## 4 Proposed Scheme  
### Greedy Heuristic Resource Management Scheme (GHRMS)  
To determine the optimal solution, we discuss a local search-based resource management scheme known as the greedy heuristic resource management scheme (GHRMS). The GHRMS is a well-known method for solving optimization problems [28]. Therefore, the interference induced by CU \(n\) to D2 Dreceiver \(m_{r}\), interference induced by D2D transmitter \(m_{t}\) to eNB, and mutual interference between DPs should be less than a certain threshold level. That is:  
\[G_{n,m_{r}}\leq G_{n,m_{t}}^{Th},\ \forall n\in C,m_{r}\in D, \tag{32}\]  
\[G_{m_{t},B}\leq G_{m_{t},B}^{Th},\ \forall m_{t}\in D, \tag{33}\]  
and  
\[G_{m_{t}^{\prime},m_{r}}\leq G_{m_{t}^{\prime},m_{r}}^{Th},\ \forall m_{t}^{ \prime},m_{r}\in D, \tag{34}\]  
where \(G_{n,m_{r}}=l_{n,m_{r}}^{-\alpha}.|h_{n,m_{r}}|^{2}\) and \(G_{m_{t},B}=l_{m_{t},B}^{-\alpha}.|h_{m_{t},B}|^{2}\) and \(G_{m_{t}^{\prime},m_{r}}=l_{m_{t}^{\prime},m_{r}}^{-\alpha}.|h_{m_{t}^{\prime },m_{r}}|^{2}\). \(G_{n,m_{r}}^{Th}G_{m_{t},B}^{Th}\) and \(G_{m_{t}^{\prime},m_{r}}\) are the predefined threshold channel gains. The pseudo code for the GHRMS is shown in Algorithm 1.  
```
Initialization Step 1: C= Set of CUs Step 2: D= Set of DPs Step 3: X= Set of uplink subcarriers Step 4: F = Resource reuse factor Step 5: U\({}_{k}\ =\ (U_{n},U_{m})\) Resource management Step 6: Obtain all channel information for CUs and DPs Step 7: n=1 Step 8: for each \(n\)\(\epsilon\)\(U_{n}\)do Step 9: for each \(m\)\(\epsilon\)\(U_{m}\)do Step 10: if\(\delta_{m,n_{r}}^{k}=1.\)then Step 11: if\(G_{n,m_{r}}\leq G_{n,m_{r}}^{Th},\ G_{m_{t},B}\leq G_{m_{t},B}^{Th}\) and \(G_{m_{t}^{\prime},m_{r}}\leq G_{m_{t}^{\prime},m_{r}}^{Th}\)then Step 12: Calculate \(Y_{n}^{k}\) and \(\gamma_{m}^{k}\) Step 13: Decline all matching subcarrier assignments and compute the QoS requirements with the current SINR value Step 14: Solve A1 Step 15: else Step 16: Check \(\delta_{m,n}^{k}\) Step 17: Solve the subcarrier assignments problem to obtain the minimum interference solution Step 18: end Step 19: end Step 20: end Step 21: end
```  
**Algorithm 1**Greedy Heuristic Resource Management Scheme.  
In every iteration of the GHRMS, it finds the optimal matching of subcarriers between CUs and DPs to maximize the resource reuse factor \(F\). In this algorithm, in Step 5, we first define \(U_{k}=(U_{n},U_{m})\) as the function of CUs \(U_{n}\) and DPs \(U_{m}\) that introduces the least interference among them. At the initiation of resource management process, the eNB gathers the channel information for all CUs and DPs in a cell (Step 6). From Step 7 to Step 9, starting from \(n\)=1, the algorithm iterates through all CUs. For all \(n\) and \(m\), the GHRMS searches the DPs that can reuse cellular resources. In Step 10, if DPs can reuse CUs resources, then Step 11 presents the benchmarks for selecting the users that can reduce the uplink interference induced due to the integration of D2D communications into the traditional cellular networks. In Step 12, based on the channel conditions, we calculate the SINRs for CUs and DPs. Step 13 declines the remaining matching subcarrier resource assignment and computes the QoS requirements with the current SINRs. In Step 14, we solved the throughput maximization problem with higher resource reuse factor. Else the state of the resource reuse condition is rechecked in Step 16. Finally, in Step 17, we continue the matching for subcarrier resource assignment until the benchmarkis achieved. This procedure is repeated until all subcarrier resources of the CUs have been assigned to DPs. In the GHRMS, the set of DPs included in the previous search for an optimal solution is removed from the remaining search procedures. This step reduces interference and overcomes the complexity of the search procedure.