Model modularity to optimize continuous development

Discrete Event Simulation in Python

Diogo Costa (PhD, MSc)

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

What is model scalability?

  • Expand capabilities over time
  • Without losing performance and breaking down

Term "scalable" model

  • Typical use: Ability to increase capacity based on user demand
  • In discrete-event models: Ability to expand and remain stable

Importance

  • Essential for long-term success and value of model
  • Ability to evolve
  • Good coding practices such as model modularity
Discrete Event Simulation in Python

Scaled and less-scalable models

Scalable model

Diagram showing a modular model that is more scalable because the code is properly compartmentalized so modules can be easily added, removed, or replaced without needing to change the model structure.

Less-scalable model

Diagram showing a less modular model that is less scalable because the code is not properly compartmentalized, so modules cannot be so easily added, removed, or replaced without changes to the model structure.

Discrete Event Simulation in Python

Model modularity

  • Interchangeable components (or modules)

  • Processes compartmentalized into separate functions

  • Modules called multiple times

  • Instead of creating copies of same code

Diagram showing a model composed of seven functions, where a model upgrade entailed replacing module "func_b" by module "func_b1", and adding module "func_f" between modules "func_c" and "func_d".

Discrete Event Simulation in Python

Example: replacing and adding modules

Old version

with counter.request() as request:
    yield request

    def func_a()
    def func_b()
    def func_c()
    def func_d()
    def func_e()

Updated version

with counter.request() as request:
  yield request

  def func_a()
  # def func_b() # Module replaced by
  def func_b1()  # Module replacement
  def func_c()
  def func_f()   # New module added
  def func_d()
  def func_e()
Discrete Event Simulation in Python

Let's practice!

Discrete Event Simulation in Python

Preparing Video For Download...