Research Article
High-Speed Data-Driven Methodology for Real-Time Traffic Flow Predictions: Practical Applications of ITS
Algorithm 1
Pseudocode for the KNN-S2S prediction algorithm.
Given the without , and values, value: | (where ) | Step 1: Build -NN | If (the previous ) then -value = 1 | (where is the present running time; is a run-time limit) | (1) Initialize the list of the -objects shown as (5). | (2) For each and in the past database | (where ; ) | (2-1) Calculate between and by eq. (4) | (2-2) If then | (where ) | (2-2-1) Delete and from the -object list | (where is associated with , ) | (2-2-2) Update and into the -object list | (2-2-3) Search in the updated -object list | (3) Sort the select -objects ascending based on | Step 2: Decide -NN and estimate | If then | If is available then -value = 0 | (1) Add to | (2) Recalculate all in the -object list as follows | (where ) | | (3) For each and in the - object list | (where ) | If then | (where ) | (3-1) Delete and from the -object list | (where is associated with , ) | (3-2) Update and into the - object list | (3-3) Search in the updated -object list | Else -value = 1 | (4) Estimate by eq. (6) |
|