# RIS-Assisted Network Slicing Resource Optimization Algorithm for Coexistence of eMBB and URLLC
## 3 Problem Formulation
### URLLC Allocation Problem  
The goal of the problem is to maximize the reception rate of URLLC packets and minimize the amount of eMBB rate loss while ensuring QoS for eMBB users and URLLC packet rate requirements. Assume that all incoming URLLC packets have the same size, denoted by \(i\). \(L_{m}\) is the number of packets of URLLC at mini-slot \(m\). \(I_{e,j}^{m}\) means the number of RBs punctured from eMBB user \(e\) and assigned to URLLC packet \(l\) at mini-slot \(m\). The URLLC packet \(l\) arriving at mini-slot \(m\) must be completely and successfully transmitted to the relevant URLLC user. The expression for the QoS constraint for URLLC is as follows:  
\[I_{l}^{m}r_{l}(I_{l}^{m},\Phi^{m})\geq c_{th} \tag{12}\]  
where \(I_{l}^{m}=\sum_{e=1}^{E}I_{e,l}^{m}\). \(r_{l}\) denotes the achievable rate per RB of URLLC packet \(l\), and the expression is referred to Equation (4). \(\Phi^{m}\) is the RIS phase shift matrix at mini-slot \(m\). Let \(c_{th}=\frac{i}{\pi}\). In addition, it should be ensured that the QoS of eMBB is not degraded while accessing URLLC packets. The instantaneous achievable rate for eMBB user \(e\) is expressed as:  
\[r_{e}^{\prime}=(1-\frac{I_{e}^{m}}{\hat{b}_{e}})r_{e} \tag{13}\]where \(I_{e}^{m}=\sum_{l=1}^{L^{m}}I_{e,l}^{m}\) denotes the total number of RBs punctured from eMBB user \(e\) at mini-slot \(m\). \(\hat{b}_{e}\) denotes the number of RBs that eMBB user \(e\) has after RB allocation. The QoS of eMBB can be expressed by the minimum data rate \(r_{th}\)[18], and it needs to be ensured that the eMBB losses due to puncturing the eMBB RB and designing the RIS phase shift matrix do not violate the eMBB rate requirement \(r_{th}\). The expression is as follows:  
\[r_{e}^{\prime}\geq r_{e,th} \tag{14}\]  
\[r_{e,th}=\frac{Mr_{th}}{\hat{b}_{e}}-\left(\sum_{i}^{m-1}r_{e}^{\prime i}+(M-m) r_{e}\right)\]  
The number of URLLC packets received at mini-slot \(m\) can be expressed as:  
\[f_{1}(\mathbf{k}^{m})=\sum_{l=1}^{L^{m}}k_{l}^{m} \tag{15}\]  
where \(\mathbf{k}^{m}=[k_{1}^{m},\cdots,k_{L^{m}}^{m}]^{T}\) is a \(L^{m}\times\)1 binary vector. The binary variable \(k_{l}^{m}\in\{0,1\}\) is the receipt indicator of the URLLC packet, \(k_{l}^{m}=1\) if the URLLC packet \(l\) is received, and \(k_{l}^{m}=0\) otherwise. The reception rate of the URLLC is denoted by \(\eta=\frac{\sum_{l=1}^{M}L^{m}}{\sum_{l=1}^{M}L^{m}}\), where \(\hat{L}^{m}\) denotes the total number of URLLC packets successfully served at each mini-slot \(m\). Let \(\beta_{e}^{m}\in\{0,1\}\) denotes the weight of the URLLC load assigned to eMBB user \(e\) at mini-slot \(m\). Let \(\mathbf{I}^{m}=\left(I_{e,l}^{m}\right)_{1<e<E,1<l<L^{m}}\). Then, the total traffic loss of eMBB can be expressed as:  
\[f_{2}(\mathbf{I}^{m})=\sum_{e=1}^{E}I_{e}^{m}\beta_{e}^{m} \tag{16}\]  
Based on the above, the URLLC allocation problem involves optimizing the power and frequency resource allocation and the RIS phase shift matrix. The URLLC allocation problem at the mini-slot \(m\) is represented as follows:  
\[P2:\max_{\mathbf{\Phi}^{m},\mathbf{P}_{L}^{m},\mathbf{k}^{m}}[f_{1}(\mathbf{k }^{m}),-f_{2}(\mathbf{I}^{m})] \tag{17}\]  
\[s.t.I_{l}^{m}c_{l}\geq k_{l}^{m}c_{th},\forall l\in L^{m} \tag{18}\]  
\[r^{\prime}\geq r_{e,th},\forall e\in E \tag{19}\]  
\[0\leq P_{l}^{m}\leq P_{l}^{m,max},\forall l\in L^{m},\forall m\in M \tag{20}\]  
\[r_{e}^{\prime}=(1-\frac{I_{e}^{m}}{\hat{b}_{e}})r_{e} \tag{13}\]0  
\[r_{e}^{\prime}=(1-\frac{I_{e}^{m}}{\hat{b}_{e}})r_{e} \tag{13}\]1  
\[r_{e}^{\prime}=(1-\frac{I_{e}^{m}}{\hat{b}_{e}})r_{e} \tag{13}\]2  
\[r_{e}^{\prime}=(1-\frac{I_{e}^{m}}{\hat{b}_{e}})r_{e} \tag{13}\]3  
where \(P_{l}^{m}\) denotes the transmission power of URLLC packet \(l\) at mini-slot \(m\) and \(\mathbf{P}_{L}^{m}=[P_{1}^{m},\cdots,P_{L^{m}}^{m}]^{T}\). \(P_{l}^{m,max}\) represents the maximum transmission power of URLLC. Constraints (18) and (19) denote the QoS of the URLLC and eMBB, respectively. Constraint (20) indicates that the transmission power does not exceed the maximum.