Skip to content

eeshugerman/griddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intro/implementation

Griddy is a Guile library for (vehicular) traffic simulation, built with Chickadee and GOOPS. Initial conditions are specified with two scheme procedures: make-skeleton, which builds the road network, and add-actors!, which does what it says (to the road network). See examples/.

Actors have a location and an agenda. A location is the road component they are on (typically a lane), and a relative position parameter. An agenda is a list of tasks, namely (travel-to <dest>) or (sleep-for <time>).

For better or worse, a fresh road network is generated for each iteration by calling make-skeleton. The next step is to place actors on the new network, and to do this we need some way to match up road components with the previous network, and how we do that is a hack: the order in which road components are registered (add!ed) in make-skeleton is tracked. This approach is nice because it's easy and simple, but it has some drawbacks:

  • make-skeleton must be deterministic within the scope of the simulation
  • building a fresh road network every iteration is maybe not super performant
    • using order-registered to match road components means this can't be parallelized (not that anything else is parallelized currently... but it could be!)
procedural-grid.mp4

getting started

dev environment setup

  • install guix
  • install direnv (optional)

create a guix profile and install dependencies to it

GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles  # typical yet arbitrary value. may need to be created.
GUIX_PROFILE=$GUIX_EXTRA_PROFILES/griddy
guix pull --profile=$GUIX_PROFILE --channels=channels-spec.scm
guix environment # is this necessary? should it be?
guix package --profile=$GUIX_PROFILE --manifest=manifest.scm

activate the environment

with direnv

cd griddy
direnv allow # only needed first time, when prompted

without direnv

cd griddy
source $GUIX_PROFILE/etc/profile
export GUILE_LOAD_PATH=$GUILE_LOAD_PATH:$(pwd)

running a simulation

guile examples/procedural-grid.scm