Does Australia need More Fires (but the Right Kind)? A Multi-Agent Simulation

[This article was first published on R-Bloggers – Learning Machines, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


We have all watched with great horror the catastrophic fires in Australia. Over many years scientists have been studying simulations to understand the underlying dynamics better. They tell us, that “what Australia needs is more fires, but of the right kind”. What do they mean by that?

One such simulation of fire is based on Multi-Agent Systems (MAS), also called Agent-Based Modelling (ABM). An excellent piece of free software (and in fact the de facto standard) is NetLogo. Even better is that NetLogo can be fully controlled by R… and we will use this feature to learn some crucial lessons!

If you want to understand more about the dynamics of fire in particular and about some fascinating properties of dynamical systems in general via controlling NetLogo with R, read on!

The model we will use can be found here: NetLogo Models Library: Fire. There it reads:

This project simulates the spread of a fire through a forest. It shows that the fire’s chance of reaching the right edge of the forest depends critically on the density of trees. This is an example of a common feature of complex systems, the presence of a non-linear threshold or critical parameter.

Similar effects can be observed in other phenomena, namely the spread of diseases (the medical area of infectiology or epidemiology), the diffusion of information (or memes) within a population (e.g. via social media) or the diffusion of innovation within an economy.

Those effects can best be understood by looking at some examples:

Set the density of trees to 55%. At this setting, there is virtually no chance that the fire will reach the right edge of the forest.

Set the density of trees to 70%. At this setting, it is almost certain that the fire will reach the right edge.

There is a sharp transition around 59% density. At 59% density…

…the fire has a 50/50 chance…

…of reaching the right edge.

Now, we are going to control NetLogo with R via the excellent nlrx package (on CRAN). The following analysis was inspired by the article “Agent Based Models and RNetLogo” from the Revolutions blog (a Microsoft company), yet the RNetLogo package used therein is not compatible with current NetLogo versions (and therefore increasingly useless).

You can use the following piece of code as a template for your own experiments with all kinds of NetLogo models:

library(nlrx)

# Windows default NetLogo installation path (adjust to your needs)
netlogopath <- file.path("C:/Program Files/NetLogo 6.1.1")
modelpath <- file.path(netlogopath, "app/models/Sample Models/Earth Science/Fire.nlogo")
outpath <- file.path("data") # adjust to your needs

nl <- nl(nlversion = "6.1.1",
         nlpath = netlogopath,
         modelpath = modelpath,
         jvmmem = 1024)

# set up experiment
nl@experiment <- experiment(expname = "fire",
                            outpath = outpath,
                            repetition = 1,
                            tickmetrics = "false",
                            idsetup = "setup",
                            idgo = "go",
                            runtime = 0, 
                            metrics = c("ifelse-value (initial-trees > 0) [(burned-trees / initial-trees) * 100][0]"),
                            variables = list('density' = list(values = seq(0, 100, 10))), # use seq(0, 100, 1) to simulate over 100 different densitiy values
                            constants = list())

# set nseeds = 10 to simulate over 10 different random seeds (replicates)
set.seed(123)
nl@simdesign <- simdesign_distinct(nl, nseeds = 2)
## Creating distinct simulation design

# run experiment
results <- run_nl_all(nl)

# plot results as boxplots
boxplot(results$`ifelse-value (initial-trees > 0) [(burned-trees / initial-trees) * 100][0]` ~ results$density, xlab = "Density", ylab = "Percent Burned", main = "NetLogo Fire Simulation")

The boxplots corroborate the point of a highly non-linear behaviour, also called phase transition, critical threshhold or tipping point around the 59% density level.

One practical consequence indeed is to ensure that the density of forests doesn’t grow beyond some critical threshold. In an interview, my colleague Professor Stephen Pyne, an American fire expert, answers the question on what roles Aborigines play in Australia’s history of fire:

It’s a key role. Evidence suggests that they burned the landscape for 50,000 years after humans first found their way to Australia. These fires resulted in a new equilibrium. But when the arrival of the Europeans caused the Aboriginal population to collapse, this equilibrium was thrown off. Among the many changes, woody vegetation increased in some places, which provided more fuel for the flames. That shifted the system towards larger, more intense fires. In a landscape dominated by Aborigines, there would be more charred areas, but fewer intense fires. What Australia needs is more fires, but of the right kind. We see too many bad fires, and too few good ones.

To sum up, the counter-intuitive effect seen in many dynamical systems is that it is not true what most people consider as a given: that in the real world small changes in one part of a system will only have an overall small impact. Multi-agent simulations can give us a feeling of why sometimes small changes can indeed have a huge impact (depending on the overall situation the system is in).

By controlling NetLogo with R we have its full statistical power to analyze this often mind-blowing behaviour and conduct serious research. It will not be the last time that we cover a project in this fascinating area, so stay tuned!

To leave a comment for the author, please follow the link and comment on their blog: R-Bloggers – Learning Machines.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)