## 6 Testing and Measuring Performance: Analysis of PSO, GWO, and Hybrid PSO-GWO Methods
### Particle Swarm Optimization: Testing and Performance
#### Evaluation and Update:  
In the provided PSO code for optimizing traffic light schedules, the evaluation step calculates how well each proposed solution (traffic light priorities) performs. Initially, the algorithm converts continuous parameter values into discrete priorities by rounding them. The objective function then loads traffic data, splitting them into training and testing sets to evaluate performance. Although the traffic simulation function currently uses a placeholder value, its purpose is to simulate traffic movement based on priorities and then return a measure of precision. The fitness score is computed by negating the results of traffic movement, aligning with PSO's minimization approach wherein a lower fitness score reflects better performance.  
The update step adjusts each particle's position and velocity based on its performance. Each particle's velocity is updated using a formula that incorporates its previous best position and the global best position, as adjusted by inertia and random factors. This velocity is then used to update the particle's position. After each position update, the fitness of each particle is reassessed. If a particle's new fitness improves upon its personal best, that best is updated, and similarly, the global best is updated if the current particle's fitness surpasses the global best. This iterative process balances the exploration of new solutions and the exploitation of known effective solutions, guiding the swarm towards the optimal traffic light scheduling for maximum precision.  
Table 3 displays the results of the (PSO), showing the priority given to each street and the corresponding objective performance value, which shows the best traffic flow achieved during the optimization process.  
Street1 Priority (3.186): Street1 is given the highest priority, indicating that it receives more green time than other streets, possibly due to a higher volume of traffic.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**PSO Parameters** & **Parameter** \\ \hline Swarm size & 30 \\ Max. iterations & 100 \\ \hline \hline \end{tabular}
\end{table}
Table 2: PSO parameters, including the number of particles and maximum number of iterations.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Street1 Priority** & **Street2 Priority** & **Street3 Priority** & **Street4 Priority** & **Best Objective Function Value** \\ \hline
3.186235526 & 1.68914334 & 1.174185322 & 3.914581563 & 0.998103677 \\ \hline \hline \end{tabular}
\end{table}
Table 3: PSO evaluation.  
Street2 Priority (1.689): Street2 has a low priority, meaning it has less green light time, indicating less traffic.  
Street3 Priority (1.174): Street3 receives the lowest priority, indicating that it has the smallest volume of traffic.  
Street4 Priority (3.914): Street4 has the highest priority, indicating that it experiences heavy traffic and needs more green light time.  
Best objective performance value (0.998): this value represents the closest solution found by PSO, with a value close to 1 indicating that the optimization system has successfully balanced traffic between all four routes.