## 3 Performance Analysis
\[P_{S}^{tx}(j)=P_{S}^{tx,max}\times\sum_{i=0}^{n-1}\left(d_{i}\times a_{j,i} \times\frac{(r_{i}\times C_{h}+(1-r_{i})\times C_{l})}{C_{S}^{max}}\right) \tag{10}\]5  
The value of \(T_{connect}\) is obtained as in Equation (25), where \(T_{c}\) is defined as the time needed to initiate a connection between a UE and a BS. \[P_{S}^{tx}(j)=P_{S}^{tx,max}\times\sum_{i=0}^{n-1}\left(d_{i}\times a_{j,i} \times\frac{(r_{i}\times C_{h}+(1-r_{i})\times C_{l})}{C_{S}^{max}}\right) \tag{10}\]6  
The optimization problem defined in this paper is a mixed integer linear programming since some of the variables in the proposed optimization are restricted to be discrete integer values [66] and the objective function is linear function. The mixed integer linear programming problem considered in this paper does not scale well with the number of binary variables and it has been proven in the literature to be NP-hard [67; 68; 69; 70; 71]. Therefore, the solution of the optimization is obtained by particle swarm optimization, which is one of the most widely-used bio-inspired optimization algorithms [72]. In particle swarm optimization, if the search space is D dimension, the \(i\)-th particle of a swarm is denoted as \(\mathbf{X_{i}}=(\mathbf{x_{i1}},\mathbf{x_{i2}},\mathbf{x_{i3}},\cdots,\mathbf{x_{iD}})\). The velocity of a particle is denoted as \(\mathbf{V_{i}}=(\mathbf{v_{i1}},\mathbf{v_{i2}},\mathbf{v_{i3}},\cdots,\mathbf{v_{iD}})\). The best position visited by the \(i\)-th particle is denoted by \(\mathbf{P_{i}}=(\mathbf{p_{i1}},\mathbf{p_{i2}},\mathbf{p_{i3}},\cdots,\mathbf{p_{iD}})\). In each swarm, the initial value of position X is denoted as \(\mathbf{Pb}\) and the value of the objective function applying \(\mathbf{Pb}\) is defined as \(P_{best}\). In each \(P_{best}\), the next \(P_{best}\) is obtained by using velocity \(\mathbf{V_{i}}=(\mathbf{v_{i1}},\mathbf{v_{i2}},\mathbf{v_{i3}},\cdots,\mathbf{v_{iD}})\), and the value of \(P_{best}\) is updated and stored at \(\mathbf{Pb}\). In each swarm, the best value of \(P_{best}\) is defined as \(G_{best}\), and it is stored in Gb. Equation (26) shows the update of velocity. \[P_{S}^{tx}(j)=P_{S}^{tx,max}\times\sum_{i=0}^{n-1}\left(d_{i}\times a_{j,i} \times\frac{(r_{i}\times C_{h}+(1-r_{i})\times C_{l})}{C_{S}^{max}}\right) \tag{10}\]7  
Since the optimization problem defined in this paper is mixed integer linear programming, discrete particle swarm optimization [69] should be used to obtain the solution. To find new \(\mathbf{Pb}\), the values of \(\mathbf{v}_{k}^{nm}(t+1)\) are normalized using Equation (27):  
\[P_{S}^{tx}(j)=P_{S}^{tx,max}\times\sum_{i=0}^{n-1}\left(d_{i}\times a_{j,i} \times\frac{(r_{i}\times C_{h}+(1-r_{i})\times C_{l})}{C_{S}^{max}}\right) \tag{10}\]8  
Then, \(\mathbf{X}_{k}^{nm}(t+1)\) is defined as in Equation (28):  
\[\mathbf{X}_{k}^{nm}(t+1)= \begin{cases}1,&S\big{(}\mathbf{v}_{k}^{nm}(t+1)\big{)}>rd\\ 0,&\text{otherwise}\end{cases} , \tag{28}\]  
Since the optimization problem of this paper is mixed integer linear programming, Equation (28) is modified as Equation (29):  
\[\mathbf{X}_{k}^{nm}(t+1)= \begin{cases}1,&S\big{(}\mathbf{v}_{k}^{nm}(t+1)\big{)}>rd \text{ andmax}\big{(}S\big{(}\mathbf{v}_{k}^{nm}(t+1)\big{)}\big{)}\\ 0,&\text{otherwise}\end{cases} , \tag{29}\]  
Since the formulated optimization is NP-hard, we propose a PSO-based heuristic, as shown in the following Algorithms 1-3. In Algorithm 1, PSO algorithm is applied to the formulated optimization and Algorithms 2 and 3 are used within the operation of Algorithm 1. In Algorithm 1, initially, a number of matrices, i.e., \(a,\)\(x,\)\(v,\)\(p,\)\(Pb,\)\(Gb,\)\(Pbest,\)\(Gbest,\)\(d,\)\(r,\)\(w,e,\)\(f\), and \(s\) are defined and initialized, where the definition and the size of each matrix is given in the Algorithm 1. Then, for a given PSO iteration, optimal BS state information is obtained for each swarm. To this end, the velocity of the particle is calculated using Equations (26) and (27).