1. Learn
  2. /
  3. Courses
  4. /
  5. Discrete Event Simulation in Python

Exercise

Monte Carlo sampling for discrete-event models

Imagine a factory that produces wall clocks. The clocks have been growing in popularity, and now the demand is higher than the production capacity. The factory has been working at full capacity for months, and you want to understand its behavior and bottlenecks better so that more informed management decisions can be made and plan future investments and expansion.

A discrete-event model of the factory processes has been developed, and now you want to run a Monte Carlo sampling analysis to explore scenarios. The manufacturing process is summarized in the table below, and the information has been stored in a list of dictionaries named processes, with one dictionary per process. The keys of this dictionary correspond to the table column headers. The following packages have been imported for you: numpy as np, matplotlib.pyplot as plt, seaborn as sns, random, pandas as pd, and time.

Table with process names and their duration statistics, namely mean and standard deviation.

The Monte-Carlo sampling loop will produce a series of possible process trajectories, as shown in the figure. Monte Carlo trajectories for different process scenario.

Instructions

100 XP
  • Set up the main Monte Carlo sampling for-loop for n_trajectories samples with dummy variable t.
  • Use the Gaussian distribution from the random package to pseudo-randomly estimate the process duration.