SimulateBML
is an R package to simulate the Biham-Middleton-Levine (BML) traffic model.
To install, use the devtools
package.
install.packages("devtools")
library(devtools)
devtools::install_github("txzhou/SimulateBML")
Then it's done! To start playing with it, try:
library(SimulateBML)
SimulateBML::plotBMLPhases(density = .3)
The package has S3 methods plot
and summary
for the BML
class.
Other functions include:
createBMLGrid
: initialize a BML grid.velocityBMLGrid
: evaluate the average velocity of a state of a BML grid.crunBMLGrid
: run BML simulation using C routines.plotBMLPhases
,plotBMLVelocities
: functions used to analyze the phases of the BML grids.timingGrid
,plotPerformanceDim
,plotPerformanceDen
: functions used to assess the performance of the code.
The BML traffic model displays three phases with different initial set up in the grid. I showcased how to use my package to analyze these phases (see this), and how to use the provided tools to assess the performance of the code for different grid sizes and grid densities (see this).