Documentation Tutorials Download Contribute



Predator Prey

This tutorial presents the structure of a GAMA model as well as the use of a grid topology. In particular, this tutorial shows how to define a basic model, to define “grid agents” which are able to move within the constraints. It also introduce the displays and agents’ aspect.

All the files related to this tutorial (images and models) are available in the Models Library (project Tutorials/Predator Prey).

Content

Model Overview

In this model, three types of entities are considered: preys, predators and vegetation cells. Preys eat grass on the vegetation cells and predators eat preys. At each simulation step, grass grows on the vegetation cells. Concerning the predators and preys, at each simulation step, they move (to a neighbor cell), eat, die if they do not have enough energy, and eventually reproduce.

images/predator_prey.png

Step List

This tutorial is composed of 12 incremental steps corresponding to 12 models. For each step we present its purpose, an explicit formulation and the corresponding GAML code of the model.

  1. Basic model (prey agents)
  2. Dynamic of the vegetation (grid)
  3. Behavior of the prey agent
  4. Use of Inspectors/monitors
  5. predator agents (parent species)
  6. Breeding of prey and predator agents
  7. Agent display (aspect)
  8. Complex behaviors for the preys and predators
  9. Adding of a stopping condition
  10. Definition of charts
  11. Writing files
  12. Image loading (raster data)