# Optimizing the Quality of Service of Mobile Broadband Networks for a Dense Urban Environment
## 3 Experimental Design
### Optimization Algorithm  
Presented in Algorithm 1 is a representation of the general PSO algorithm. It shows a roadmap to the execution of the algorithm. It can be modified to suit specific problems with objective functions that set relevant variables defining the problem to be solved. PSO adopts an interconnected swarm where every particle is aware of the states of the positions visited by other particles in the swarm. Equations (8) and (9) describe the position and velocity of the individual particles in the swarm. At every iteration, the position and velocities of each particle are updated, giving every particle a sense of the current position and velocity and, thus, the global best position and velocity of the swarm. \[x_{id}\;\left(it+1\right)=x_{id}\left(it\right)+v_{id}\left(it+1\right) \tag{8}\]  
\[ \begin{array}{c}v_{id}\;\left(it+1\right)=v_{id}\left(it\right)+C_{1}\times Rnd (0,\;1)\times\left[pb_{id}\left(it\right)-x_{id}\left(it\right)\right]+C_{2} \times\\ Rnd(0,\;1)\times\left[gb_{d}(it)-x_{id}\left(it\right)\right]\end{array}  \tag{9}\]  
where  
\(i=\) particle's index, specifying the particle to be examined;  
\(d=\) dimension being considered, each particle has a position and a velocity for each dimension;  
\(it=\) describes the iteration number of the process;  
\(x_{id}=\) position of the \(i\)th particle in dimension \(d\);  
\(v_{id}=\) velocity of the \(i\)th particle in dimension \(d\);  
\(C_{1}=\) constant for the cognitive acceleration component;  
\(Rnd=\) stochastic component of the algorithm, a random value between 0 and 1;  
\(pb_{id}=\) a location in dimension d that intercepts with the best locations in the dimension of particle \(i\);  
\(C_{2}=\) constant for the cognitive and social components;  
\(gb_{d}=\) a location in dimension d that intercepts with the visited locations in the dimension of all the particles. ```
1:\(i\): particle's index, specifying the particle to be examined \(d\): dimension being considered \(it\): describes the iteration number of the process \(x_{i}\): position of the ith particle in dimension d \(v_{i}\): velocity of the ith particle in dimension d \(c_{1}\): constant for the cognitive acceleration component \(c_{2}\): stochastic component of the algorithm \(p_{best}\),\(i\): a location in dimension d that intercepts with the best locations in the dimension of the particle \(i\) \(c_{best}\): constant for the cognitive, and social component \(g_{best}\): a location in dimension d that intercepts with the visited locations in the dimension of all the particles \(t\): time of iteration Output:\(g_{best}opt\): Optimized global best positions \(p_{best}opt\): Optimized personal best positions
1.START
2. % Initialize the swarm
3. for\(i=1\) to Population size do
4. % Populate the swarm
5. \(x_{i}\) = random initialization within bounds
6. \(v_{i}\) = random initialization within bounds
7. 8. % Ensure all particles are within the sample size
9. if\(x_{i}>\max\) permissible limit
10. \(x_{i}\) = max permissible limit
11. else if\(x_{i}<\min\) permissible limit
12. \(x_{i}\) = min permissible limit
13. end if
14. 15. % Evaluate the objective function for the current position
16. \(f_{i}\)= objective function (\(x_{i}\))
17. % Initialize the personal best for each particle
19. \(p_{best}i\)= \(x_{i}\)
20. \(f_{best}i\)= \(f_{i}\)
21. % Update the global best if the current particle is better
22. if\(f_{i}<\ f_{best}\)
23. \(g_{best}\)= \(x_{i}\)
24. \(f_{gbest}\)= \(f_{i}\)
25. end if
26. end for
27. 28. % Perform PSO iterations
29. for\(it=1\) to Max iterations do
30. for\(i=1\) to Population size do
31. % Update the velocity and position of each particle
32. \(v_{i}=w\ \times v_{i}\)+\(c_{1}\times\ rand()\times(p_{best}i-x_{i})+c_{2}\times rand()\times(g_{best}-x_{i})\)
33. \(x_{i}=x_{i}+v_{i}\)
34. % Check that optimized results are within max and min permissible limits
35. if\(x_{i}>\max\) permissible limit
36. \(x_{i}=\max\) permissible limit
37. else if\(x_{i}<\min\) permissible limit
39. \(x_{i}=\min\) permissible limit
40. end if
41.