Stop The Spread. Image created by Hazem Asif. Submitted for United Nations Global Call Out To Creatives |
To build the simulation I used the python programming language and the Object-oriented programming paradigm. I did not use any python library to build the simulation environment itself. It is just two classes to represent the Agents and the Simulation.
Classes
- Simulation
- The class that stores the list of agents in the simulation and "performs tasks" such as updating the health status, the quarantine zone, and move the agents on each day of simulation.
- Agent
- The class representing the agent where we defined each agent's characteristics such as age, position in the environment, health status, name, number of days with the virus, and so on.
The simulation is based on random agent behaviours to simulate the free will of real persons. So, the functions to move the agents use a randomly generated number in the x-axis and y-axis. I also added a parameter to limit the agent's movement ray to test cases where the agents' moves are limited, and a social distancing value that forces the agents to choose a position, when they need to move, with a distance to another agent greater than the social distance value.
As you must already found out, the simulation has two dimensions to represent the agent's position (x-axis and y-axis). The environment's size is also configurable to evaluate the free space impact in the virus spread.
With regard to the agents, we have two different ways of creating them:
- We can create n agents based on probabilities of being Healthy, Sick, Asymptomatic, or the agent's immune system response to the virus being moderately infected, etc.
- The other possible way is by specifying the number of agents of each type of health status and immune system response.
The age influence
In the random beginning approach, I use probabilities based on real data from my country when it comes to death data by age range. The data was retrieved from the response of one service from this site. After that, I stored the data to have it in a file (I chose not to call the service and avoid that implementation since it takes time). Then I handle the data so I can have, for instance, the percentage of people that die grouped by age range. You can find that logic at the end of constants.py file. In other cases, I simply defined probability values that I think are valid. Almost all values can be changed in the configuration file (config.yaml) if you want to test the Simulation. The file also includes the variables' meaning in the simulation context through code comments.
Comments
Post a Comment