This IJulia notebook contains model details, parameters, and associated code for traffic propagation models associated with "Initial Scene Configurations for Highway Traffic Propagation"
Content:
All code in this repository uses the Julia language. The versions for each package are available in REQUIRE.
using Trajdata_
td = Trajdata_.Trajdata(Trajdata_.FILENAME_HW_101_0805)
Trajdata_.carsinframe(td, 100)
2-element Array{Int64,1}: 5 9
Trajdata_.get(td, 5, 100)
Vehicle(4.902,140.923,-0.0046381856635791625,12.5,2,13.0,6.9)
get(td, :global_y, Trajdata_.car_df_index(td, 5, 100))
1.873304155e6
Scenes are extracted using the pull
functions. For example, the scene below has frameindex 500 from 80a
reload("nbk_functions.jl")
render_scene_500_80a()
The scene above draws each vehicle at its position in the dataset given by the local coordinates provided in the NGSIM data. The vehicle width and height are also provided from the NGSIM data.
The abstract SceneGenerator
was created to represent scene generation models. All concrete implementations are subclasses.
Each SceneGenerator
supports generate_scene()
, loglikelihood()
, and cyclic_coordinate_ascent_parallel()
.
Scene generation is the act of sampling a random scene from the distribution represented by the model. The roadway is specified using by the number of lanes, the width per lane (always the average lane width of 11.44 ft), and the scene length of 300 ft. The lane generation process for each model is detailed in the paper and is implemented for each model. In general, these methods construct lanes individually by iteratively adding the next vehicle in front of the previous one in the lane using a headway separation distribution. The initial placement of the first vehicle in each lane, however, deserves explanation.
The distace of the first vehicle from the scene boundary is a uniform-random sample from the headway separation of said vehicle and the (missing) vehicle that trails it. This is achieved by sampling from the headway distribution and then sampling uniformally from that headway.
The log-likelihood of a scene is computed as is detailed for each model in the paper. This assumes that the scene was generated using the given model. This requires computing conditional probabilities in Bayesian networks. The Smile.jl
package was used to this end, which is a Julia wrapper around the SMILE
C++ library developed by the Decision Systems Laboratory at the University of Pittsburgh. Inference in Bayesian networks was conducted using the Probability Propagation
in Trees of Clusters "Lauritzen" algorithm in Smile, an exact inference algorithm.
Model training was conducted using cyclic coordinate ascent and maximized the cross-validated likelihood, as detailed in the paper.
The raw tracks were smoothed using the symmetric exponential moving average presented in Estimating Acceleration and Lane-Changing Dynamics Based on NGSIM Trajectory Data by Thiemann et al. The associated code is in trajdata_preprocess.jl
. This approach smoothes the local position coordinates and the speed for each vehicle.
The original datasets are each provided in three chunks of fifteen-minute length. Only full vehicle traces are provided, so it takes multiple frames before the entire road is saturated. Scenes were only extracted for frames in which the entire roadway was saturated.
Model features were extracted from the NGSIM dataset. The vehicle centerline offset is defined as the signed lateral offset of a vehicle from the closest lane centerline. Lane centerlines were obtained by fitting 1D splines to the mean lateral position of the vehicles in the lane frame using the Dierckx.jl
package. The smoothing constant was varied for each spline to produce the best fit. The lane relative-heading was computed directly from the smoothed trajectory using a three-frame forwards derivative. Vehicle separation distance was measured as the distance from the front of the trailing vehicle to the rear end of the leading vehicle.