## 4 Proposed Algorithm
### RRH Switching Operation and SINR-Based User Association  
We propose an RRH switching operation with mobility prediction and SINR-based user association. The mobility prediction is based on a \(k\)-order Markov algorithm consisting of the following steps [13]:1. The trajectory \(T_{d}\) is organized for each UE consisting of a list of serving RRHs at regular intervals, where \(T_{d}\) is the \(d^{\text{th}}\) day's history (\(1\leq d\leq D\)); the trajectory \(T_{d}\) is then divided into time intervals \(t\).
2. The RRH that appears most frequently in each interval is selected as a representative RRH and a representative history is developed. The latest \(k\) representative RRHs are considered, indicated as \(pattern_{k}\), where \(1\leq k\leq t\), and a \(pattern_{s}\) is created by combining with all RRHs, where \(s\in\text{S}\).
3. The probability of appearance in the next interval \(P(pattern_{s})\) is calculated for each \(pattern_{s}\): \[P(pattern_{s})=S^{\frac{\theta_{s}}{|T_{d}|}}\times\frac{N_{pattern_{s}}}{N_ {pattern_{k}}},\] (9) where \(|T_{d}|\) is the size of the trajectory, \(\theta_{s}\) is the number of occurrences of RRH \(s\) in the trajectory \(T_{d}\), \(N_{patterns_{s}}\) is the number of \(pattern_{s}\)'s occurrences in the history, and \(N_{pattern_{k}}\) is the number of \(pattern_{k}\)'s occurrences in the history.
4. The RRH \(s\) with the highest probability \(P(pattern_{s})\) is used as the next serving RRH s for the UE \(u\); the predicted RRH \(\widetilde{s}\) corresponds to RRH \(s\).  
Based on the results of the mobility prediction, the RRH switching operation is performed. In order to increase the proportion of UEs served at the optimal RRHs, RRH \(s\) with the largest \(\rho_{\widetilde{s}}\) is deactivated among the activated RRHs, where \(\rho_{\widetilde{s}}\) represents an influence on UEs served when RRH \(s\) is switched off. If an RRH \(s\) with a large \(\rho_{\widetilde{s}}\) is switched off, fewer UEs are served by a suboptimal RRH as fewer UEs are reassociated. It can be expressed as:  
\[\rho_{\widetilde{s}}=\frac{\lambda_{\widetilde{s}}}{\sum_{u=1}^{U}b_{u}^{ \widetilde{s}}}, \tag{10}\]  
where \(\lambda_{\widetilde{s}}\) is the inverse of the minimum resource block load in RRH \(\widetilde{s}\), expressed as:  
\[\lambda_{\widetilde{s}}=\left(\frac{\sum_{u=1}^{U}b_{u}^{\widetilde{s}}\gamma _{u}}{RB}\right)^{-1}, \tag{11}\]  
where \(\gamma_{u}\) is the minimum number of resource blocks to provide the data rate requirement to UE \(u\)[18]; \(\gamma_{u}\) can be calculated as:  
\[\gamma_{u}=\left\lceil\frac{d_{u}}{B\log_{2}(1+SINR_{u}^{\widetilde{s}})} \right\rceil, \tag{12}\]  
where \(d_{u}\) is the minimum required data rate of UE \(u\). After the RRH switching operation, a reassociation is performed. The proposed algorithm is summarized in Algorithm 1.  
```
1: calculate \(EE\) using Equation (\(\mathcal{T}\)); set \(EE_{curr}=EE\) and \(EE_{prev}=0\)
2: calculate \(P(pattern_{s})\) for all RRH \(s\) using Equation (9)
3: calculate \(\rho_{s}\) for all RRH \(s\) using Equation (10)
4: while \(EE_{curr}>EE_{prev}\) do
5: set \(EE_{prev}=EE_{curr}\)
6: if \(\sum_{u=1}^{U}\gamma_{u}>RB\), \(\forall s\) then
7: deactivate the activated RRH \(s\) that has the largest \(\rho_{\widetilde{s}}\)
8: else
9: activate the deactivated RRH \(s\) that has the smallest \(\rho_{\widetilde{s}}\)
10: end if
11: do user association for all UE \(u\) with an active RRH providing the highest SINR
12: calculate \(EE_{curr}\) using Equation (7)
13: end while
14: solve Equation (8) using Algorithm 2
15: calculate \(EE\) using Equation (7)
```  
**Algorithm 1**RRH switching operation with mobility prediction and SINR-based user association.