## 4 Traffic Data
### Obtaining Demand Information  
Based on the traffic on each road segment, we had to calculate the entering, leaving, and passing--_e,_\(l\), and \(p\) in the second indices, respectively--traffic on each driveway. We modeled the traffic situation with m driveways, which is one more than the number of measurement points. There are driveways between each measurement point and an entering and a leaving driveway at the end and beginning of the road segment. Thus, we have m + 1 driveways and m measurement points. We formulated the problem using linear equations. The problem was solved for x with an optimizer tool. The x values represent the number of entering, passing, and leaving vehicles In each intersection, as denoted by its indices, respectively. The t values on the equation's right hand represent the number of passing vehicles on the measurement points. This was known based on real-world measurements. The A matrix on the left-hand side of Equation (1) has three main sections (Figure 5). Figure 4: The road model contains alternating driveways and measurement points. On driveways, entering, leaving, and passing vehicles are modeled. The first section represents that the number of entering and passing vehicles after a driveway equals the number of vehicles in the next measurement point. Due to the long sampling period (1 h), the effect of vehicles that are among the measurement points at the end or beginning of the sample period on the simulation result is negligible. The right-hand side of the matrix represents the measured traffic values after the ith driveway. Naturally, on the last measurement point, there are no entering and passing vehicles; thus, the related number on the right hand is 0. The second section represents that the number of leaving and passing vehicles on a driveway equals the number of vehicles on the preceding measurement point. Naturally, on the first measurement point, there are no leaving and passing vehicles; thus, the corresponding number on the right hand is 0. The third section (last four rows) represents that the first driveway is modeled in a way that it has only leaving vehicles; thus, the number of passing and entering vehicles is 0. The last driveway only has leaving vehicles, so the number of passing and entering vehicles is 0. \[ \begin{bmatrix}110&\dots&000&\dots&000\\ \vdots&&\ddots&&\vdots\\ 000&\dots&110&\dots&000\\ \vdots&&\ddots&&\vdots\\ 000&\dots&000&\dots&110\\ 011&\dots&000&\dots&000\\ \vdots&&\ddots&&\vdots\\ 000&\dots&011&\dots&000\\ \vdots&&\ddots&&\vdots\\ 000&\dots&000&\dots&011\\ 010&\dots&000&\dots&000\\ 001&\dots&000&\dots&000\\ 000&\dots&000&\dots&100\\ 000&\dots&000&\dots&010\\ \end{bmatrix} \quad\times\quad \begin{bmatrix}x_{1,e}\\ x_{1,p}\\ x_{1,l}\\ \vdots\\ x_{i,e}\\ x_{i,l}\\ x_{i,p}\\ x_{i,l}\\ \vdots\\ x_{m+1,e}\\ x_{m+1,p}\\ x_{m+1,l}\\ \end{bmatrix} = \begin{bmatrix}t_{0}\\ \vdots\\ t_{i}\\ \vdots\\ t_{m}\\ 0\\ t_{0}\\ \vdots\\ t_{m}\\ 0\\ 0\\ 0\\ \end{bmatrix}  \tag{1}\]  
Here, the following constraints apply:  
\[\underline{\Delta}\times\bar{x}=\bar{t} \tag{2}\]  
\[x_{i}\geq 0\forall i \tag{3}\]  
Figure 5: Explanation diagram for the first and second sections of the matrix equation. \[\text{{So that}}\min\left\{\sum_{i}\left(\underline{A_{i}}\times\underline{x_{i}}- \underline{t_{i}}\right)^{2}\right\} \tag{4}\]  
Naturally, constraint (2) was applied. Constraint (3) defines that each x must be larger or equal to 0, meaning that the number of vehicles cannot be smaller than 0. If the number of measurement points was higher than 4, the number of columns exceeded the number of rows. This means that the system is underdetermined, which means that there are either zero or an infinite number of solutions. In order to provide a solution with relatively small x values, we optimized for Equation (4). This problem will provide us with the number of vehicles leaving, entering, and passing on each driveway. The algorithm also ensures correctness in converting the generated data into flows.