Simulation CS Thinking Example 3

Follow the full solution, then compare it with the other examples linked below.

Example 3

medium
You are designing a simulation to model the spread of a disease through a school. What variables would you include, and what would you simplify?

Solution

  1. 1
    Step 1: Include: number of students, infection rate (probability of spreading on contact), recovery time, number of contacts per day. These directly affect disease spread.
  2. 2
    Step 2: Simplify: assume all students are identical (same susceptibility), contacts are random, and ignore factors like age, vaccination status, and room ventilation. Add complexity only if these simplifications produce unrealistic results.

Answer

Include: population size, infection rate, recovery time, contact rate. Simplify: uniform susceptibility, random contacts, ignore environmental details.
Designing a simulation requires balancing detail with tractability. Start simple, validate against real data, and add complexity only where the simple model fails.

About Simulation

Using a computer program to model and experiment with a real-world system or process. Simulations represent key variables and their relationships mathematically, allowing you to test scenarios, make predictions, and explore outcomes without real-world cost or risk.

Learn more about Simulation โ†’

More Simulation Examples