Difference between revisions of "Simple ecosystem simulation (NetLogo)"

From Simulace.info
Jump to: navigation, search
(User interface)
(Model)
Line 94: Line 94:
 
Other monitors give us a peek on the biggest/smallest and fastest/slowest creatures and also on the average values of speed and mass.
 
Other monitors give us a peek on the biggest/smallest and fastest/slowest creatures and also on the average values of speed and mass.
 
In the center there is a simulation window. One important fact is that this is not only a place to show something, its size actually matters. As we see later, when simulation window (=puddle of water) is too small, the ecosystem is not able to survive for long.
 
In the center there is a simulation window. One important fact is that this is not only a place to show something, its size actually matters. As we see later, when simulation window (=puddle of water) is too small, the ecosystem is not able to survive for long.
 +
 +
=== Implementation ===
 +
This section describes actual implementation of a simulation.
 +
 +
==== Agents ====
 +
There are three types of agents in the model - alga, herbivore and carnivore. Model consists only from agents. This is because we have to simulate collisions between them and modelling alga (alga does not move) as a patch would cause troubles in computing collisions, not mentioning that a patch cannot have circular shape.

Revision as of 13:06, 27 May 2016

Simple ecosystem simulation

This problem is partly inspired by theory of "Primordial soup", partly by modern things such as agar.io game and partly by Swimbots simulation.

The primordial soup was a term created by Alexander Oparin in his theory of origin of the life on Earth. This theory states that there were just chemical elements which, under pressure and exposed to various energies (electrical discharges, high temperature), formed monomers, polymers and, in the end, live organisms. ( https://en.wikipedia.org/wiki/Primordial_soup )

Agar.io is a web-browser based game where the player controls his own cell. The cell can move, eject some of its matter and split itself in two. It can also absorb smaller cells which belong to other players. There is no particular goal in the game - just to, well, live long and prosper.

Swimbots is a simulation of the "gene pool" and originally was created as an answer to the statement of Richard Dawkins that:

"The very idea of a gene pool has no meaning if there is no sex. 'Gene Pool' is a persuasive metaphor because the genes of a sexual population are being continually mixed and diffused, as if in a liquid. Bring in the time dimension, and the pool becomes a river, flowing through geological time..." -Richard Dawkins, The Ancestor's Tale, page 432

Therefore swimbots are simulation where agents can move around in a "pool" and have two basic goals - 1) to eat and 2) to reproduce. Everything else emerges on its own during the simulation. Official web of the Swimbots is www.swimbots.com (TODO link) where the complete simulation app can be downloaded.

For purpose of our simulation we blended those three topics together and the result was a small artificial ecosystem which could have existed on the primeval Earth.

The blend is as follows:

Oparin's primordial soup already evolved into single-cell organisms - algae and protozoa. Some of protozoa are herbivorous (can eat single-cell algae), some of them "carnivorous" (can eat other protozoa). More detailed information is given in the problem statement but main idea of our work is to simulate what happens in the pool as the time goes on. We are insterested in this, because we want to determine if such a closed ecosystem could actually exist - and if it could, what is its equilibrium (here we consider the pool as an actual small puddle of water with all those happy little creatures in it, separated from the "outside" world).

Problem definition

Name of simulation: Simple ecosystem simulation

Class: 4IT495 Simulace systémů (LS 2015/2016)

Author: Petr Fišer

Type of model: Multi-agent simulation

Modelling software: NetLogo


We have three types of objects, algae (AL), herbivorous protozoa (HP) and carnivorous protozoa (CP).

Basic properties:

  • Algae do not move, protozoa, on the other hand, do.
    • They are not intelligent enough so they move randomly.
    • Each protozoan has its movement speed (determined upon its creation) and a direction it is moving in.
    • There is a 5% chance the direction changes.
  • Algae emerge on their own.
    • Frequency of algae regrowth is adjustable.
  • HP can eat algae.
  • CP can eat HP and CP. If CP eats AL, it does not count as consuming food (the AL disappears though).
  • If protozoan consumes food (algae or other protozoa) it grows by a size of food it has just consumed.
  • Protozoa can eat only smaller food than they are.
  • "Eating" happens when two objects touch.
  • Each object has a size.
    • Size of the AL is always 1.
    • Initial size (mass) of the HP is 3.
    • Initial size (mass) of the CP is 5.

Life of a protozoa:

  • When moving around, protozoa consume energy.
    • The bigger they are, the more energy they need. Therefore, the mass of a protozoa continually decreases by 0,25% (HP) and 0,5% (CP), respectively
    • Mass of protozoa decreases by at least by 0.001.
    • When two objects collide (touch), "eating" happens.
    • Two objects cannot overlay.
    • When the cannot eat it, they stop moving in the given direction.
    • If protozoan has mass equal to zero, it dies.
  • If protozoan grows beyond two times of its initial size, it can reproduce by spliting itself.
    • Beyond two times of initial size, the chance of splitting is 25%.
    • Beyond three times of inital size, the chance is 50%.
    • New protozoan does inherit speed atribute from its parent.

Starting conditions:

  • A puddle of water with starting amount of AL, HP and CP scattered around. Those amounts need to be adjustable.
  • Algae regrows (adjustable frequency).

Goal

Observe evolution of the ecosystem as a whole in order to determine if it is able to survive in the long run. If it is, then determine for which values of starting parameters there is an equilibrium formed in the ecosystem and determine ratios between count of algae,HP and CP respectively.

Used method and software

Multi-agent simulation using NetLogo.

Model

This section describes model implementation. First we show user interface and means for changing default inputs. Later, we will describe implementation on the level of functions called throughout the model. For complete programmer-level documentation, please, see the nlogo code itself.

User interface

Relativne stabilni 2.png

On the left side, we see simulation inputs and internal model variables. Variables which are meant to be set have their boxes above the "setup" button. Those are: initial number of algae, herbivores and carnivores and algae regrowth rate and amount. Model is run by hitting "go" button. Other inputs are internal model variables which are, generally, not meant to be fiddled with. They are there to make model more customizable for different purposes. During our simulation, those settings are left to default (because that is how the original problem was specified). Buttons not fully shown on the screenshot are used to reset internal model settings and to reset all settings to default, respectively.

On the right side, we see plots and counters. We observe counts of our creatures and also their overall mass. This is important because, as we see later, in some circumstances a supercreature can emerge - such a creature can fill the whole simulation window with its mass but in absolute counts, there is nothing else than this one creature. Other monitors give us a peek on the biggest/smallest and fastest/slowest creatures and also on the average values of speed and mass. In the center there is a simulation window. One important fact is that this is not only a place to show something, its size actually matters. As we see later, when simulation window (=puddle of water) is too small, the ecosystem is not able to survive for long.

Implementation

This section describes actual implementation of a simulation.

Agents

There are three types of agents in the model - alga, herbivore and carnivore. Model consists only from agents. This is because we have to simulate collisions between them and modelling alga (alga does not move) as a patch would cause troubles in computing collisions, not mentioning that a patch cannot have circular shape.