Get startedGet started for free

Logistics eCommerce model: Analyzing results

Let's consider an eCommerce business that needs optimization. The main groups of processes involved are:

  1. "Request management",
  2. "Packaging", and
  3. "Shipment and delivery to client".

Each of these groups of processes involves many sub-processes and tasks. For now, you'll focus on creating the model at a high level, which can (and should) be refined as more information becomes available.

Preliminary research found that each process takes 2, 1, and 5 days to complete, respectively, with standard deviations of 0.2, 0.2, and 1 day.

You have built the SimPy model and generators. Time in the model is recorded in days. The following package has been imported for you: import matplotlib.pyplot as plt.

Let's run the model and analyze the results using cluster analysis.

This exercise is part of the course

Discrete Event Simulation in Python

View Course

Exercise instructions

  • Run the SimPy model stored in a SimPy environment named env for 5 years (assume no leap years).
  • Create a histogram of the model results stored in record_processes_list with 50 bins.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

env = simpy.Environment()
env.process(all_processes(env, inputs, record_processes))

# Run the SimPy model
env.____(until=___)

record_processes_list = [record_processes['Time Manage Request'],
            			 record_processes['Time Packaging'],
            			 record_processes['Time Shipping']]

# Create a histogram with 50 bins
plt.____(record_processes_list, bins=____, label=['Request', 'Packaging', 'Shipments'])
plt.legend(loc='upper right')
plt.xlabel('Duration (days)')
plt.ylabel('Number of occurrences')
plt.show()
Edit and Run Code