At this stage of our project, we focused more on exploiting parallelism, rather than developing high-precision probability equations based on numerous factors. However, we tried to model our environments as closely as possible to the real world, so we took into consideration the following factors: person age, wealth distribution, population density, political rating and pollution. In addition, we created models for vaccine/cure development and distribution, as well as how viruses were affected by them.



We initialize the simulation with 6 different zones that have attributes to make these zones represent living environments we might have in the real world. A zone has attributes population, land area, the quality of healthcare, the level of pollution, and the efficiency of the government. In order to represent a city like Cairo, we would initialize a zone with very high population density (Cairo has one of the highest densities in the world) using the same population and area statistics that Cairo has. We also give it a high value for pollution level, and low values for efficiency of government (in light of recent events there) and low-medium value for healthcare. In the same manner, we have each of the zones represent 6 cities in the real world: Singapore, Mumbai, Cairo, Tokyo, New York City, and Zurich.

Propagation of Viruses

We run the simulation with 3 real world viruses, the flu, HIV and Ebola. When deciding how the virus propagates and infects people, we try to make it as close to reality as possible. For most viruses, around 1 percent of infected people have some gene that makes them immune to the harmful effects of the virus. We mimic this effect, by having 1 percent of the people in each zone immune to a virus when we first introduce the virus into the zone. Initially, we simply choose 10-20 random people in the zone to infect in order to start the propagation. When it comes to propagation, it gets more complex. Each infected person has a probability to infect the people physically around him. This probability changes depending on the virus.

The Flu

For the Flu, young and old people have a higher probability to be infected and if the person infecting others is younger, the probability is higher as well since younger people tend to be more active and move around more, increasing the chance of contact with others. Furthermore, zones with higher pollution levels have higher infection probabilities.


For HIV, we assume that children are much less sexually active so people below the age of 13 are much less likely to get HIV. Also, if the person infecting and the person being infected have a large age differential, the chances of them being sexual partners is much lower so we take that into account too. Finally, the quality of healthcare in a zone matters more for HIV in propagation as it can be spread through needles, blood donation drives etc.

The Ebola

For Ebola, it is an extremely dangerous and highly contagious virus that does not discriminate. So everyone has an equal probability of getting infected by it in the same zone. However, zones with lower pollution levels will have comparatively lower infection probabilities for Ebola.

We also note that we can have multiple viruses infecting a zone (all 3 in the worst case). Also, in every time step of our world, we update the time left for each person in each zone. People infected with more viruses lose more time and once their time left reaches zero, we have them die.

Mutation of viruses

Another way in which the propagation of viruses simulates reality is that the virus has a chance of mutation when transmitted from 1 person to another. This is different from evolution. The virus is still similar; we just have different strains of the same virus. We give each virus an unique id. When the virus is transmitted to another person, we give the virus in that new person a different id only if the virus successfully mutates, or else we give it the same id. Ebola has a 40-50% chance of mutation, the flu has a 70% chance and HIV has approximately 85% chance.

Finding and Distributing Vaccines, Cures

We also implement vaccines and cures into our simulation in order to test out virus evolution and more viruses. We only introduce a vaccine and cure for the virus into a zone when a certain amount of time has passed since the virus was brought into the zone or when a certain percentage of the population has died from the virus. In the real world, coming up with a vaccine and cure isn’t that easy and it might take years to come up with one so we don’t take up this trait. However, each zone has a wealth attribute. We follow real world trends by having only 1 zone come up with the vaccine and cure and have it distribute them to the rest of the zones. We give each zone a probability to come up with the vaccine and cure. This probability takes into account randomness, the wealth of the zone, the number of people in the zone (human resources), the quality of healthcare, the efficiency of the government, and the amount of people who have died from that virus in this zone (a higher number would lead to a higher sense of urgency in finding a cure). The zone with the highest probability in the end distributes vaccines and cures to the rest of the zones. We have unlimited vaccine numbers but for cures, similar to the real world, we make them limited. Each zone has a friendship level with every other zone. Thus, the distributing zone first uses cures for all of its infected population and then gives cures to the other zones proportionately in accordance with their friendship levels. Zones that get more cures then get an increase in friendship level with distributor and zones that get fewer cures have a decrease. This is similar to how real world relations between countries work.

Propagating Vaccines, Cures

In the real world, vaccines and cures do not always work, due to mutations of viruses. We try to follow this logic by implementing it such that cures and vaccines have their own strength attribute. For cures, if the virus has an id that is 0 modulo (strength), then the infected person is cured of the virus and made immune to all mutations of the virus that satisfy the criteria of having id divisible by strength. For vaccines, the situation is the same, except that vaccines do not cure infected people, they are only given to uninfected people in order to make them immune to all mutations of the virus that satisfy the criteria of having id divisible by strength of vaccine. Each zone spreads its cures to as many people as possible, and then gives vaccines to everyone.

Evolution of Virus

At this point, the virus has a chance to evolve from interaction with vaccines, cures and the human body. In the real world, a virus usually remains dormant for some period of time and then it sometimes comes back more dangerous and contagious than ever in an evolved form, which is now immune to past vaccines and cures. We simulate this in our implementation as well. After spreading vaccines and cures, we give the virus a dormant attribute as everyone is immune to its effects. At this point, people can still propagate the virus and infect others, but the virus can’t cause people time left to decrease faster since it has not harmful effects on them. The virus remains dormant for some amount of time, after which we try to evolve the virus with some probability.

Evolution depends on some level of randomness, but also on other factors. A virus evolves through mutation. If there are enough of the same mutations (i.e. the person infected with that mutation did not die), then it becomes possible for the virus to evolve. We go through all previously infected people by that virus and the various mutations. We find the most common mutation, that is also immune to past vaccines and cures, as well as modify other aspects of the virus attributes (such as strength and most_effected_age) in order to speed up propagation of the virus. These modifications are made by going through all previously infected people’s data and looking at the most common age infected, amongst other information.


How Realistic Is It?

More Documentation