Hamsters Spawning

From Simulace.info
Revision as of 20:45, 15 January 2018 by A V (talk | contribs) (Hamsters Spawning in the Kennel)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Hamsters Spawning in the Kennel

Problem Definition

We own a zoo. We have a huge kennel for hamsters. We have observed a strange behavior of the hamsters. When a female hamster gives birth to babies (up to 12, depending on the type of hamster), the mother may come under the pressure of nurturing each and every one of them. After giving the birth, a female hamster becomes weak and may die if does not have enough food, vitamins or thinks that the space they live in is too small to house everyone. Since the zoo mainly feeds the hamsters with corns, which particularly lack the vitamin B3, also known as niacin, the quality of food does not always satisfy the hamster and the mother eats her babies to get extra vitamins and proteins to feed other babies, increasing the probability of survival of her and the rest babies. Another reason of the deaths of hamsters, is the poor level of the cleanness in the kennel. If the food does not satisfy the hamsters, they do not eat it and the food rots by polluting the kennel, which leads to an increased number of hamster deaths. And, as mentioned above, when hamsters think there is no enough space in the kennel for everyone, they may eat or kill their young babies. It is important to identify the relation between the number of hamsters in the kennel, the food quality the zoo provides, the amount of food hamsters get periodically and the fact of keeping the kennel clean. One of the best possibilities to find out this relationship and find out the influence on the number of hamsters deaths is a simulation.

Method and Goal


For the simulation I have used NetLogo 6.0.2 (2D version). This software was chosen due to the specifics of the problem where the communication between agents takes place and because it is the most appropriate tool for simulation of multi-agent modeling environment. Moreover, NetLogo allows interface customization making the model user-friendly, giving the possibility to change variables from the UI and monitor their effects on the hamsters’ population.

Simulation Goal:

The goal of the simulation is to identify the optimal number of female and male hamsters in the kennel, the adequate amount and quality of food as well as the level of cleanness in the kennel. Detailed Description of the Simulation We have male and female hamsters - boyhamsters and girlhamsters breeds. Every now and then some amount of food is added to the kennel. Our boyhamsters and girlhamsters born, live, eat and use the energy from food to grow. When they become adult hamsters, they spawn and they pollute the kennel. Also girlhamsters can eat baby hamsters. Hamsters die if they run out of energy, get old, or the kennel is very polluted. The environment gets polluted from excessive amount of food that is not eaten. Food rots and it is necessary to filter the waste or clean environment in order to save hamsters.

Environment – The Kennel

In order to make the simulation realistic, the kennel-like environment has been created. The kennel has green patches, which represent food. Food patches have foodrot property. Also we have global variables such as clean-e and env-clean that help to control the level of cleanness. If food is not eaten, it will rot and pollute the environment. In order to keep the environment clean, we: (1)Monitor the environment by controlling different food quality variables. If our patches property foodrot is more than 40 and the global variable env-clean is more than 0, then we set the patch color to black, meaning that the food is rotten. (2)Clean the environment by changing the food, where we reset foodrot variable to 0. (3)Filter environment – if env-clean variable is less than 100, we filter the environment by increasing the env-clean variable using FilterFoodKennel Slider from the user interface. (4)Pollute environment – the environment gets polluted according to the number of adult and young hamsters

Breeds and their behavior

Two breeds have been created – boyhamsters and girlhamsters with hamsterhealth, energy and age properties. Initially, male hamsters have energy = 20, size = 2 and age = 10, while girlhamsters have energy = 30, size = 2 and age = 10. Our hamsters do the following: (1)Feed - Both male and female hamsters eat and grow. When they wander into patch with food, their energy raises by 10 and if the size is less than 4, then their size increases by 0.2. (2)Spawn – male and female hamsters spawn and deliver up to 12 babies if:

       a.The environment is clean - env-clean > 60 AND If they are near each other within the radius =2, their energy >=30 and the size >=3
       b.According to probability p-spawn of spawning based on slider setting in the interface

(3)Pollute Environment – hamsters pollute the environment depending on the number (bighamster and littlehamster) and size (bigpollute and littlepollute) of turtles.

       a.If turtles with the size > = 3.5, then the pollution variable bigpollute = bighamster  * .03
       b.If turtles with the size < 3.5, then the pollution variable littlepollute = littlepollute * .05
       c.Finally the env-clean variable is set to env-clean env-clean - (bigpollute + littlepollute)

(4)Eat small hamsters – Female hamsters, who fed only on corn, which lacks vitamins as well as the food lacks proteins, eat their small babies. In the simulation, they eat hamsters that are 0.5 smaller than they are. Another reason to eat youngers is when hamsters understand there is no enough space in the kennel for everyone to live. (For the realistic purposes we took the maximum number of the hamsters living in the kennel = 200.) (5)Die – hamsters death is caused by several reasons:

       a.Poor food quality, lacking vitamins 
       b.Not enough food – measuring nofood variable
       c.Being eaten by adults
       d.Old age death


The graphical user interface of the simulation is shown below:


In the center we have our kennel with hamsters. On the left side of the interface we have three buttons and six sliders. On the right side we have seven monitors and one plot.



We use “setup” button in order to set up the kennel and create our hamsters, while “go” button starts the simulation. “Clean-environment” button triggers the function that cleans the kennel changing the food by setting the env-clean variable to its initial value (100) and resetting foodrot variable to 0.


We have seven sliders:


a.N-boyhamster and N-girlhamster sliders adjust the initial number of male and female hamsters in the kennel. 
b.P-spawn slider lets us set the probability of our hamsters spawning. The higher the probability is, more baby hamsters are born. 
c.FilterFoodKennel slider allows us to filter the environment, meaning cleaning from rotten food by increasing env-clean variable.
d.Amount-food slider adjust the initial amount of food in the kennel.
e.MaxNhamsters – sets up the maximum number of hamsters living in the kennel.



We have seven monitors:

a.Environment Cleanness –displays the rate of how clean the kennel is and counts the variable env-clean
b.Poor Quality Food Death – displays the total number of deaths caused by inadequate quality of water 
c.No Food Death – displays the number of dead hamsters due to the lack of food
d.Total Hamsters – shows the total number of alive hamsters in the kennel
e.Number Spawned – displays the total number of hamsters that were born during the simulation
f.Number eaten – shows the total number of eaten hamsters during our simulation. 
g.Old Age Death – displays the total number of dead hamsters due to their old age.



The plot is used for the visualization of the number of active (alive) male hamsters and female hamsters.

How It Works

1.We create the environment – the kennel - by pressing the button “ setup”

2.Using sliders, we choose the initial number of male and female hamsters and adjust the probability of spawning of our hamsters.We turn the food filter to an amount that is adequate for the number of hamsters in the kennel, and we adjust the amount of food that is provided to our hamsters.

3.The simulation is started by pressing the button “go”

Male and Female hamsters are placed in the kennel. Periodically, some amount of food is added to the kennel. As hamsters walk, they use energy from food, represented as green patches, and age. As hamsters eat, they gain energy, grow to adulthood and add waste to the kennel. Female hamsters eat smaller hamsters. Hamsters die if: energy runs out, they get too old, food quality is poor. Hamsters spawn according to a probability if male hamster and female hamster are near each other, are mature, have enough energy, and the food quality is good. If food (the green patches) is not eaten, it rots and pollutes the kennel. The filter cleans waste and pollution from kennel depending on the flow of the filter. By pressing clean-environment button we are changing the food in the kennel, which is a fast way to improve food quality. By changing the variable we can see the effects of variables on food quality and hamsters population. It’s interesting to monitor the relation between hamsters population and food quality. Also it’s noticeable the relation between amount of food and population range. By changing the variables from sliders we can watch how the hamsters spawn, the baby hamsters grow, are being eaten and grow! The monitors show us the reasons of deaths, and the number of deaths.


In order to make the simulation more realistic, I took the probability of hamsters spawning not higher than 0.5. Also, the maximal number of the hamsters living in the kennel was taken 200, since the kennel is not big enough. Our goal is to have the following statistics:

•No Food Death – as minimal as possible
•Old Age Death – better to have hamsters dead naturally 
•Number of Spawned – the more new babies we have – the better
•Number of Eaten – the least number of eaten hamsters we have in the kennel, the better
•Poor Quality Food Death – as minimal as possible 

I ran the simulation multiple times applying different settings for the same time period (the same number of ticks). I found the following cases the most interesting to focus on:


In the given six cases two cases satisfy 3 out of 5 aspects of our interest. I decided to elaborate on one of the cases, particularly:


For this case I decided to clean environment and monitor how our monitored numbers are changing. These are the results:


It is obvious from the simulation result that applying the more times we zoo cleans the kennel the least number of no food deaths we have, the higher number of old age deaths, the bigger number of spawned hamsters, the least number of eaten hamsters as well as the least number of poor quality food death we have.


By setting different ratio of male and female hamsters and changing probability of spawning as well as changing amounts of food and efficiency of filter, we found certain relation between the hamsters population, food amount and quality and hamsters deaths reasons. Applying different settings, we came to the conclusion that in order to have the lowest number no food death, eaten hamsters and poor food quality deaths and at the same time have the highest number of old age deaths and spawned hamsters, the zoo needs to set an appropriate rate of food and filtering of the food in the kennel. Moreover, the zoo has to make it sure that the kennel is big enough to have as many hamsters as possible. For our simulation we took the maximal number of hamsters living in the kennel at a time = 200. In our simulation the best relation was found when the food amount was set to 50 and filtering was 500, having the probability of hamsters spawning = 0.2. Moreover, it is recommended to clean the kennel as many as possible, since this leads to much better results.




Hamsters Eat Their Young [1]

Wild Hamsters Forced to Eat Their Own Babies [2]

Hamster-mom Kills Babies [3]