## 6 Testing and Measuring Performance: Analysis of PSO, GWO, and Hybrid PSO-GWO Methods
### Hybrid PSO and GWO: Testing and Performance Initialization:  
Swarm setup involved initializing a set of candidate traffic light schedules (particles) with random positions (schedules) and velocities (rate of change) for PSO and random positions for GWO. The parameters of priorities were set to ensure that each street received a priority value of between 1 and 4. In this application of PSO-GWO to the control of traffic signals, our goal was to optimize the priority assigned to each street at a four-way intersection. Table 7 shows the limits of the PSO-GWO optimization process, and Table 8 shows its parameters. We also set parameters for both PSO and GWO, including the number of particles/wolves and iteration limits. **Fitness Function:** \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.3149 & 2.6364 & 4 & 1.2937 & 0.99889 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: GWO evaluation. \begin{table}
\begin{tabular}{c c} \hline \hline
**PSO and GWO Lower/Upper Bounds** & **Range** \\ \hline Lower bound (each street needs at least priority 1) & [1, 1, 1, 1] \\ Upper bound (each street can have at most priority 4) & [4, 4, 4, 4] \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Lower and upper bounds of GWO initial parameters. \begin{table}
\begin{tabular}{c c} \hline \hline
**Swarm Size (PSO) and (GWO)** & **30** \\ \hline Max. iterations & 100 \\ Number of swarms and wolves & 30 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: PSO-GWO parameters: number of swarms and wolves and iteration limits. The fitness function evaluates how well a given set of parameters (or traffic light schedules) perform in optimizing traffic movement and reducing delays. The ultimate aim is to minimize traffic congestion and improve the overall precision with which traffic is managed. The parameters of the fitness function define how each traffic light operates (i.e., the duration of its green, yellow, and red phases). **Evaluation and Update:**  
Evaluation (hybrid approach): The evaluation step calculates how well each proposed solution (i.e., each traffic light's priority) performs. Initially, the algorithm converts continuous parameter values to discrete priorities by rounding. The objective function loads traffic data, splits them into training and testing sets, and evaluates performance. The traffic simulation function uses these priorities to simulate traffic movement, later returning a measure of precision. The fitness score is computed by negating the traffic movement result, which aligns with PSO's and GWO's minimization of the objective function. Update (hybrid approach): the update step combines PSO and GWO strategies to adjust the particles' positions and velocities as well as the wolves' positions, based on their performance. PSO update: 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 updates the particle's position. GWO update: For each wolf, new positions are calculated based on the alpha, beta, and delta wolves' positions. The new positions are then bounded within previously defined limits. The best wolf's position is updated if the new position yields a better fitness value. This iterative process balances the search for new solutions and the use of existing effective solutions, guiding the algorithm to the best traffic light schedule for optimal accuracy. The algorithm terminates when there is no further improvement in health or when the mean is reached. Table 9 displays the PSO-GWO results, showing the priority allocated to each street and the corresponding objective performance value, which represents the optimal traffic flow achieved during the process. Street1 Priority (3.912): Street1 is assigned a high priority, indicating a need for more green light time, likely due to heavy traffic.