ASU ABM club adaptation of the NetLogo wolf sheep predation model with added kill tracking from @mmannin5
Software Requirements: docker
, make
and bash
- Install docker
- Clone this repository
- Build the Docker images by running
% make build
on the command line in the root of the project. - Prebuilt images can be pulled from Docker Hub (
docker pull comses/resbaz-analysis:3.3.3
anddocker pull comses/resbaz-netlogo:5.3.1
)
Executing% ./run.sh run
on the command line (caveat: only tested on Linux and Mac, it may run on Windows 10 bash) will execute the entire pipeline which currently consists of (1) a NetLogo behavior space experiment that generates a single CSV file, and (2) a RMarkdown file that loads the generated CSV file and generates a RMarkdown HTML report.
The NetLogo data can be found at data/vary_food_gains.csv
and the resulting RMarkdown report will be produced at results/wolf_sheep_AB.html
, relative to the root directory.
- Run
make interact
- NetLogo GUI should have popped up on your desktop
- If it hasn't check the logs (
docker-compose logs -f netlogo
). If there is an error about not being able to connect to the X11 server window you need to give docker permission to talk to the X11 socket. This can be done withxhost +local:docker
.
- RStudio GUI available at
localhost:8787
The root project directory is mounted at /code
so the NetLogo model used to generate this model is at /code/src/wolf-sheep-predation.nlogo
. Open /code/src/wolf-sheep-predation.nlogo
in NetLogo to view the model. The Behaviour Space settings used the vary_food_gains
experiment. Parameters for the experiment can be seen by going into Tools > BehaviourSpace and opening vary_food_gains
At localhost:8787
login as rstudio with a password of rstudio. The root project directory (the directory this is in) is mounted into RStudio at /home/rstudio/code
. It should be visible in the explorer pane in RStudio.
-
Open the
wolf-sheep.Rproj
project file in RStudio (File > Open Project...
and selectwolf-sheep.Rproj
it will at the path/home/rstudio/code/wolf-sheep.Rproj
). This will load the Packrat repository used for this project. -
Open
src/wolf_sheep_AB.Rmd
-
Run the
knit
command
This workflow has hard coded the output file generated from NetLogo into a path made accessible to the RMarkdown container. This example uses the hard coded data set name vary_food_gains.csv
. A more robust workflow would define this type of data in a single place and referencing it in dependent computations so that changing the filename of a dataset does not require manually editing multiple files.
Wilensky, U. (1997). NetLogo Wolf Sheep Predation model. http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.