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

Exercise

Manufacturing Optimization: Search & Stop

Let's use the wall-clock factory model created in a previous exercise and deploy a "Search & Stop" optimization approach based on Monte Carlo sampling to identify the critical bottlenecks processes.

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.

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

The plot_results() method to generate the plots in this exercise has been pre-loaded and is shown below.

def plot_results():
    df_disc = pd.DataFrame({cNam[0]: process_line_space, cNam[1]: time_record})
    fig = sns.lineplot(data=df_disc, x=cNam[0], y=cNam[1], marker='o')
    plt.grid()
    fig.set(xlim=(0, len(processes)))
    fig.set(ylim=(0, 180))
    fig.set(xticks=process_line_space)
    plt.plot() 

The Monte-Carlo sampling loop will produce a series of possible process trajectories and stop when the desired condition has been met, as shown in the figure. Monte Carlo trajectories for different process scenario.

Instructions

100 XP
  • Set a loop to run simulation trajectories while run_i is equal to zero or total_duration[run_i] is higher than 85 hours (i.e., stop condition: total_duration[run_i] equal or less than 85 hours).
  • Run the Monte Carlo engine stored in the function run_monte_carlo().