这是份奥克兰大学数学系的统计运筹学作业辅导案例，学生在我们的帮助下获得了满意的成绩。

A new electricity retailer starts up with a call centre consisting of, initially, just one customer service agent, to whom every incoming call is routed. Callers wait on hold in a first-come-first-served queue to speak to the agent. Once they get through, the durations of the ensuing conversations will be modelled as independent random variables having the exponential distribution with mean 9 minutes. Consider a day on which customer calls arrive at rate $0.1$ per minute, enough to create a small queue.

(a) We’ll model the customer arrivals as a Poisson process. Explain why this is a reasonable thing to do. Also, in what respects might the Poisson model be not so realistic?

(b) Find the mean time required for a customer to contact the company, including time spent waiting on hold as well as service time, according to this model.

(c) When there are four or more customers in the system (including the one being served), any further callers hear a message advising them that call volumes are unusually high today, and they can expect to be waiting for a while. What fraction of callers will hear this message? (You can assume that callers never give up – they always wait on hold until they get through.)

(d) Use the queueing-simulation web page to perform a simulation of this system. Make an estimate, with $95 \%$ confidence interval, of the mean time that a customer spends in the system. Compare with your answer to part $1 b$.

(e) In its planning for future growth, the company wants to model a day on which the customer arrival rate is $0.2$ per minute, and there are two employees doing customer service. Make point estimates (no confidence intervals required) of the fraction of customers who will arrive at a time when four or more other customers are in the system if (i) waiting customers form a single hold queue; (ii) each server has their own hold queue, and arriving customers join the shorter of the two queues.

JJ takes Christmas seriously: not only does he like to dress up as Santa and give away presents to any small children within reach, he uses OR to plan ahead for the occasion. During the year, he plans to stock up on suitable small toys by buying them on TradeMe as and when they become available. He believes can make one such purchase every two weeks on average. If he doesn’t acquire enough presents this way, he can buy more just before 25 December, paying the full retail price.

(a) JJ models the number of TradeMe purchases during the year as a random variable $T$ having a Poisson distribution with mean 26. How do you think he came up with this distribution (and its parameter value)?

$\mathrm{JJ}$ is unsure how many presents he will need at Christmas (it’s a year in advance after all, and much may happen in that time), but he decides to model this quantity as a random variable $S$ having a uniform distribution on $[10,30]$ and independent of $T$. (JJ regards this as a reasonable modelling approximation, even though the actual number of presents required is an integer and $S$ has a continuous distribution.) So, the total number of presents he will buy is $X=\max (S, T)$, the greater of $S$ and $T$.

(b) Write some $\mathrm{R}$ code for generating random variates according to the distribution of $X$.

(c) Use your method from (2b) to generate a sample of 10000 random variates. Show them on a histogram.

(d) Use your sample from (2c) to estimate, with confidence intervals, (i) the mean of the distribution; (ii) $P(X<25)$.

(e) Calculate the exact value of $P(X<25)$ (the $\mathrm{R}$ function ppois is helpful). Does your confidence interval in $2 \mathrm{~d}$ (ii) contain the true value?

(f) JJ estimates that TradeMe presents will cost $\$ 12$ each on average, while presents bought at retail will cost $\$ 19$ each. Use your simulation to estimate the expected total amount he spends on presents. A confidence interval is not required.

Big Al’s tyre shop sees rising demand for cold-weather tyres each April and May as winter approaches. We will model Big Al’s customer arrivals as an inhomogeneous Poisson process with rate function $\lambda(t)=4+0.1 t$ per day for $0 \leq t \leq 60$, where $t$ is in days and $t=0$ corresponds to the first day of April. Each customer wants to buy either a single tyre (with probability $0.7$ ) or a complete set of four tyres (with probability $0.3$ ); these random demands are independent of everything else. Big Al’s current policy is to order 100 cold-weather tyres from a distributor whenever the number of tyres he has left in stock falls to 30 or less; the distributor always delivers the order 2 days after it is placed.

(a) Big Al reckons (correctly) that the expected number of customers for these tyres he’ll see during the 60-day period beginning on 1 April is about 420. Explain how he might have calculated this number.

(b) According to this model, what is the expected total customer demand for these tyres over the 60 -day period?

Construct a simulation, with 5000 runs, of the tyre sales and reordering process using the sim.inventory function. Assume that the shop has 100 tyres in stock initially. (Having initial stock equal to the reorder quantity is the default assumption made by sim.inventory.) You may find it useful to turn off plotting with show . plot=FALSE. Hand in

(c) a plot showing the number of tyres in stock over time, for one simulation run;

(d) a histogram estimating the distribution of the unmet demand fraction: the fraction of total tyre demand that Big Al cannot convert into sales, due to the shop being out of stock when a customer turns up;

(e) an estimate, including a $95 \%$ confidence interval, of the expected unmet demand fraction;

(f) the $R$ code for your simulation.

Now suppose that on 31 March, the distributor notifies Big Al that the delivery time will henceforth be three days instead of two.

(g) What (if anything) should Big Al do in response? Use additional simulations to support your answer.