Introduction to discrete-event simulations

Discrete Event Simulation in Python

Diogo Costa (PhD, MSc)

Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific

Discrete-event models vs. continuous models

Continuous models

  • Run at fixed time steps

  • Time is a dummy variable

    • Time not updated inside the loop
  • Use of time for-loops

    for t range(time_range):
    

Discrete-event models

  • Run at variable time steps

    • Run/Schedule discrete events with different durations over time
  • Time is a state-variable

    • Time is updated inside the while-loop
    • Time is not a dummy variable
  • Often uses while-loops

    while (time < 365):
    time += process_duration
    
Discrete Event Simulation in Python

Components of discrete-event models

  • State-variables
  • Clock
  • Event list (or Process list)
  • Ending condition(s)
Discrete Event Simulation in Python

Model components

Example: Taxi company model

while (time < 10):

    # Process 1
    time_duration_1 = manage_requests()
    time += time_duration_1

    # Process 1
    time_duration_2 = dispatch_taxi()
    time += time_duration_2

Ending condition

while (time < 10)
  • Condition(s) that terminates simulation
Discrete Event Simulation in Python

Model components

Example: taxi company model

while (time < 10):

    # Process 1
    time_duration_1 = manage_requests()
    time += time_duration_1

    # Process 1
    time_duration_2 = dispatch_taxi()
    time += time_duration_2

Clock

time += time_duration_1
time += time_duration_2
  • time tracks current simulation time
  • Clock skips to next event start time as simulation proceeds
  • Time hops because events are instantaneous
Discrete Event Simulation in Python

Model components

Example: taxi company model

while (time < 10):

    # Process 1
    time_duration_1 = manage_requests()
    time += time_duration_1

    # Process 1
    time_duration_2 = dispatch_taxi()
    time += time_duration_2

State-variable

time
  • Reduce time between customer calling taxi and being dropped off

  • Variables that characterize system outputs and efficiency

Discrete Event Simulation in Python

Let's practice!

Discrete Event Simulation in Python

Preparing Video For Download...