(c)2006 Ferdi Hellweger, Northeastern University, Boston.
NOTE: The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.
QUICK START: Click setup (may have to hit it twice), then go.
created with NetLogo
view/download model file: GerritsenStrickler1977.nlogo
This model simulates predators and prey and their encounters. The predators are the black “monster” shapes and the preys are the green dots. The size of the symbol indicates how deep in the volume of water the individual is (you are looking at the top of a 3D volume). Predators and prey move in a random direction at a defined speed. When a predator and prey are within a certain distance of each other, they are considered to meet or encounter each other. This event is, of course, very important in ecology, because a predator needs to encounter a prey before it can attempt to capture and eat the prey.
The model tracks the number of encounters and calculates an encounter rate. For this simplified scenario, the encounter rate can also be calculated using the equation of Gerritsen and Strickler (1977).
where Zp (#/s) is the encounter rate, R (m) is the encounter radius, Nh (#/m3) is the prey density, u (m/s) is the prey swimming speed, and v (m/s) is the predator swimming speed. The above equation corresponds to Eqs. 6 and 7 in Gerritsen and Strickler (1977), which is the solution to the problem using the average of the prey velocities. The encounter rate calculated in the model (“Num”) is compared to the one calculated using the above equation (“Theo”). A comparison for a number of predator swimming speeds is presented in Figure 1.
Figure 1. Model validation. The encounter rate, Z, as a function of predator speed, v. Parameters: R = 1 m, NH = 1 #/m3, u = 1 m/s. Numerical results are mean +/- 2 standard deviation from 10 runs with different random number generator seed values. Additional parameters used by the numerical model: x = 10 m, y = 10 m, z = 10 m, v_std = 0 m/s, u_std = 0 m/s, nP = 1, dt = 0.1 s, run time = 1,000 s. See Figure 2 in Gerritsen and Strickler (1977).
The model is set up with default values as in Figure 1 with v = 1.0 m/s. The theoretical encounter rate for these parameters is Z = 4.2 #/s.
When running the model, the instantaneous encounter rate (“Num (inst)”) fluctuates due to the discrete nature and stochastic variability of the model. For that reason the average encounter rate (“Num (ave)”) is calculated.
One of the advantages of the agent-based model over the analytical solution is that it can easily simulate intra-population variability in model parameters, like R, v and u. Figure 2 shows the effect of variability in the prey speeds on the encounter rate.
Figure 2. Effect of prey speed variability. The encounter rate, Z, as a function of prey speed variability, u_std. Parameters: x = 10 m, y = 10 m, z = 10 m, , dt = 0.1 s, nP = 1, v_ave = 1.0 m/s, v_std = 0 m/s, R_ave = 1 m, R_std = 0 m, , nH = 1,000, u_ave = 1.0 m/s, run time = 1,000 s. Results are mean +/- 2 standard deviation from 10 runs with different random number generator seed values.
Repeat encounter. An encounter is defined as a prey being within a distance R of a predator. Depending on the relative velocities and time step size, a prey can stay within a distance R of the same predator for many time steps, which is really only one encounter. There are a number of methods to avoid counting this as multiple encounters. One option is to hide the prey for a specified time, as was done by Yamazaki et al. (1991). They hid prey from all predators for 50 time steps. But the prey should be available to other predators and hiding it from all can result in a lot of hidden prey when the density of predators is significant. Another option is to only hide the prey from the predator it last encountered and make it available to others. This however can cause sharing of a prey between two predators with alternating encounters, thus again over-counting. A prey could be hidden from those predators it encountered for a predator-specific time, but this would require tracking the encounter history for each prey, which could be computationally very demanding. Here the prey is removed and reintroduce at a random location. The direction of the prey was kept, because reassigning a new random location was found to lead to progressively more prey moving in parallel with the predator, which reduced the encounter rate. This repeat encounter issue is important when looking for a comparison to the Gerritsen and Strickler (1977) model. In full ecological models, however, this is would not be important. That is because an encounter will either lead to the elimination of the prey, and if not, a repeat encounter would be valid.
Randomization. A certain configuration (the directions of predators and preys) can be more or less advantageous in terms of encounter rates. This can lead to significant differences between model runs, especially when the number of individuals is small. Therefore, some randomness is introduced manually, by altering the direction of the individuals a small amount every time step. Also, it was found that when this is not done, the model overpredicts the encounter rate. The reason for this is not entirely clear to the author.
Wrapping. Predators and prey that reach the edge of the world are reintroduced at the opposite end. In a similar manner, the distance is calculated across the edge, so a prey all the way on the left could be within the encounter radius of a predator all the way on the right. An alternative to this “wrapping” approach is to consider the edge of the world closed and bounce individuals of it. This is included in the code, but was found to underestimate the encounter rate. The reasons for this are not entirely clear to the author.
A NetLogo-specific. Rather than taking advantage of position, movement and distance functions inherent in NetLogo, these routines were programmed from scratch. This was necessary, because the NetLogo functions do not include the z dimension. Going to NetLogo 3D could solve this problem and the code could be simplified significantly. However, this was not done in this case because of an incompatibility between NetLogo 3D and the author’s computer’s video card.
1. Adjust the slider parameters or use the default settings.
2. Press the SETUP button.
3. Press the GO button to begin the simulation.
Follow the trajectory of a predator or prey over time. Watch how they are wrapped around the edge of the world. In other words, when they reach the edge they disappear and enter the world at the opposite side. Also watch how preys disappear when they come close to the predator. Remember, this is a 3D simulation, so even though it may appear that a predator and prey are directly on top of each other, there may be a significant vertical distance between them.
There are a number of possible improvements to the model, including a more complex encounter model (i.e. attack & consume) and accounting for turbulence. See the references below for the theory behind some of those features. It is when adding those components to the model, that the advantage of the agent-based simulation over the analytical solution will become obvious.
From a NetLogo perspective, it would be neat to recode this model in NetLogo 3D (see programming notes above). Also it would be useful to show a circle around the predator with a radius equal to the encounter radius.
Developed on August 14, 2006 by Ferdi Hellweger, Northeastern University, Boston. Email: email@example.com, Webpage: www.coe.neu.edu/~ferdi.
Developed using NetLogo. Webpage: http://ccl.northwestern.edu/netlogo/
Developed by modifying the “Wolf Sheep Predation” sample model distributed with the NetLogo installation.
Gerritsen, J.; Strickler, J. R. 1977. Encounter probabilities and community structure in zooplankton: a mathematical model. J. Fish. Res. Board. Can. 34:73-82.
Megrey, B. A.; Hinckley, S. 2001. Effect of turbulence on feeding of larval fishes: a sensitivity analysis using an individual-based model. ICES Journal of Marine Science 58:10151029.
Yamazaki, H., Osborn, T. R., Squires, K. D., 1991. Direct numerical simulation of planktonic contact in turbulent flow. J. Plankton Res., 13(3):629-643.