Access over 20 million homework documents through the notebank

Get on-demand Q&A homework help from verified tutors

Read 1000s of rich book guides covering popular titles

Anonymous

In this homework assignment you will be building a program to simulate epidemics, which involve the rapid spread of infectious diseases over social networks of contact or physical proximity between people. A social network can be represented by a set of nodes, representing people, connected by edges, denoting relationships between people. In the case of modeling infectious diseases, these relationships could represent physical contacts or close physical proximity between people, allowing for the transmission of disease from one person to another. These relationships are *undirected*, meaning that either person could transmit the disease to the other person.

Many models have been proposed to simulate epidemics. In this homework assignment, you will implement a model known as the Susceptible-Infected-Recovered or *SIR model*, which is commonly used in epidemiology. The version of the SIR model we consider operates in discrete time steps. Each node (person) is in one of the three states at each time step: susceptible, infected, or recovered. Initially it is assumed that a few nodes are infected, and all of the other nodes are susceptible. At each time step, each infected node may independently infect a neighbor (another node connected with an edge to the infected node) with a certain *infection probability *if the neighbor is in the susceptible state. If the infected node is successful at infecting a neighbor, the neighbor node takes on the infected state *at the next time step*. The last point is crucial—*the newly infected neighbor cannot begin infecting nodes until the following time step!*

After each infected node has attempted to infect his or her neighbors, he or she independently recovers from the infection with a certain *recovery probability*. Once a node has recovered, he or she cannot be infected with the disease in the future. This effect simulates the human immune system building up an immunity to the disease. A time step is complete only after each infected node has attempted to infect each of his or her neighbors and has attempted to recover from the infection. The simulation is continued over many time steps, and the nodes will change state as the disease spreads throughout the population and as people recover from the disease.

An example of two simulation runs with 100 people is shown in below. In the simulation on the left, a massive outbreak occurred, and every single person caught the disease, since the number of recovered ended up at 100. On the right, a smaller outbreak occurred, and only around 30 people caught the disease.

Figure 1. Results of two simulation runs from the SIR model you are implementing in this homework assignment.

EECS 1510 Spring 2020 Sections 009/011/093 Instructor: Dr. Kevin S. Xu Introduction to Object-Oriented Programming

In this homework assignment, you will create two new classes, EpidemicUndirectedGraph andEpidemicSimulation, to be placed in the package edu.utoledo.eecs1510.epidemics. The UML diagram for these classes is shown in Figure 2 below. I have provided you with the following files:

• Graph.jar: Java archive containing compiled Node, Edge, Graph, and UndirectedGraphsubclasses based on the solution to Homework Assignment 10.

• xchart-3.6.2.jar: Java archive containing the latest version of the XChart simple charting library for Java. See https://knowm.org/open-source/xchart/ for more info on XChart.

• PlotSeries.java: class with a single static method to plot 3 curves (for susceptible, infected, and recovered) on the same set of axes using XChart.

• TestEpidemic.java: class containing main() method to run the type of simulation shown in Figure 1 above.

Figure 2. UML diagram for this homework assignment. Details of UndirectedGraph class are excluded (see UML diagram from Homework Assignment 10 for details).

EECS 1510 Spring 2020 Sections 009/011/093 Instructor: Dr. Kevin S. Xu Introduction to Object-Oriented Programming

CLASS SPECIFICATION

The specification of the EpidemicUndirectedGraph class is as follows:

The specification of the EpidemicSimulation class is as follows (types of input parameters excluded):

SUBMISSION INSTRUCTIONS

A portion of your grade will be assigned based on adherence to OOP practices. *Submit only your fully implemented EpidemicUndirectedGraph.java and EpidemicSimulation.java source files! *Place both classes in a package called edu.utoledo.eecs1510.epidemics. *Do not include a **main() **method in your submission!*

Since the simulation is a random process, the result each time you run the program will be different. A correctly implemented program should generate SIR curves that look roughly like those in Figure 1 when you run the main() method in TestEpidemic.java. On some runs, however, no outbreak will occur because the initial infected person recovers without infecting anyone, in which case you will see 3 almost flat lines.

EECS 1510 Spring 2020
Sections 009/011/093
Introduction to Object-Oriented Programming
Instructor: Dr. Kevin S. Xu
Homework Assignment 12 (Honors Only)
Simulating Epidemics on Social Networks
Assigned: Friday, April 17, 2020
Due: Thursday, May 7, 2020 at 11:59pm
In this homework assignment you will be building a program to simulate epidemics, which involve the
rapid spread of infectious diseases over social networks of contact or physical proximity between people.
A social network can be represented by a set of nodes, representing people, connected by edges, denoting
relationships between people. In the case of modeling infectious diseases, these relationships could
represent physical contacts or close physical proximity between people, allowing for the transmission of
disease from one person to another. These relationships are undirected, meaning that either person could
transmit the disease to the other person.
Many models have been proposed to simulate epidemics. In this homework assignment, you will implement
a model known as the Susceptible-Infected-Recovered or SIR model, which is commonly used in
epidemiology. The version of the SIR model we consider operates in discrete time steps. Each node (person)
is in one of the three states at each time step: susceptible, infected, or recovered. Initially it is assumed that
a few nodes are infected, and all of the other nodes are susceptible. At each time step, each infected node
may independently infect a neighbor (another node connected with an edge to the infected node) with a
certain infection probability if the neighbor is in the susceptible state. If the infected node is successful at
infecting a neighbor, the neighbor node takes on the infected state at the next time step. The last point is
crucial—the newly infected neighbor cannot begin infecting nodes until the following time step!
After each infected node has attempted to infect his or her neighbors, he or she independently recovers from
the infection with a certain recovery probability. Once a node has recovered, he or she cannot be infected
with the disease in the future. This effect simulates the human immune system building up an immunity to
the disease. A time step is complete only after each infected node has attempted to infect each of his or her
neighbors and has attempted to recover from the infection. The simulation is continued over many time
steps, and the nodes will change state as the disease spreads throughout the population and as people recover
from the disease.
An example of two simulation runs with 100 people is shown in below. In the simulation on the left, a
massive outbreak occurred, and every single person caught the disease, since the number of recovered ended
up at 100. On the right, a smaller outbreak occurred, and only around 30 people caught the disease.
Figure 1. Results of two simulation runs from the SIR model you are implementing in this homework assignment.
EECS 1510 Spring 2020
Sections 009/011/093
Introduction to Object-Oriented Programming
Instructor: Dr. Kevin S. Xu
In this homework assignment, you will create two new classes, EpidemicUndirectedGraph and
EpidemicSimulation, to be placed in the package edu.utoledo.eecs1510.epidemics. The UML
diagram for these classes is shown in Figure 2 below. I have provided you with the following files:
•
•
•
•
Graph.jar: Java archive containing compiled Node, Edge, Graph, and UndirectedGraph
subclasses based on the solution to Homework Assignment 10.
xchart-3.6.2.jar: Java archive containing the latest version of the XChart simple charting
library for Java. See https://knowm.org/open-source/xchart/ for more info on XChart.
PlotSeries.java: class with a single static method to plot 3 curves (for susceptible, infected, and
recovered) on the same set of axes using XChart.
TestEpidemic.java: class containing main() method to run the type of simulation shown in
Figure 1 above.
Figure 2. UML diagram for this homework assignment. Details of UndirectedGraph class are excluded (see UML diagram
from Homework Assignment 10 for details).
EECS 1510 Spring 2020
Sections 009/011/093
Introduction to Object-Oriented Programming
Instructor: Dr. Kevin S. Xu
CLASS SPECIFICATION
The specification of the EpidemicUndirectedGraph class is as follows:
List of current states ('S', 'I', or 'R') of all nodes.
List of states all nodes will become after updateStates() is run.
Constructs an empty graph with no nodes.
Constructs a graph with the given list of nodes, all susceptible.
Constructs a graph from a CSV file containing the edges.
Returns the state of the given node.
Returns the number of susceptible nodes in the network.
Returns the number of infected nodes in the network.
Returns the number of recovered nodes in the network.
Sets the new state of the given node.
Sets the states of all of the nodes to their new states.
The specification of the EpidemicSimulation class is as follows (types of input parameters excluded):
EpidemicGraph object to simulate epidemic on.
Infection probability for each edge (between 0 and 1).
Recovery probability for each node (between 0 and 1).
List of number of susceptible nodes at each time step.
List of number of infected nodes at each time step.
List of number of recovered nodes at each time step.
Random number generator to use for infection and recovery.
Initializes a simulation with default parameters on g.
Initializes a simulation with given parameters on g.
Initializes a simulation with given parameters on g.
Initializes a simulation with given parameters on g.
Returns list of number of susceptible nodes at each time step.
Returns list of number of infected nodes at each time step.
Returns list of number of recovered nodes at each time step.
Advances simulation for the specified number of time steps.
SUBMISSION INSTRUCTIONS
A portion of your grade will be assigned based on adherence to OOP practices. Submit only your fully
implemented EpidemicUndirectedGraph.java and EpidemicSimulation.java source files! Place both
classes in a package called edu.utoledo.eecs1510.epidemics. Do not include a main() method in your
submission!
Since the simulation is a random process, the result each time you run the program will be different. A
correctly implemented program should generate SIR curves that look roughly like those in Figure 1 when
you run the main() method in TestEpidemic.java. On some runs, however, no outbreak will occur
because the initial infected person recovers without infecting anyone, in which case you will see 3 almost
flat lines.
...

This question has not been answered.

Create a free account to get help with this and any other question!

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors