Final Project: Fast Food Restaurant Simulation 

General Instructions: Write a program that will use queues to simulate a fast food restaurant. Customers will arrive at the restaurant at an average rate (probability). Each food order will take a certain amount of time, according to a user-entered distribution. As each customer arrives it is placed in the queue. If the queue is filled to capacity, a second queue is opened and the queues share the accumulated load. A newly arriving customer will always go into the shortest queue, thereby acting as a natural balancing method. Whenever all open queues are filled to capacity, a new queue is opened, and the entire load is redistributed. Once a queue is open it is never closed. The object then is to find a minimum “correct” number of queues that will maintain servicing incoming traffic without overloading any of the queues. Since probability is a factor, we will assume that “one hour” of operation without any queue overload satisfies our objective. Specific Instructions: The restaurant will have a potential of 10 tables, but will only open as few as possible. The dynamic implementation of the queue ADT is recommended. In fact, the tables itself is an ADT with the ten tables and the table statistics – arrival rate, duration of service. The program will have a global “clock” which will be initialized to zero and increment by one for each simulated minute. For each minute, there will be a user-entered probability of an arrival. That is, there is a probability, say 0.20 (between 0 and 1.0) of a customer arriving at any one minute. So for each clock “tick”, a random number will be generated. A value < 0.20 can be interpreted as an arrival, none otherwise. Here is a simple method for generating the service duration: For instance, assume: 50% customers need < 5 minutes 70% customers need < 8 minutes 90% customers need < 10 minutes <= 100% customers need 15 minutes Note: you will interactively enter your own choices. We can interpret: 0.0 <= random number < 0.50 assigns a service time of 5 minutes; 0.70 <= random number < 0.90 assigns a service time of 10 minutes. The program then involves the following: 1. Initialize the clock, the queue, and queue statistics 2. Repeat a. Advance the clock b. Continue to service current customer (s) c. Check for new arrival: if arrival then set all parameters and en-queue at any minimum length queue d. Until stability of number of queues hold for an “hour” Hand in several different runs, each with different statistics. When a run “settles”, output the statistics i.e. probability of an arrival, the required number of queues, average waiting time, and the amount of time (in “hours and minutes”) to settle. If a run does not settle (i.e.: all then queues fill up completely), stop and print similar output along with “All Queues Full” message. Be sure to perform three or more runs with same statistics. Sample Simulation:
Powered by