## 3 Methodology
### Size and Extraction of the Traffic Datasets  
Four hundred and thirty-four traffic datasets were collected under different heterogeneous conditions. From seven road sites on the South Africa Road network, all these road sites are connected to the N1 route, the busiest on the South Africa Road network. The traffic datasets were collected from these seven sites with the aid of various traffic collection equipment. Fourteen different traffic flow parameters were identified from these traffic datasets. These traffic parameters are crucial in understanding the traffic flow patterns of the South Africa Road network. Five traffic flow periods were identified based on the period from the traffic datasets. The five traffic flow periods are identified based on the traffic volume experienced on these roads depending on the day's specific time. These periods are either off-peak or on-peak, depending on the time during the day. The periods are classified as 1, 2, 3, 4, 5 in this research; this is explained further in Section 3.9. Fourteen of these parameters were used as inputs and output during the artificial neural network-particle swarm optimization modelling. The traffic flow parameters identified in these seven road sites are shown in Table 2:  
Figure 2: An aerial drone image of the Allandale interchange. * **Traffic density:** This is the number of vehicles per unit length. It is calculated as:  
\[\text{Traffic density}=\frac{\text{Number of vehicles}}{\text{length}} \tag{1}\]  
* **Traffic volume:** This is the number of vehicles depending on a specific period. \begin{table}
\begin{tabular}{c c} \hline \hline
**Input Variables** & **Output Variables** \\ \hline Traffic density & Traffic Volume \\ Number of light vehicles & \\ The average speed of light vehicles & \\ Time of day of light vehicles & \\ The average speed of a long truck & \\ Time of day of long truck & \\ Number of long trucks & \\ The average speed of a medium truck & \\ Time of day of medium truck & \\ Number of medium trucks & \\ Number of short trucks & \\ The average speed of a short truck & \\ Time of day of short truck & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Categorization of the traffic datasets into inputs and output. Figure 3: An illustrative description of the N1 (the red line) route through the South Africa Road transportation network. Traffic volume = \(\dfrac{\text{Number of vehicles}}{\text{time}}\) (2)
* **The number of short/medium/long trucks:** This is the overall total number of different types of trucks on a specific road depending on the time of the day and traffic volume. * **The number of light vehicles:** This is the overall total number of different types of light vehicles on a specific road network considering the period of the day and traffic volume. * **Time of day of light vehicles or short/medium/long trucks:** This parameter is dependent on the speed of the vehicles or truck and the distance of the specific road site. For example, the road sites used as a case study in this research study have their distance. Its mathematical expression is; \[\text{speed}=\dfrac{\text{distance}}{\text{time}}\text{ therefore, time}=\dfrac{\text{distance}}{\text{speed}}\] (3)
* **The average speed of light vehicles or short/medium/long trucks:** This is the speed of the vehicles on the road at a specific period. Each road has its speed limit. The road sites used for this study all have a speed limit of 120 km/h. The South African Ministry of transportation classified different vehicles into Class 1, Class 2, Class 3, or Class 4. Light vehicles are usually classified as Class 1. In contrast, trucks are classified between Class 2 to Class 4 depending on each truck's number of axles.