Question: Exercise 1 . ( 1 0 0 points ) Epidemic Model In this exercise, we write code to simulate the spread of contagious diseases. In
Exercise points Epidemic Model
In this exercise, we write code to simulate the spread of contagious diseases. In particular, we assume:
There are m hosts of a certain contagious disease.
These hosts are located on a two dimensional grid.
There are three different types of hosts:
a susceptible hosts have not been infected by the disease
b infected hosts have been infected by the disease and have not yet recovered
c recovered hosts have recovered from the disease Note: recovered hosts will not be infected by
the disease any more
Initially there is a single infected host located at and the rest of the m hosts are susceptible hosts,
and they are randomly located on a D grid with edges that warp around like Pacman The center of the
grid is at and the four corners are at kkkkk k and k k respectively. When a host
moves outside of a border, they will appear on the opposite side. For example, if a host at x k moves
up they will appear at xk where k x k The hosts move according to a D random walk. Use
rand to generate a direction according to the following mapping:
up
right
down
left
When a susceptible host is at the same location as one or more infected hosts, the susceptible host becomes
infected and will be contagious at the next time step. An infected host will become a recovered host T time
steps after they are infected. As time goes by the number of infected hosts will eventually drop to When
this happens, the number of susceptible and recovered hosts will not change any more. The simulation will
be stopped at this moment. In the end, we print out the proportions of hosts which are susceptible, infected,
and recovered. Hint: the number of infected should always be zero at the end of the simulation!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
