# CQFormer: Cyclic Quasi-Dynamic Transformers for Hourly Origin-Destination Estimation
## 4 Methodology
Travelers dynamically adjust their path selection according to the traffic states, but subject to information delays, personal preferences, and other factors, ultimately travelers will choose one of the \(N\) paths with the shortest travel time, and the probability of choosing each path is related to the level of congestion perceived by the travelers. 3. **Roaming Path Selection Pattern**. This path selection pattern is used to fill in the travel path selection pattern that cannot be described by the two above, including trips without specific purposes or travelers with multiple travel purposes, and the paths in this pattern are generated from all the candidate paths between the origin and the destination. First, we perform a calibration on the proportion of each path selection mode in the DTA model. Specifically, we arrange the proportions of the three path selection from 0 to 1 in a gradient of 0.1 to obtain 55 combinations (e.g., (0.2, 0.5, 0.3), (0.2, 0.6, 0.2), etc. ), for each prior matrix, we perform 10 rounds of simulation, the traffic count data generated from the \(j\)-th round simulation of \(i\)-th combinations on the \(p\)-th prior matrix is denoted as \(\hat{F}_{T}(i,p,j)\), and we calculate the Manhattan distance between the \(\hat{F}_{T}(i,j)\) to the corresponding traffic count data \(F_{T}(p)\). We select the parameter combination that minimizes the sum of the differences between \(\hat{F}_{T}(i,p,j)\) and \(F_{T}(p)\) as the initial configuration. In each round of simulation, the meta-model parameters of DTA fluctuate stochastically within a range of 0.2. \[F_{T}[\alpha_{i},\beta_{i}]=N(A_{i})=\sum_{r_{k}}N(r_{k})\delta_{A_{i}\in r_{ k}} \tag{5}\]6  
The prior OD matrices cover the traffic demand in six periods, including morning, morning peak, noon, afternoon, evening peak, and night. In each round of simulation, we perform simulations for these six periods, respectively. For each period, we randomly select a prior OD matrix \(D_{main}\) as the main demand structure, and select the traffic count data of the corresponding period from the real data set to perform OD estimation using one or more coarse OD estimations (c-SPSA is used here) to generate an additional OD matrix \(D_{sub}\), then the OD matrix for each round of simulation can be calculated as Equation (15)  
\[F_{T}[\alpha_{i},\beta_{i}]=N(A_{i})=\sum_{r_{k}}N(r_{k})\delta_{A_{i}\in r_{ k}} \tag{5}\]7  
where \(normal(0.8,1.2)\) means a normal distribution from 0.8 to 1.2. This formula uses combination and randomization to generate as diverse a simulated traffic demand as possible. The OD matrix for simulation is then input into the calibrated DTA model to produce the corresponding traffic count data. We first cluster the real traffic count data for different time-of-days using Gaussian mixture models (GMM), and exclude the out-of-cluster data generated by each simulation. We also apply GMM to cluster the traffic count data generated by simulations, and use probability weight to preferentially sample the real traffic count data that are not in the clusters of simulation data to enhance diversity.