## 4 Interference-Aware Subcarrier Allocation for mMTC Communication Algorithm
Thus, the mMTC pairs in the interference range of \(MU_{j}\) cannot access the same subcarrier with \(MU_{j}\) to avoid interference. In other words, when mMTC pair \(MU_{j}\) accesses subcarrier \(i\), the other pairs within the interference range of \(MU_{j}\) cannot access subcarrier \(i\) to reduce the interference between the mMTC pairs and to ensure the QoS of each mMTC pair. The IASA algorithm is summarized in Algorithm 1. Lines 1-5 of the algorithm calculate the maximum interference that all subcarriers can support (line 3) and the proportion of the interference from each mMTC pair (line 5). Then a two-dimensional matrix is formed. Lines 6-12 of the algorithm sort the data in the two-dimensional matrix in ascending order one-dimensionally. Firstly, we find the mMTC pair and subcarrier corresponding to the minimum interference ratio. Then we estimate whether the accumulated interference caused by the mMTC pair exceeds the maximum interference allowed by the subcarrier so as to determine whether the mMTC pair can access the sub-carrier (line 7). After the mMTC pair \(MU_{j}\) accesses subcarrier \(i\), the mMTC pair within the interference range of \(MU_{j}\) is prohibited from accessing subcarrier \(i\) (line 9). The IASA algorithm is a centralized algorithm that can be implemented by a centralized controller. First, the centralized controller collects the information from mMTC devices who want to transmit packets with their neighborhood devices, including the channel state information and the required transmission rate. Then the centralized controller obtains the spectrum allocation results according to the IASA algorithm and broadcasts the allocation results to each mMTC pair. Then each mMTC transmitter completes the packets transmission on its allocated subcarrier. ```
1:Initialize: \(B\), \(P_{i}^{c}\), \(P_{j}^{d}\), \(R_{cu_{\_}min}^{i}\), \(R_{j}\), \(\alpha_{ij}=0\)\(\forall i\in\mathcal{N},j\in\mathcal{M}\). 2:Calculate \(I_{cu_{\_}max}^{i}\), \(i\in\mathcal{N}\) in accordance with (11). 3:Calculate the interference \(I_{\_}{j,B}\) caused by all mMTC pairs accessing subcarriers according to (10c). 4:Calculate the proportion of all mMTC pairs to the maximum interference that each subcarrier can withstand \(I_{\_}{cu_{\_}max}^{i}\) and obtain the interference matrix \(\Omega\). 5:Select the smallest element \((i^{*},j^{*})\) in matrix \(\Omega\). For \(CU_{\_}i^{*}\), \(MU_{\_}j^{*}\), judge whether (9) and (14) is established. 6:If \(I_{\_}{cu}^{i}\leq I_{\_}{cu_{\_}max}^{i}\), the mMTC pair is allowed to access subcarriers, \(\alpha_{\_}{ij}=1\). 7:If \(I_{\_}{cu}^{i}>I_{\_}{cu_{\_}max}^{i}\), the mMTC pair is not allowed to access the subcarrier, \(\alpha_{\_}{ij}=0\). 8:\(\alpha_{\_}{ij}=0,\forall i^{\prime}\in\mathcal{N},i^{\prime}\
eq i\). 9:Filter out the mMTC pair set \(\boldsymbol{J}\) within the pair \(MU_{\_}j\) interference range. Assign all the \(\alpha_{\_}{ij}\quad j\in\boldsymbol{J}\) corresponding to subcarrier \(i\) to 0. 10: Assign the ratio \(\Omega(:,j)\) of the mMTC pair to the corresponding subcarrier in this cycle to \(s(s\geq 1)\). 11:Repeat 6-9 until all of the mMTC pairs have been assigned. 12:Output matrix \(\boldsymbol{A}\). ```  
**Algorithm 1** Interference-Aware Spectrum Allocation for mMTC Communication Algorithm.