nlexperiment-package: nlexperiment: NetLogo experiments

Description Details References Examples

Description

Exploration of NetLogo (Wilensky 1999) agent based models.

Details

A tool for NetLogo experiment definition, exploring simulation results and model optimization. Makes it easy to turn the cycle of experiment definition, data analysis, visualisations and parameter fitting into readable and reproducible documents.

RNetLogo package (Thiele 2014) is used as an interface to NetLogo environment.

Functions in nlexperiment assume the following steps:

References

Wilensky, U. (1999) NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

Thiele, J. (2014) R Marries NetLogo: Introduction to the RNetLogo Package. Journal of Statistical Software 58(2) 1-41. http://www.jstatsoft.org/v58/i02/

The ideas and principles of NetLogo experiment definition is taken from the NetLogo's Behavior Space tool http://ccl.northwestern.edu/netlogo/docs/behaviorspace.html and BehaviorSearch tool http://www.behaviorsearch.org/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
# Set the path to your NetLogo installation
nl_netlogo_path("c:/Program Files (x86)/NetLogo 5.1.0/")

# Create NetLogo experiment of Net Logo Fire model
experiment <- nl_experiment(
  model_file = "models/Sample Models/Earth Science/Fire.nlogo",
  while_condition = "any? turtles",
  repetitions = 10,
  run_measures = measures(
    percent_burned = "(burned-trees / initial-trees) * 100",
    progress = "max [pxcor] of patches with [pcolor > 0 and pcolor < 55]"
  ),
  param_values = list(
    density = seq(from = 55, to = 62, by = 1)
  )
)

# Run the experiment using multi-core processing
result <- nl_run(experiment, parallel = TRUE)

# Get observations data frame
dat <- nl_get_run_result(result)

# plot percent burned by density
library(ggplot2)
ggplot(dat, mapping = aes(x = factor(density), y = percent_burned) ) +
  geom_violin()

## End(Not run)

bergant/nlexperiment documentation built on May 12, 2019, 3:05 p.m.