© 2024 Christopher Attar. All rights reserved.

Modelling Predator-Prey Dynamics in Microbial Ecosystems

Diatom Simulation - First Pass

Complexity in Simplicity

What's particularly striking is the complexity that emerges from these tiny organisms. Despite their limited scope of action, microorganisms display incredible variation in their survival strategies. Some are filter feeders, others aggressive predators. Some produce powerful neurotoxins, while others have achieved functional immortality.

Modeling Ecosystem Stability

This raises an intriguing question: what maintains stability in such complex systems? How do various classes of entities coexist, and what happens when we alter the physical pressures in their environment?

Below is a screenshot from one of the first passes of the simulation I decided to build to test these ideas. The plant is meant to represent the diatoms, which are the baseline entity for microscopic food chain. They are single celled organisms which reproduce every 24 hours and live for about 6-7 days. The blue cells are meant to represent blepharisma, which are also unicellular protist. Finally, the predator entity can represent any of the general predatory unicellular organisms that may consume others.

Sample Ecosystem Image

I needed to begin my designing the general conditions that I would have to work with regarding all of the entities. I began listing items which would be required for initial configuration

#Evolution settings
                    MUTATION_RATE = 1
                    REGENERATION_DELAY = 5000
                    DIVISION_THRESHOLD = 550 #costs the cell 50 energy to split
                    
                    #00 - PLANT VARIABLES
                    PLANTS_NUM = 200
                    PLANTS_ENERGY = 50
                    PLANTS_ENERGY_MAX = 50
                    PLANT_ENERGY_GROWTH = 1
                    PLANT_GROWTH_THRESHOLD = 25
                    PLANT_DECAY = 0
                   
                    #01 - CELL VARIABLES
                    CELLS_NUM = 80 # Number of particles in the simulation
                    ENERGY_INITIAL = 500
                    CELL_ENERGY_MAX = 1000
                    CELL_ENERGY_DECAY = 0.25
                    ENERGY_GAIN_FROM_CELL = 200
                    
                    #02 - PREDATOR VARIABLES
                    PREDATORS_NUM = 10
                    PREDATOR_ENERGY_DECAY = 1
                    PREDATOR_ENERGY_INITAL = 1000
                    PREDATOR_ENERGY_GAIN = 400
                    

We are going to need to set a bunch of variables to get things started.

  • Mutation: This is meant to be a generic mutation threshold corresponding with indcident radiation. Set at 1 until it gets further devloped.
  • Regeneration Delay: Time in ms as a wait for a cell to split. It exists for testing purposes globally, as later each entity will required their own timer.
  • Division Threshold (Global):
  • Growth Threshold: Model the diatom/plat growth rate at which a new plant is spawned.
  • Number: Seed number of a particular cell.
  • Energy: The starting energy amount for a given entity
  • Energy Max: Maximum energy a given cell can possess. This was meant to keep a cap on unbounded growth in case a cell keeps consuming others without end. At present, this is shorthand way to ensure a maximum size, but we are going to revise this in later iteration I think.
  • Energy Decay: Rate that the cell uses energy to sustain itself. Once it reaches zero, the cell disappears from grid. (We might change the cell at a later point in order for it to provide growth to
  • Energy Gain: Amount of Energy that is gained by that specific cell being consumed.

I am using energy as the baseline to keep track of the cells. You can call it HP, or health bar or any other video game term for it. The energy for all organisms is going to have to decay. We are setting this at a linear rate, but we can imagine a more varied set up down the line. For prey, I was thinking that if the cell is within range of a predator , it will be forced to look at the input vector for the predator and expend an amount of energy to escape in the opposite direction.

Naive Ecosystem Plot

The above graph represents one of my original passes trying out the sim after I tested the baseline fuctionality. We start with 130 plants, 110 cells and 10 predators. This run lasted for just unde a minute.

    My List of Things to Fix:
  • Add initial conditions in plots
  • Randomize config settings [Mutation rate, energy,
  • Figure out a way to adjust the initial seeding of the plant cells
  • What is a good domain for values, how do I constrain my iniital conditions?