Non-deterministic events and processes

Discrete Event Simulation in Python

Diogo Costa (PhD, MSc)

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

Event non-determinism

NOTE: Terms "event" and "process" used interchangeably.

What is event (or process) non-determinism?

  • Inability of process to be predicted accurately
  • Process is referred to as "Non-Deterministic"

Why are deterministic processes important?

  • Natural and human-driven activities often involve non-deterministic processes
  • Every time they occur, they repeat in different way
  • Their duration cannot be determined accurately
  • May have strong impact on the system output
Discrete Event Simulation in Python

Examples of non-deterministic processes or events

Natural world

  • Moment a volcano will erupt
  • Exact moment it will rain
  • Time and location lighting will strike
  • Time and location a tornado will form

Human-driven or human-initiated processes

  • Moment machine will break
  • Moment one feels the need to go to bathroom
  • Moment baby starts crying
  • If commercial flight will be delayed
Discrete Event Simulation in Python

Representing non-deterministic events in discrete-event models

Non-deterministic processes

  • Produce non-repeatable impact on system
  • Unknown exact duration

Statistics

  • Represent variability in duration of processes
  • The random package is helpful for this

  • Example: random.randint(start, end)

import random

# Non-deterministic processes
process_1 = [5, 15]

while time < simulation_time:

   # Update simulation time: process_1
   time += random.randint(
               process_1[0], 
               process_1[1])

Discrete Event Simulation in Python

Representing non-deterministic events using SimPy

  • No specific methods to account for non-deterministic processes

  • Event duration variability calculated as for non-SimPy-based models

  • Pass right statistics to .timeout()

import random

# Non-deterministic processes
process_1 = [5, 15]

while True:

  # Update simulation time: process_1
  env.timeout(random.randint(
         process_1[0], 
         process_1[1]))
Discrete Event Simulation in Python

Let's practice!

Discrete Event Simulation in Python

Preparing Video For Download...