# Calibrating Microscopic Traffic Simulation Model Using Connected Vehicle Data and Genetic Algorithm
## 3 Methods
### Optimization and Evaluation Processes  
As presented in the previous subsection, the proposed calibration method requires an evaluation process and optimization. Making the simulation model as close to the ground truth as possible is the main goal of this process. This is accomplished by the process's design, which aims to align the connected vehicles' trajectories in the simulation with those in the real world. Furthermore, comparing these two trajectories is chosen as the main evaluation process in this study. A time-space diagram is created for each connected vehicle in the network to facilitate this comparison. Then, the trajectories from both the real world and the simulation are plotted on this diagram. The area between these two curves in the time-space diagram is defined as the error of the simulation results. Figure 3 illustrates a conceptual time-space diagram with two curves representing hypothetical trajectories from the real world and the simulation in red and green, respectively. The error for this vehicle can be calculated using Equation (1). \[Error=\sum A_{i}=\sum(|S_{j}-C_{j}|) \tag{1}\]  
In Equation (1), \(A_{i}\) represents the area between the two trajectory lines. The total error is considered as the simulation error for each vehicle. Each trajectory is divided into time intervals of 0.1 s to calculate this area. The value of space for the connected vehicle trajectory (\(C_{j}\)) is subtracted from the value of space for the simulation trajectory (\(S_{j}\)). The error is the summation of the absolute values of these differences for each time interval. For every simulation run, the summation of errors for each vehicle represents the total error for that simulation. The optimization algorithm aims to minimize this total error. To optimize the calibration parameters in the VISSIM microsimulation model, a Genetic Algorithm (GA) is employed due to its effectiveness in handling complex optimization problems with multiple parameters and nonlinear relationships. By simultaneously examining several regions of the solution space, GAs conduct a global search, decreasing the possibility of becoming stuck in local minima [30]. Furthermore, the GA is appropriate for complex optimization situations when the objective function is neither convex nor differentiable since they do not require gradient information nor convexity assumptions. It can be efficiently parallelized, as each individual's fitness evaluation is independent. This aligns with the architecture, where multiple clients can run simulations concurrently, enhancing computational efficiency. Previous studies successfully applied GAs for calibrating traffic  
Figure 3: Conceptual time–space diagram. simulation models, demonstrating their effectiveness in finding optimal or near-optimal solutions [8,25]. To reduce the differences between the simulated and actual vehicle trajectories, the GA iteratively changes the parameters in Table 2 within predetermined limits. The objective function of the GA is presented in Equation (2). \[Minimizef(\theta)=\sum_{i=1}^{N}\sum_{t=1}^{T}\lvert(S_{it}(\theta)-C_{it})\rvert \tag{2}\]  
In this equation, all of the calibration parameters used in the VISSIM simulation model are included in the parameter vector \(\theta\), which determines the goal function in this equation, \(f(\theta)\). \(N\) is the number of vehicles, \(T_{i}\) is the number of time points for vehicle \(i\), \(C_{it}\) is the observed coordinates of vehicle \(i\) at time \(t\), and \(S_{it}\) is the simulated coordinates of vehicle \(i\) at time \(t\) as a function of the calibration parameters \(\theta\). The objective function aims to minimize the total simulation error by reducing the discrepancies between the simulated and real-world trajectories of connected vehicles. The function calculates the total error by summing the areas between the trajectory curves of each vehicle in the simulation and its corresponding real-world trajectory.