Discrete Event Simulation in Python
Diogo Costa (PhD, MSc)
Adjunct Professor, University of Saskatchewan, Canada & CEO of ImpactBLUE-Scientific
Continuous models
Run at fixed time steps
Time is a dummy variable
Use of time for-loops
for t range(time_range):
Discrete-event models
Run at variable time steps
Time is a state-variable
Often uses while-loops
while (time < 365):
time += process_duration
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)
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 timeExample: 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