How a Simple Java Simulation Shows Mobility’s Role in COVID‑19 Spread
This article presents a Java‑based epidemic simulation that uses a normal‑distribution model and configurable constants—such as initial infections, transmission rate, hospital capacity, and mobility intent—to illustrate how different parameters affect virus propagation and control measures during the COVID‑19 pandemic.
Overview
A Java program models the spread of COVID‑19 using an object‑oriented approach. The total population and each individual's mobility intention are sampled from a normal (Gaussian) distribution, while the virus transmission probability is a fixed constant. The simulation tracks infection, incubation, diagnosis, and isolation over discrete time steps.
Key Parameters
public static int ORIGINAL_COUNT = 50;– initial number of infected individuals. public static float BROAD_RATE = 0.8f; – probability that a contact transmits the virus. public static float SHADOW_TIME = 0; – incubation period (0 for immediate symptoms; set to 140 to represent a 14‑day latent period). public static int HOSPITAL_RECEIVE_TIME = 10; – number of time steps from diagnosis to placement in isolation. public static int BED_COUNT = 0; – number of hospital isolation beds available at the start of the outbreak. public static float u = 0.99f; – average mobility intention; values close to 1 allow free movement, negative values model strict movement restrictions.
Adjusting these constants enables exploration of different outbreak dynamics.
Simulation Scenarios
Scenario 1 – No Hospital Beds, High Mobility
Configuration: BED_COUNT = 0, u = 0.99f. The infection spreads gradually at first but quickly overwhelms the nonexistent isolation capacity, illustrating the need for emergency medical facilities.
Scenario 2 – Adding Hospital Beds
Configuration: BED_COUNT = 100. With the same high mobility ( u = 0.99f) the spread is slower, but if mobility is reduced (e.g., u = 0.2f) the epidemic can be contained or even eliminated.
Scenario 3 – Extending Incubation Period
Configuration: SHADOW_TIME = 140 (14 days). The model shows a delayed but explosive increase in cases once the latent period ends, again exceeding hospital capacity.
Scenario 4 – Negative Mobility Intent
Configuration: u = -0.99f (strict movement restriction). Even with a long incubation period, the simulation demonstrates that severe mobility limits eventually bring the outbreak under control.
Insights
The experiments highlight that population mobility (parameter u) is the dominant factor shaping epidemic dynamics. Hospital capacity ( BED_COUNT) and response time ( HOSPITAL_RECEIVE_TIME) influence outcomes, but without controlling movement the virus spreads rapidly, especially after the incubation period ends.
Source Code
The full source code is publicly available on GitHub:
https://github.com/KikiLetGo/VirusBroadcast/tree/master/src
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
