## 4 Interference-Aware Subcarrier Allocation for mMTC Communication Algorithm  
According to the constraint condition (10b), the accumulated interference allowed by the eMBB device \(CU_{i}\) can be derived from the minimum transmission rate \(R_{cu\_min}^{i}\)  
\[I_{cu\_max}^{i}=\frac{P_{i}^{c}\left|g_{i,B}\right|^{2}}{2^{R_{cu\_min}^{i}}-1 }-\sigma_{0}^{2}B. \tag{11}\]  
When the \(j\)th mMTC pair \(MU_{j}\) occupies the subcarrier \(i\), the interference caused by \(MU_{j}\) to the base station is  
\[I_{j,B}=P_{j}^{d}\left|h_{j,B}\right|^{2}. \tag{12}\]  
To ensure the rate requirement of the eMBB device, the interference caused by the mMTC pair \(MU_{j}\) should not exceed the maximum interference allowed by the subcarrier \(i\), i.e.,  
\[I_{j,B}\leq I_{cu\_max}^{i}. \tag{13}\]  
Therefore, a set of mMTC pairs allowed to occupy subcarrier \(i\) can be selected according to Equation (13). For all mMTC pairs that can be accessed, we first define the normalized interference caused by each pair as \(I_{j,i}=I_{j,B}/I_{cu\_max}^{i}\). Define the interference matrix as  
\[\Omega=\left[ \begin{array}{cccc}I_{1}^{1}&I_{2}^{1}&\cdots&I_{M}^{1}\\ I_{1}^{2}&I_{2}^{2}&\cdots&I_{M}^{2}\\ \vdots&\vdots&\cdots&\vdots\\ I_{1}^{N}&I_{2}^{N}&\cdots&I_{M}^{N}\end{array} \right].\]  
When the mMTC pair \(MU_{j^{\prime}},j^{\prime}\
eq j\), attempts to access the subcarrier \(i\), the following two conditions should be satisfied. 1. The interference caused by \(MU_{j^{\prime}}\) and the total interference of mMTC pairs cannot exceed the maximum interference allowed by subcarrier \(i\), i.e., \(I_{cu\_max}^{i}\). 2. All of the accessed mMTC pairs should satisfy their own QoS. When both conditions are satisfied, the mMTC pair is allowed to access the subcarrier. In order to facilitate the calculation, we convert the rate constraint of the eMBB device in (11) into an interference limit:  
\[l_{cu}^{i}\leq l_{cu\_max}^{i}, \tag{14}\]  
where  
\[l_{cu}^{i}=\sum_{j\in M}I_{j,B}\quad\forall i\in\mathcal{N}. \tag{15}\]  
Substituting (14) for (11), then the optimization problem is converted into  
\[\max_{\alpha_{ij}}\sum_{i=1}^{N}\sum_{j=1}^{M}\alpha_{ij}\, \tag{16a}\] \[s.t I_{cu}^{i}\leq l_{cu\_max}^{i}\,\] (16b) \[R_{j}\geq R_{j\_min}\,\] (16c) \[\alpha_{ij}\in\{0,1\},\quad\forall i\in\mathcal{N}\quad j\in \mathcal{M}\,\] (16d) \[\sum_{i=1}^{N}\alpha_{ij}\leq 1\quad\forall j\in\mathcal{M}. \tag{16e}\]  
The optimization variables of this problem are all binary variables, and the optimization problem (16a) is an NP-hard problem that cannot be solved by the convex optimization method. The traditional way to solve an NP-hard problem is to carry out an exhaustive search, which involves unaccepted computational complexity. Thus, it is difficult to obtain the optimal result by direct solution. This paper proposes a heuristic algorithm with lower complexity to tackle the problem, referred to as interference-aware subcarrier allocation for mMTC. Firstly, the mMTC pair with minimal interference to the base station is selected in the two-dimensional matrix \(\Omega\), and the access conditions (16b) and (16c) are updated according to the QoS of the eMBB devices and other mMTC pairs. Once an mMTC pair occupies a subcarrier, the mMTC pair is prohibited from accessing other subcarriers. When the sum of the interference ratio accumulated on subcarrier \(i\) is not less than 1, other mMTC pairs will be no longer allowed to access the subcarrier \(i\). For the constraint condition (16c), we can estimate whether the QoS requirements are still satisfied after each mMTC pair occupies the subcarrier according to (7) and (9). Due to the interference between mMTC pairs accessing the same channel, the interference range of the mMTC pair is defined in this paper to suppress interference between mMTC pairs. The interference range of an mMTC pair \(MU_{j}\) is defined as the range in which the mMTC pairs suffer from the interference of \(MU_{j}\).