Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Experimenting With the Simulation

00:00 In this lesson, you’re going to play around with the simulation and see if you can identify the minimum number of employees needed to attain the goal of 10 minutes or less wait times. One way to start the experiment is to try and max out the resources.

00:14 So let’s do this real quick. Go ahead and run the simulation, and try 100 of each type of employee. So say 100 cashiers, 100 servers, and 100 ushers.

00:26 And if you look here, your average wait time is down at 3 minutes and 46 seconds, which is great, but there’s no way that the manager is going to want to hire 300 employees.

00:37 So now you can play around with different numbers of each position and see how much they affect the overall wait times. So for example, you can see with how quickly the ushers check tickets, they don’t have a drastic effect on how long the moviegoers are waiting.

00:51 Let’s say you have 100 cashiers, 100 servers, but let’s say you only had 3 ushers working—you can see that the average wait time is 3 minutes and 46 seconds.

01:01 If you want to take a look at that again, with 100 of each, you can see that the wait time is still 3 minutes and 46 seconds. So the ushers don’t really have a big effect on the wait times.

01:12 This means that you can likely get away with many fewer ushers than the other positions.

01:18 A major goal in engineering is identifying the rate-limiting steps. So if you can find which position is having the largest effect, you can focus your attention there.

01:27 This may mean either increasing the number of employees at that position or fixing the process so that it takes less time to complete.

01:35 Let’s go ahead and try that out with the cashiers. If you only had 1 cashier working, but had 100 servers—and let’s go back to 100 ushers, even though that we know that they don’t have a big effect. That goes ahead and increases the average wait time to 41 minutes and 17 seconds, from 3 minutes, which is huge.

01:53 You can think about this like at a grocery store, where you likely don’t have to wait to find a parking space or wait to select your goods, but you generally have to wait in line at the cashier. In this case, the checkout line at the register is the rate-limiting step and would be the focus for moving customers through the store quickly. Likewise, let’s see how the servers affect. So if you had 100 cashiers, only 1 server, and then 100 ushers, you can look and see that the average wait time drops down to 5 minutes and 52 seconds, which shows that the servers have a bit of an effect, but not as much as the cashiers. Keep in mind that only half the customers actually want to get food and affect the server resources.

02:36 If more moviegoers decided to go to the concessions area and request servers, they would likely have a greater effect. Feel free to experiment with different numbers of employees to see if you can get the average wait down to 10 minutes or less, but if you need a possible solution, you can look at the full code to see one way to do that.

02:55 Don’t be afraid to play around with how you put these parameters in either. You might notice that it’s tedious to continually enter in different numbers of positions, so this may be a good candidate for a loop to test out.

03:06 It’s really up to you on how you address the issue. And with that, you should be all set on using simpy to simulate processes using Python.

03:15 We’ll take a few minutes to wrap up what you’ve learned about how to set up these simulations.

matthew3060 on Oct. 3, 2023

Is there a way to compute the usage of a resource? By doing this you can eliminate the guess work by knowing that a resource is at near 100% utilization, so it must therefore be a limiter in the process.

Become a Member to join the conversation.