## 3 Problem Formulation and Algorithm Development
### Algorithm Development  
Algorithm 1 shows the logical operation of the proposed technique for 3D in-building spatial reuse of multi-mmWave spectra in ultra-dense small cells. The algorithm works as follows. At first, the minimum distances between co-channel interferers in both intra-floor and inter-floor levels are estimated subject to satisfying \(I_{\text{optimal,intra}}\) and \(I_{\text{optimal,inter}}\), respectively. Using these values of minimum distances, the size of the 3D cluster of small cells per building and the 3D spatial reuse factor are estimated. Then, the average outdoor macro UE capacity and the average indoor small cell capacity for each of the \(L\) buildings are found, which in turn provides the system-level average capacity, SE, and EE metrics for \(L\) buildings for \(\varepsilon_{\text{RF}}\in[1,4,9,16]\). The SE and EE values for \(L\) buildings are then used to find values of \(L\) that satisfy both \(\sigma_{\text{SE}}^{\text{sys}}(L)\geq\sigma_{\text{SE}}^{\text{6G}}\) and \(\sigma_{\text{EE}}^{\text{sys}}(L)\leq\sigma_{\text{EE}}^{\text{6G}}\) conditions, which result in finding a value of \(L\) that can satisfy both average SE and EE requirements for 6G mobile networks, using the condition \(L_{\text{max}}^{\text{6G}}(\varepsilon_{\text{RF}})=\max\Big{(}L_{\text{SE}} ^{\text{6G}}(\varepsilon_{\text{RF}}),L_{\text{EE}}^{\text{6G}}(\varepsilon_{ \text{RF}})\Big{)}\) for \(\varepsilon_{\text{RF}}\in\{1,4,9,16\}\). ```
1. Input:\(I_{\max,\text{intra}},I_{\max,\text{inter}}\), \(\alpha_{\text{floor}}\Big{(}d_{\text{CCI,inter}}\Big{)}\), \(I_{\text{optimal,intra}},I_{\text{optimal,inter}}\), \(d_{\min},S_{\text{E,total}}\), \(S_{\text{F}},N\), // enter input values
2.\(L\), \(\mathbf{T}\), \(\mathbf{Q}\), \(a\), \(M_{\text{2-GHZ}}\), \(M_{\text{28-GHZ}}\), \(M_{\text{60-GHZ}}\), \(P_{\text{28-GHZ}}\), \(P_{\text{60-GHZ}}\), \(P_{\text{2-GHZ,MC}}\), \(P_{\text{2-GHZ,JC}}\)
3. // start // 3D clustering
4. Estimate\(d_{\text{CCI,intra}}=d_{\min}\times\Big{(}\frac{I_{\max,\text{intra}}}{I_{ \text{optimal,intra}}}\Big{)}^{\frac{1.2799^{+}}{2}}\)
5. Estimate\(d_{\text{CCI,inter}}\geq d_{\min}\times\Big{(}10^{-0.1}\ \alpha_{\text{max}}(d_{\text{CCI,inter}}) \times\Big{(}\frac{I_{\max,\text{inter}}}{I_{\text{optimal,inter}}}\Big{)} \Big{)}^{1.2797^{+}}\)
6. Estimate\(\kappa_{\text{intra}}=\text{ceil}\ \Big{(}d_{\text{CCI,intra}}^{2}+(a/2)/a\Big{)}\)
7. Estimate\(\Theta_{\text{intra}}=\kappa_{\text{intra}}2\) and \(\Theta_{\text{inter}}=\text{ceil}\ \Big{(}d_{\text{CCI,inter}}^{2}/d_{\text{ floor}}\Big{)}\)
8. Estimate\(\Theta_{\text{3D}^{+}}=(\Theta_{\text{intra}}\times\Theta_{\text{inter}})\) and \(\epsilon_{\text{RF}}=S_{\text{F,total}}/\Theta_{\text{3D}^{+}}\)
9. // end // 3D clustering
10. // start // performance metrics estimation
11. Find\(\sigma_{\text{2-GHZ}}=\sum_{t=1}^{Q}\sum_{i=1}^{M_{\text{28-GHZ}}}\sigma_{t_{ i}}\Big{(}\rho_{i,i}\Big{)}\)
12. Find\(\sigma_{\text{28-GHZ}}^{\text{Transceiver 1}}\) and \(\sigma_{\text{60-GHZ}}^{\text{Transceiver 2}}\)
13. Find\(L=1\): \(L_{\max}\)
14. Estimate\(\sigma_{\text{cap}}^{\text{sys}}(L)=\sigma_{\text{2-GHZ}}+\Big{(}L\times \epsilon_{\text{RF}}\times\Big{(}\sigma_{\text{28-GHZ}}^{\text{Transceiver 1}}, \text{3D cluster}^{\text{+}}+\sigma_{\text{60-GHZ}}^{\text{Transceiver 2}}, \text{3D cluster}\Big{)}\Big{)}\)
15. Estimate\(\sigma_{\text{SE}}^{\text{sys}}(L)=\sigma_{\text{Gmp}}^{\text{sys}}(L)/((M_{ \text{2-GHZ}}+M_{\text{28-GHZ}})\times Q)\)
16. Estimate\(\sigma_{\text{EE}}^{\text{sys}}(L)=\Big{(} \begin{array}{c}(L\times S_{ \text{F}}\times(P_{\text{28-GHZ}}+P_{\text{60-GHZ}}))+\\ \Big{(}S_{\text{F}}\times P_{\text{2-GHZ}},\text{FC})+\Big{(}S_{\text{M}} \times P_{\text{2-GHZ}},\text{MC}\Big{)}\end{array} \Big{)}\Big{/}\Big{(} \sigma_{\text{Gmp}}^{\text{sys}}(L)/Q\Big{)}\)
17. End // end // performance metrics estimation
19. // start // performance comparison
20. For\(\epsilon_{\text{RF}}\in\{1,4,9,16\}\)
21. For\(L=1\): \(L_{\max}\)
22. If\(\sigma_{\text{SE}}^{\text{sys}}(L)\geq\sigma_{\text{SE}}^{\text{GG}}\)
23.