### Online Service Time Allocation Method  
Problem P2 is a quadratic programming problem with a constraint that is not a separable inequality. Therefore, we may use a projected subgradient method to obtain the solution. However, ref. [23] showed that the convergence time of a subgradient method with a constant step size is \(O(1/\epsilon)\), where \(0<\epsilon\ll 1\) is the difference between the termination point and the optimal point. Thus, the time complexity of the subgradient method is \(O(|N|/\epsilon)\), which may be too long for online decisions. Therefore, in this section, we propose a heuristic algorithm that determines \(\Omega(t)\) in \(O(|N|)\) time at the beginning of each time slot and is optimal while the sum of the determined \(\alpha_{i}(t)\)s is not larger than \(1\). Let us denote \(g_{i}(t)=b_{i}(t)^{2}-(2Q_{i}(t)^{2}+2w_{i}(t)^{2}+Z_{i}(t)-V\kappa f_{mes}^{ 2})b_{i}(t)\) and ignore Constraint (23). Because \(\min(\sum_{i\in N}g_{i}(t))\geq\sum_{i\in N}\min(g_{i}(t))\), we can obtain a solution to Problem P2 by finding an \(\alpha_{i}(t)\) that satisfies \(\frac{\partial g_{i}(t)}{\partial\alpha_{i}(t)}=0\) for all \(i\in N\). As \(b_{i}(t)=\alpha_{i}(t)\tau f_{mes}\), \(\frac{\partial g_{i}(t)}{\partial a_{i}(t)}=2\tau^{2}f_{mes}^{2}\alpha_{i}(t)- \tau f_{mes}(2Q_{i}(t)+2w_{i}(t)+Z_{i}(t)-V\kappa f_{mes}^{2})\). Therefore, if we denote an \(\alpha_{i}(t)\) that minimizes \(\partial g_{i}(t)/\partial a_{i}(t)\) as \(x_{i}(t)\), it becomes  
\[x_{i}(t)=\frac{2Q_{i}(t)+2w_{i}(t)+Z_{i}(t)-V\kappa f_{mes}^{2}}{2\tau f_{mes }}. \tag{24}\]  
A MES must decide \(\alpha_{i}(t)\)s at the start of each time slot. However, \(x_{i}(t)\) involves \(w_{i}(t)\), which a MES knows only at the end of the time slot \(t\). To resolve this, we adopted an LSTM model to predict \(w_{i}(t)\) at the beginning of a time slot \(t\). To train the LSTM model for each queue, a MES measures the workload imposed during each time slot. At the start of each time slot \(k\), a MES maintains \(h\) past workload arrival histories \(h_{i}(k)=\{w_{i}(k-h),\ldots,w_{i}(k-1)\}\) for each queue \(i\) and feeds \(h_{i}(k)\) to the LSTM model to obtain \(\hat{w}_{i}(k)\) as its output. Because a MES can measure \(w_{i}(k)\) at the end of time slot \(k\), it updates the LSTM model using \((w_{i}(k)-\hat{w}_{i}(k))^{2}\) as the loss function. Once a MES finishes training the LSTM model, it uses the model to predict the amount of workload that will be imposed on each queue during a time slot \(t\) at the beginning of time slot \(t\). Specifically, at the start of a time slot \(t\), a MES feeds \((w_{i}(t-h),\ldots,w_{i}(t-1))\) to the LSTM and obtains \(\hat{w}_{i}(t)\) as the workload to be imposed on the queue \(i\) during time slot \(t\). By replacing \(w_{i}(t)\) with \(\hat{w}_{i}(t)\) in Equation (24), we obtain:  
\[\hat{x}_{i}(t)=\frac{2Q_{i}(t)+2\hat{w}_{i}(t)+Z_{i}(t)-V\kappa f_{mes}^{2}}{2 \tau f_{mes}}. \tag{25}\]Let us denote the fraction of time that a MES allocates to each queue during a time slot \(t\) as \(\alpha_{i}^{*}(t)\). Because \(0\leq\alpha_{i}(t)\leq 1\), when \(\sum_{i\in N}\alpha_{i}^{*}(t)\leq 1\), \(\alpha_{i}^{*}(t)\) is determined as follows. \[\alpha_{i}^{*}(t)= \begin{cases}1,&1\leq\hat{x}_{i}(t)\\ \hat{x}_{i}(t),&0<\hat{x}_{i}(t)<1\\ 0,&\hat{x}_{i}(t)\leq 0\end{cases}  \tag{26}\]  
If \(\sum_{i\in N}\alpha_{i}^{*}(t)>1\), then the optimal solution to P2 is outside the space defined by the constraint in Equation (23). That is, because the workload imposed on queue \(i\) (i.e., \(Q_{i}(t)+w_{i}(t)\)) is temporarily larger than the capacity of a MES, a MES cannot make \(Q_{i}(t+1)<\delta_{i}\). Because the MES resource is insufficient to handle the total workload imposed on it, we adjust the fraction of time assigned to each queue in proportion to \(\alpha_{i}^{*}(t)\)s in Equation (26).