[SOLVED] CS2233 Assignment 4- Discrete Event Simulation for Pandemics

39.99 $

Category: Tags: , , , ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-4-tatdpl.zip (239.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Consider an undirected graph G=(V,E) representing a population. Nodes of the graph are individuals. The presence of an edge between two individuals indicates that they are in close contact with each other (e.g, sharing a home or a workplace).
Generate a graph on 100 nodes as follows: for each pair of nodes, toss a fair coin and put an edge between them if and only if you get a heads. This gives you a population graph. Every individual is in one of the following states: susceptible, infected, or recovered (aka removed). The possible transition for each individual is susceptible to infected to recovered.
● Data Structures:
β—‹ Sets S, I and R.
β—‹ Binary heap with nodes having
β–  Node id
β–  TimeStamp
β–  Event type: Infection/Recovery ● Initially all nodes are in S.
● Choose a starting node arbitrarily and call it u.
● Insert this infection event in the min-Queue Q, with timestamp 0. ● While(;;)
β—‹ e<-DeleteMin(Q)
β—‹ If e is a Recovery event,
β–  R<- R U {e.nodeID}
β–  I<- I{e.nodeID}
β—‹ If e is an infection event,
β–  I<- I U {e.nodeID}
β–  S<- S{e.nodeID}
β–  Forall susceptible neighbors u of e.nodeId
● Generate an infectionTime as follows
β—‹ Toss a fair coin five times
β—‹ Let j be the first time a head comes (if a head doesn’t appear at all, u doesn’t get infected because of e.nodeid), continue to next neighbor ● Insert into Q:
β—‹ Node id:u
β—‹ TimeStamp: e.timeStamp+j
β—‹ Event type: Infection
● (If u did get infected) generate recovery event:
β—‹ Generate a random number k uniformly between
e.timeStamp+j and e.timeStamp+j+5 ● Insert into Q:
β—‹ Node id:u
β—‹ TimeStamp: k
β—‹ Event type: Recovery
1. Plot the number of susceptible, infected and recovered individuals, against i.
2. Compare the instant at which a node gets infected with it’s shortest distance from the start node s.

  • Assignment-4-tatdpl.zip