## 4 Proposed Antenna Codebook and MAB Approach
### Proposed Nested Two-Stage MAB Approach
#### 4.2.1 Proposed Nested Two-Stage TS Algorithm
\[PERSON]}\) matrix corresponding to this index, i.e., \(\mathbf{\[PERSON]}_{i^{*}_{t}}\), is obtained. Afterward, its corresponding reward \(\psi_{\mathbf{\[PERSON]}_{i^{*}_{t}}f_{i}}\) is achieved, and its model parameters \(Z_{\mathbf{\[PERSON]}_{i}f_{i-1}^{*}}\),\(\overline{\psi}_{\mathbf{\[PERSON]}_{i};f_{i-1}^{\prime}}\), and \(\sigma^{2}_{\overline{\psi}_{i};f_{i-1}^{\prime}}\) are updated for its posterior distribution as given in Algorithm 1, where the methodology presented in [33] is used for updating \(\overline{\psi}_{\mathbf{\[PERSON]}_{i};f_{i-1}^{\prime}}\) and \(\sigma^{2}_{\mathbf{\[PERSON]}_{i};f_{i-1}^{\prime}}\).

In the second stage TS and based on \(\mathbf{\[PERSON]}_{i}\) coming from the first stage, a value of \(f_{i}^{\prime}\) is adjusted, and its corresponding reward \(\psi_{\mathbf{\[PERSON]}_{i};f_{i}^{\prime}}\) is obtained. In this procedure, random samples \(\tau_{\mathbf{\[PERSON]}_{i};f_{i-1}}\sim\mathcal{N}\bigg{(}\overline{\psi}_{\mathbf{\[PERSON]} _{i};f_{i-1}},\sigma^{2}_{\mathbf{\[PERSON]}_{i};f_{i-1}}\bigg{)}\), \(1\leq j\leq|\mathcal{F}|\), are taken, and the index \(j_{t}^{*}\) corresponding to the maximum sample value is chosen as follows:

\[j_{t}^{*}=\text{arg max}_{j}\Big{(}\tau_{\mathbf{\[PERSON]}_{i};f_{i-1}} \Big{)}, \tag{11}\]0 Spectral efficiency against TX SNR when \(N=36\), \(M=64\), and \(K=16\) at zero blockage. the proposed nested two-stage TS, nested two-stage UCB, and the scheme proposed in [30] compared to the random performance against TX SNR. For fair comparisons, we used the same simulation parameters given in [30], i.e., \(N=48\), \(M=100\), and \(K=6\), and the same TX SNR values. As shown by this figure, the spectral efficiency ratio of the proposed nested two-stage TS has the best performance. In addition, both MAB schemes outperform the scheme presented in [30]. At SNR = \(-25\) dB, the spectral efficiency ratios of the proposed nested two-stage TS, nested two-stage UCB, and the scheme given in [30] become 5.5, 4.8, and 4, respectively. This means that about 37.5% and 20% improvements in spectral efficiency performance are obtained by the proposed MAB schemes over the scheme presented in [30]. This comes without any need for knowing the CSI of both mmWave BS and RIS. The complexity analysis clearly shows that the proposed nested two-stage MAB scheme has low BT and computational complexities compared to the optimal solution. This is because the optimal strategy explores all available \(\{\mathcal{R},\mathcal{F}\}\) pairs, which obtains its BT and computational complexities of order \(\mathcal{O}(|\mathcal{R}||\mathcal{F}|)\). However, in the proposed MAB approach, the sets \(\mathcal{R}\) and \(\mathcal{F}\) are explored alternatively at every time \(t\). Thus, the BT complexity of the proposed schemes is of order \(\mathcal{O}(1)\). Regarding the computational complexities, for the proposed nested two-stage TS, the primary source of computational complexity comes from sampling a 1-dimensional Gaussian random variable and updating its related parameters with the complexity of \(\mathcal{O}(|\mathcal{R}|+|\mathcal{F}|+1)\). In addition, the computational complexity of the proposed nested two-stage UCB comes from selecting the optimal PS and updating its corresponding parameters with the same computational complexity order of \(\mathcal{O}(|\mathcal{R}|+|\mathcal{F}|+1)\). For example, when \(|\mathcal{F}|=36\) and \(|\mathcal{R}|=64\), the BT and computational complexities of the optimal solution are of order \(\mathcal{O}(2304)\) while the BT and computational complexities of the proposed nested two-stage MAB approach will be \(\mathcal{O}(1)\) and \(\mathcal{O}(101)\), respectively. This means that about 99.96% and 96% reductions in BT and computational complexities are obtained, respectively. Consequently, the proposed nested two-stage MAB approach has a near-optimal performance with much lower complexity. ## 6 Conclusions

In this paper, we have explored RIS-assisted mmWave communications.