## 3 Performance Analysis
Then, Algorithm 2 for finding particle and Algorithm 3 for finding state information of BS are carried out, which will be explanted later. Then, the power consumption of BSs is calculated, where the power consumption due to traffic processing is obtained firstly and the power consumption due to state switching is obtained later. The traffic load dependent power consumption of MBS is calculated using Equation (12). Then, the power consumption of MBS is calculated using Equation (11). After that, the traffic load dependent power consumption of SBS is calculated using Equation (10). Then, the power consumption of SBS is obtained using Equation (9). The power consumption due to state switching is calculated using Equation (13). Finally, the total power consumption of BSs is calculated using Equation (1). By comparing the obtained total power consumption with _Pbest_, the values of _Pb_, _Pbest_, and \(v\) are updated. After that, _Pb_ with the best _Pbest_ of all the particles are chosen as the _Gbest_, and then the BS state information is updated. In Algorithm 2, after applying the Equations (16)-(18), association is set depending on the demanded data service type. Then, the best index of BS is extracted using Equation (29). Then, the UE's demand is served by either MBS or SBS. In Algorithm 3, after applying Equations (19) and (20), algorithm shown in Figure 6 is carried out to find the state information of BS. ```
1:Initialize \(a\), \(z\), \(v\), \(p\), Pb, Gb, Pbest, Gbest, \(d\), \(r\), \(w\), \(e\), \(f\), \(s\)
2://\(a\) is n \(\times\)\(m\) + 1 matrix of current association between UE and BS. 3://\(z\) is swarm size. 4://\(v\) is z \(\times\)\(n\)\(\times\)\(m\) + 1 matrix of velocity of particle. 5://\(p\) is z \(\times\)\(n\)\(\times\)\(m\) + 1 matrix of particle of selected association between UE and BS. 6://Pb is z \(\times\)\(n\)\(\times\)\(m\) + 1 of local optimum. 7://\(Gb\) is n \(\times\)\(m\) + 1 matrix of global optimum. 8://\(Pbest\) is 1 \(\times\)\(z\) matrix of fitness value of \(Pb\). 9://\(Gbest\) is the best fitness value of \(Pbest\). 10://\(d\) is 1 \(\times\)\(n\) matrix of the data traffic demand of UE. 11://\(r\) is 1 \(\times\)\(n\) matrix of the type of required data traffic of UE. 12://\(w\) is 1 \(\times\)\(m\) + 1 matrix of on state of BS. 13://\(e\) is 1 \(\times\)\(m\) matrix of sleep state of BS. 14://\(f\) is 1 \(\times\)\(m\) matrix of state transition of SBS between on and off. 15://\(s\) is 1 \(\times\)\(m\) matrix of state transition of SBS between on(off) and sleep. 16:foriteration < PSO_iteration do
17:for\(p\_index\) < \(z\)do
18:// Calculate velocity using the Equations (26) and (27). 19:\(v^{\prime}=1/(1+\exp(wg\times v\)[\(p\_index\),\(:\)] + \(c1\times r1\times(Pb\)[\(p\_index\),\(:\)] - \(a)+c2\times r2\times(Gb-a)))\);
20:// Algorithm 2: Find particle
21:[\(p\)[\(p\_index\),\(:\)], \(w^{\prime}\)] = FindParticle(\(v^{\prime}\), \(d\), \(r\));
22:// Algorithm 3: Find state information of BS
23:[\(e^{\prime}\), \(f\), \(s\)] = FindBSSlateInformation(\(w\), \(e\), \(w^{\prime}\));
24:// Calculate power consumption
25:\(Psmall\) = 0, \(SumSmall\) = 0, \(Pmacro\) = 0, \(Pswitching\) = 0, \(Processing\) = 0;
26:for\(j\) < m+1 do
27:// Calculate power consumption of BS due to traffic processing. 28:if\(j\) == m
29:// Calculate the traffic load dependent power consumption of MBS
30:// using the Equation (12). 31:for\(i\) < n do
32:\(Pmacro\) += \(Plx\_m\) \(\times\)\(d[i]\) \(\times\)\(p\)[\(p\_index\),\(j\)] \(\times\)\((r[i]\) \(\times\)\(Ch\) + \((1-r[i])\) \(\times\)\(Cl)/\(Cmax\_m\);
33:end
```  
**Algorithm 1**PSO Process  
* 34:// Calculate the power consumption of MBS using the Equation (11). * 35:\(Pmacro=Pf\_m+rho\_m\times Pmacro\)
* 36:else
* 37:// Calculate the traffic load dependent power consumption of SBS
* 38:// using the Equation (10). * 39:\(Psmall=0\);
* 40:\(for\)\(i<n\)do
* 41:\(Psmall+=Ptr\_s\times d[i]\times r[p\_index,i,j]\times(r[i]\times Cl+(1-r[i]) \times Cl)/Cmax\_s\);
* 42:end
* 43:// Calculate the power consumption of SBS using the Equation (9).