Updates and example models for JASSS article on NetLogo execution speed
This page provides updates and example NetLogo files for this publication:
Railsback, S. F., D. Ayllón, U. Berger, V. Grimm, S. L. Lytinen, C. J. R. Sheppard, and J. C. Thiele. 2017. Improving execution speed of models implemented in NetLogo. Journal of Artificial Societies and Social Simulation. 20 (1) 3 which is available at jasss.soc.surrey.ac.uk/20/1/3.html.
Updates, additions, and corrections to advice in the article
Example application of our speedup methods and NetLogo 3D
Kraeuter et al. published an example application of our methods to speed up a NetLogo 3D model of part of the human brain:
Kraeuter, Kayla; Reith, Carley; Kolber, Benedict J.; and Miller Neilan, Rachael (2024) “Improved Efficiency and Sensitivity Analysis of 3-D Agent-based Model for Pain-related Neural Activity in the Amygdala,” Spora: A Journal of Biomathematics: Vol. 10, 65–82.
DOI: https://doi.org/10.61403/2473-5493.1094
Available at: https://ir.library.illinoisstate.edu/spora/vol10/iss1/8
New time extension code examples
Four simple NetLogo models that demonstrate how to use the time extension are now available.
Time extension now bundled with NetLogo 6.2!
The time extension to NetLogo makes it easy to use real dates and times, and time-series inputs and outputs, in NetLogo models. It also supports use of discrete-event simulation (models in which agents schedule future actions at specific times), as discussed in our paper on using NetLogo for large models. The recently released version 6.2 of NetLogo includes the time extension as one of its built-in (“bundled”) extensions. Documentation is here at the extension’s Github site. Thank you to Uri Wilensky and Jacob Kelter of the NetLogo team, to the Swarm Development Group for partially funding the extension, and to its original author Colin Sheppard.
New generation of processors allow large BehaviorSpace experiments on desktops
There are several lines of CPUs now available that can execute many BehaviorSpace runs simultaneously. Our experience is with AMD’s Ryzen processors, which provide from 12 up to 64 cores (24-168 threads that each can run one simulation). A Ryzen 9 processor with 12 cores and 64 gb of RAM can run 24 very large NetLogo simulations at once.
BehaviorSearch now packaged with NetLogo
Section 11 of our paper mentions the BehaviorSearch tool for fitting model parameters. BehaviorSearch is now packaged with NetLogo (version 6.0.1): Look for Behaviorsearch.exe
in the same directory as NetLogo.exe
.
More information on speeding up in-radius and in-cone statements
Robert Grider of the NetLogo development team clarified to us that NetLogo versions through 6.0 were optimized to use in-radius
(and in-cone
) on the built-in agentsets: turtles
, patches
, and any breeds
that are defined. As a consequence, these primitives are slower for other agentsets, even much smaller ones, and their execution time increases dramatically with the size of the agentset being searched. It was therefore much quicker to use turtles in-radius 10 with [color = blue]
than blue-turtles in-radius 10
, even if blue-turtles
is an agentset containing a small fraction of the turtles. This difference could dramatically speed up models in older versions of NetLogo (in one test case, it reduced execution time by a factor of 20).
However, this side effect of optimizing in-radius
and in-cone
was remedied in NetLogo 6.0.1. It is no longer faster to use these primitives on the built-in agentsets.
Correction to cost of using links
Section 8 of our paper said that using NetLogo’s links agents can be much slower than using state variables to represent relationships among agents or to model networks. The test case that this conclusion was based on had a mistake in it, and the difference between using links and state variables is less than we claimed. Our corrected test with the Wild Dog model found that using links increased execution time by only about 10%.
Example models used in the article
See the “Info” tab in each file for information on its purpose and use. These files were developed in NetLogo version 5.3 but should work in versions 6.x and later.
The first file is referred to in paragraph 6.7 of the article. It illustrates use of global agentsets to reduce use of filtering primitives such as with
. Right-click here to download With-vs-global-vars.nlogo.
The second file is referred to in paragraphs 6.8 and 6.9 of the article. It illustrates use of patch or turtle agentset variables to reduce use of filtering primitives such as with
. Right-click here to download With-vs-agent-vars.nlogo.
The third file is referred to in paragraphs 6.11 and 6.14 of the article. It illustrates use of local agentset variables to reduce use of filtering primitives such as with
. Right-click here to download With-vs-local-vars.nlogo.
The fourth file is referred to in paragraphs 3.4 and 9.1 of the article. It calculates execution time of identifying agents within a radius, using both the in-radius
and distance myself
statements. Right-click here to download InRadius-vs-DistanceMyself.nlogo.