## 4 Proposed Antenna Codebook and MAB Approach
### Proposed Nested Two-Stage MAB Approach
#### 4.2.1 Proposed Nested Two-Stage TS Algorithm
These values become 94.3%, 86%, and 71.7% when \(K=64\), where the number of alternative beam pairs is highly increased. As TS is a Bayesian-based approach, its performance is still near the optimal one, while the performance of the other two schemes is highly degraded compared to the case of \(K=4\). Figure 3 shows the spectral efficiency of the schemes involved in the comparison at 80% blockage, where it simulates a harsh blockage environment. In this context, four paths out of the five channel paths between BS and RIS and between RIS and UE undergo blockage, including the LoS path. Compared to Figure 2, more than 50% decrease in spectral efficiency occurs in this harsh blockage environment compared to the zero blockage case. This is due to the low power received from the only surviving path out of the five paths. Despite this harsh blockage environment, the proposed two-stage MAB algorithms still show good spectral efficiency performance against the optimal one. Yet, the proposed two-stage TS outperforms other schemes due to the aforementioned reason. At \(K=4\), about 98.6%, 95.7%, and 72% of the optimal performance are obtained by the proposed nested two-stage TS, UCB, and random selection, respectively. These values become 95.35%, 84.4%, and 58.3% at \(K=64\), respectively. By comparing these ratios with those given in the previous paragraph and shown in Figure 2, it is clearly shown that the performance of random PS selection is highly degraded compared to the optimal performance due to the blockage effect. However, the proposed two-stage MAB algorithms almost have the same ratios of the optimal performance even in this harsh blockage environment. Figure 2: Spectral efficiency against the used number of beams when \(M=N=K\) at zero blockage. This means that the proposed algorithm can efficiently withstand the blockage effect due to its hypothesis of maximizing the achievable spectral efficiency irrespective of the environmental conditions. Figures 4 and 5 show the spectral efficiency performance of the compared schemes against the number of PS vectors (\(K\)) while \(M\) and \(N\) are different and fixed, where \(N=36\) and \(M=64\), at zero and 80% blockage, respectively. Again, the spectral efficiencies of all compared schemes are decreased under harsh blockage effect. By comparing Figure 4 with Figures 2 and 5 with Figure 3, the spectral efficiencies of \(K=4\), \(16\), and \(36\) in Figures 4 and 5 are slightly higher than those represented in Figures 2 and 3, respectively. However, the spectral efficiencies of \(K=49\) and \(64\) in Figures 4 and 5 are less than those given in Figures 2 and 3 due to the use of a lower number of antenna elements at both BS and RIS. Typically, the half-power beamwidth is inversely proportional to the used number of antenna elements. Thus, increasing the number of antenna elements for generating the same codebook pattern, i.e., the same number of beams, has two opposite effects. On one hand, it generates narrower beams with larger antenna gains [12; 13], and on the other hand, it is more vulnerable to phase shift errors. This increases the gain loss at the maximum gain [12] due to the increase in the interbeam null angles [13]. This is the reason why spectral efficiency is not highly increased when increasing the used number of antenna elements for generating the same number of PS vectors. Interested readers can check the detailed analysis given in [12; 13] in this regard. Still, the proposed nested two-stage TS has the best performance that nearly matches the optimal performance due to the prementioned reasoning. At \(K=4\) and zero (80%) blockage, about 99% (97.4%), 97.5% (92%), and 83.5% (63.6%) of the optimal performance are obtained by the proposed nested two-stage TS, UCB, and random selection, respectively. These values become 97% (95%), 87% (87%), and 74.5% (61%) when \(K=64\), respectively. Again, the random selection is highly affected by the blockage effect more than the proposed nested two-stage MAB schemes.