# Table 3 Location-based algorithm

Location-based algorithm
1. Initialization: Randomly distribute CUEs and D2D pairs in a cell and calculate their distances to the center of the BS. Determine the value of r 0 between 0 and the radius of the cell
2. Divide users into four groups according to r 0, ACUE, AD2D, BCUE, and BD2D
3. In area A or B, users randomly constitute clusters (the clustering in area B must satisfy the distance criterion), and each cluster consists of two CUE users and two D2D pairs
4. For each RB
5.        Randomly choose a cluster in the cell and determine whether it is in area A or B
6.        Calculate the large-scale loss in this cluster
7.               Case user to BS: 128.1 + 37.6 * log 10(d[km])
8.               Case user to user: 148 + 40 * log 10(d[km])
9.        Set the initial transmit power according to area A or B: P C1, P C2, P D1, P D2
10.        Do
11.             For each subcarrier (SC)
12.                   Generate small-scale loss H: multiplex Gaussian with zero mean unit variance
13.                   If cluster in area A
14.                       Interference Alignment - Equations (20)-(26), (42)-(47)
15.                   Else cluster in area B
16.                       Multiplex Scheme - Equations (1)-(16)
17.                   End if
18.        End SC
19.        Calculate SINR in this RB: Equations (27) to (30) for IA
20.                                                            Equations (17) and (18)for Multiplex;
21.        While SINR does not meet the target, Power Control, then jump 10
22. End each RB
23. Calculate sum throughput