Name: SA421 – Simulation Modeling Asst. Prof. Nelson Uhan Fall 2015 Exam 2 Instructions ● You have 48 hours to complete this exam. ● No collaboration allowed. All work must be your own. ● You may use your notes and homework, as well as files and websites directly linked from the course website. ● You may not use any other materials. ○ In particular, you may not use the Internet, except for files and websites directly linked from the course website. ● You may not share materials with other midshipmen. ● Show all your work. It is your responsibility to make sure that I understand your work. You will be awarded partial credit if your work merits it. ○ In particular, carefully document your code, either through comments in code cells or formatted text in Markdown cells. ● Before you begin ○ Download the .ipynb files for this exam from the course website. There are 3 of them: ◇ exam2p1.ipynb ◇ exam2p2.ipynb ◇ exam2p3.ipynb ● When you are finished ○ Submit your .ipynb files using the SA421 Assignment Submission Form. ○ Sign the honor statement below in ink. I pledge on my honor that I have not used any unauthorized materials, and that I have not given or received any unauthorized assistance during this exam. Signature: 1 Problem 1. (20 total points) Place your work in exam2p1.ipynb. a. (15 points) Using the inverse transform method, generate 50 random variates of random variable X with cdf ⎧ 0 ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ 0.3 ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪0.4 FX (a) = ⎨ ⎪ 0.7 ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ 0.95 ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩1 if a < 1 if 1 ≤ a < 2 if 2 ≤ a < 4 if 4 ≤ a < 8 if 8 ≤ a < 16 if a ≥ 16 Print your variates. b. (5 points) In words: what goodness-of-fit test would you use to determine whether the random variates you generated in part a are indeed from X? Why? 2 Problem 2. (40 total points) Place your work in exam2p2.ipynb. When customers call Fluttering Duck Airline’s toll-free number to make or change reservations, they may be placed on a “hold queue” until an agent is available. Some customers will hang up if they are on hold too long. Based on historical data, Fluttering Duck has determined that calls from customers arrive according to an exponential interarrival time distribution with a mean of 1 minute. On the other hand, the time that a customer will wait on hold before hanging up is uniformly distributed between 15 and 25 minutes. Fluttering Duck’s call center has 3 agents who handle calls individually. The duration of a call is uniformly distributed between 10 and 20 minutes. In addition, Fluttering Duck’s call center system can only handle 20 calls in the hold queue. The system asks any customer calling when the hold queue is full to call back later, and then hangs up on the customer. a. (20 points) Model one day’s (24 hours) operation of this system in SimPy. Use a separate random number stream for every random quantity in your model. b. (7 points) Using 100 replications, estimate the mean fraction of customers that are asked to call back later. Print this estimate. Fluttering Duck wants to know if it can decrease the mean fraction of customers asked to call back later by adding another agent. c. (3 points) Using 100 replications, estimate the mean fraction of customers that are asked to call back later when there are 4 agents in the system. Print this estimate. d. (7 points) Use an independent two-sample t-test with significance level 0.05 to determine if the estimates you computed in parts b and c are equal or unequal. Print the observed test statistic and p-value. e. (3 points) What does the result of the t-test tell you? What would you recommend to the airline? 3 Problem 3. (40 total points) Place your work in exam2p3.ipynb. The Dijkstra Brewing Company is throwing a party to celebrate its new beer, Primal Pilsner. Dijkstra is trying to determine how many bartenders and how many kegs it will need for this party. Based on past parties, the company anticipates two types of customers: ordinary and thirsty. Ordinary customers arrive at the bar according to an exponential interarrival time distribution with a mean of 2 minutes. Serving each ordinary customer takes between 1 and 3 minutes, uniformly distributed, and each of these customers orders 1 pint of beer. On the other hand, thirsty customers arrive at the bar according to an exponential interarrival time distribution with a mean of 4 minutes. Serving each thirsty customer takes between 3 and 5 minutes, uniformly distributed. Each thirsty customer orders 1, 2, or 3 pints of beer, according to the following probability distribution: Number of pints ordered Probability 1 0.2 2 0.5 3 0.3 One keg holds 124 pints. Suppose that there are 2 bartenders, and the party starts with 1 keg. The bar is set up so that there is a single queue for these 2 bartenders. a. (20 points) Model this system in SimPy, stopping your simulation when a stockout occurs: i.e., when there is not enough beer to serve a customer’s order. Use a separate random number stream for every random quantity in your model. b. (7 points) Using 100 replications, estimate the mean stockout time. Print this estimate. c. (7 points) Using 100 replications, estimate the mean time average number of customers in the queue. Print this estimate. d. (6 points) Based on your answers to parts b and c, what would you recommend to the Dijkstra Brewing Company? If you think the system (party) requires further study, what additional steps would you suggest? (e.g. additional simulations, statistical tests, etc.) You do not need to carry out these steps, you just need to describe what you would do. 4