Monte-Carlo Simulation of the Predator/Prey Model  
   
   
Background --
The predator/prey model details the interaction between two species, where one species hunts the other as a food source. The mathematical model predicts the populations of the two species by formulating their interactions as a pair of first-order differential equations.

The model predicts that the populations of the two species will exhibit cyclical behavior. The population of the predator species will fall, spurring a rapid growth in the prey species due to less predation. As the prey population increases, starvation rates among the predator species will drop, causing the predator population to surge. The increase in predators will cause the prey population to decrease, and the surplus predators will die off due to lack of food. This cycle continues indefinitely.


Download

Pred/Pray version 1.2

 

Monte-Carlo Simulation --
This program attempts to simulate the behavior of the natural predator/prey interaction. Rather than using a rigid set of equations (like the mathematical model), the program uses the principals of Monte-Carlo simulation to emulate the natural interaction of two species.

Behavior --
The simulation uses two species: rabbits and wolves. Wolves prey on rabbits as a food source, while rabbits are assumed to feed on an inexhaustible source of clover. The simulation takes place on a 50 x 50 grid, representing a finite environment. Simulation progresses through a series of turns, with every simulated animal moving to or interacting with with one square per turn.

At the beginning of the simulation, the grid is randomly populated with a number of rabbit and wolf squares, based on the user-defined initial population for each species. Each rabbit or wolf square represents a single animal, with it's own age, hunger level, and other species-specific characteristics.

Rabbits (green squares): Each turn, every rabbit on the grid will attempt to move to a random adjacent square, if an empty one exists. Rabbits are assumed to eat the ever-present clover, and therefore never die of starvation. Each rabbit carries an internal birth rate, based on the user-defined 'Prey Birth Rate' setting. When the rabbit's age divides evenly into the birth rate, the rabbit gives birth. So, if the rabbit birth rate is set to five, the rabbit will give birth at age five, ten, fifteen, and so forth. When a rabbit gives birth, a new rabbit square is created in an empty adjacent square.

Wolves (red squares): Each turn, every wolf on the grid will look for rabbits in the squares adjacent to it's own. If it finds a rabbit, it will eat the rabbit and move onto the rabbit's square. If more than one adjacent square contains a rabbit, the wolf will randomly select one of the rabbits to eat. Each wolf contains an internal hunger level, based on the user-defined 'Predator Hunger Limit'. When the wolf eats a rabbit, it's hunger level is refreshed back to the maximum. On each turn, if the wolf finds no rabbits in any adjacent squares, it randomly picks an empty square to move to, and it's hunger level is eroded by one. At the end of the turn, if the wolf's hunger level falls to zero, the wolf is killed and removed from the grid. Wolf birth happens in the same manner as with rabbits: when the wolf's age is evenly divisible into the user-defined 'Predator Birth Rate', a new wolf is created and placed in an adjacent square.

The Program --
This program consists of two windows: the settings window, and the simulation window. The settings window opens when the program first starts, and contains the various user-defined settings that are used in the simulation. The simulation window opens automatically when the user presses the 'Run!' button. It contains the 50 x 50 grid of animals, as well as a pair of bars that show the total population for each species.

Settings Window --
There are six settings that the user can change. The first five deal with the behavior and population of the animals in the simulation, and the last deals with the simulation speed. Once the simulation has started, ONLY changes to the simulation speed will be allowed.

Start Population: The number of predator and prey animals at the start of the simulation Birth Rate: The number of turns an animal must wait before reproducing. For example, setting the Predator Birth Rate to '5' will cause wolves to give birth every five years they age.

Hunger Limit (Predator Only): The number of turns a predator can survive without eating. For example, a setting of 'ten' will cause every predator to die after ten turns unless it eats a rabbit before the end of turn ten. When a predator eats a prey animal, it's hunger level is returned to the maximum. So, if the Hunger Limit is set to ten, and a wolf with a hunger level of two eats a rabbit, it's hunger level will be raised back up to ten.

Simulation Speed: The speed at which the simulation runs. This is partly depended on the speed of the computer running the program, but on most computers 'slow' should be 1 turn per second and 'fast' should be at least 25 turns per second. The speed may be changed during the course of the simulation. To change the speed, the slider button ITSELF must be clicked on. Clicking on different parts of the slider range will also move the button, but the changes WILL NOT take effect unless the ACTUAL BUTTON is clicked.

Simulation Window --
The simulation displays the grid, the movements of each animal on the grid, and a pair of bars on the left side of the window representing the population of each animal. The green bar is prey population, and the red bar is predator. A bar reaching bottom of the screen represents a population of zero, and one reaching the top of the screen represents a population of 2500, or the entire grid. On the grid, green squares represent prey animals, red squares represent predator animals, and white squares represent empty squares.

 

 

 

Pred/Pray Simulation by Andrew Schurr Copyright 2003