Introduction to Complex Systems

Prof. Dirk Brockmann, Winter Term 2021

Practical Problem 2: Predator Prey Agents

In Panel 1 in the Script on 2D dynamical systems an agent based simulation is shown that is driven by the reactions:

The system has four parameter, each governing the rate of one of the reactions

To do:

Write a netlogo simulations in which two types of particles randomly move around in the world.

Because we have predators and prey, it would be nice to have two different types of turtles. This is done by the breed concept. In the beginning of the code you can define breeds using this:

breed [humans human]
breed [animals animal]

This defines two breeds, humans and animals. You could also name them differently like

breed [habecks habeck]
breed [lindners lindner]

and then you can loop over these breeds separately using commands like ask habecks [...] or create-lindners 100 (Let's not think about this literally).

1. Let's begin by writing a setup function that creates 50 turtles of each breed
2. Let's make them move around randomly using what we've learned. Each breed should have two individual movement parameters, the wiggle and the speed.
3. Now let's write four functions each for the four reactions and each one should be executed in the go function.
• For reaction $A\xrightarrow{\alpha}2A$ you can use the hatch command. But make sure that you limit the reaction by the total number of prey individuals, otherwise netlogo will freeze. You could do this like this

 to reproduce
if random-float 1 < reproduction-rate and count animals < 500 [
hatch 1
]
]
end

• For the reaction $B\xrightarrow{\gamma}\emptyset$ you can just loop over all predators using something like ask predators [....].
• The two particle reactions are more tricky. For the reaction $A+B\xrightarrow{\delta}2B$ you can use the following construct (replace "B" by whatever breed you defined for the predators)

ask "B" [
; check if there are any prey in a radius
; hatch
; kill one of the prey in the radius using

]

Goal

• once the program is running, try to figure out a parameter combination that generates oscillatory behavior in the population of A and B like you would expect from the deterministic equation.