# The mean number of customers in the queue (Lq), and the average time spent in the queue (Wq) - finite capacity M/M/1

This question is a part b of an example sheet. what I have worked out so far is that customers enter the shop at a rate of 20 per hour. There is a single server and the mean service time is 3 mins. The capacity of the shop is 4 customers.

Ls = 2 (the mean number of customers in the shop)

Ws = $\frac{1}{8}$ (the mean length of time a customer spends in the shop)

and I know that ρ=1 as we get that from λ/u

So the part I am stuck on is that some customers are put off by the prospect of having to wait. Specifically, if there is no one in the shop when a new customer arrives then that customer stays. However, if there are n customers already in the shop on arrival, then the new customer only stays with probability 1/(n + 1), (for all 1 ≤ n ≤ 3).

For the steady state, calculate the mean number of customers in the queue (Lq), and the average time spent in the queue (Wq).

what I have thought aout doing so far is to say that the steady state is

$\frac{λ}{n+1}$Pn = $\mu$Pn+1 which I don't know what I can make it into from here to continue the question? Any help would be much appreciated.

Let $X(t)$ be the number of customers in the system at time $t$. The process $\{X(t): t\geqslant 0\}$ is a continuous-time Markov chain taking values in $\{0,1,2,3,4\}$. For each $i$, let $$\pi_i = \lim_{t\to\infty} \mathbb P(X(t) = i).$$ The the limiting distribution $\pi$ satisfies the detailed balance equations $$\frac{\lambda}{i+1}\pi_i = \mu\pi_{i+1},\;\; 0\leqslant i\leqslant n-1.$$ Since $\lambda=\mu=20$, this simplifies to $$\pi_{i+1} = \frac1{i+1}\cdot\pi_i,$$ and hence $\pi_{i+1} = \frac1{(i+1)!}\pi_0$. Since $\pi$ sums to $1$ (as it is a probability distribution), we have $$\pi_0 = \left(\sum_{i=0}^4 \frac 1{i!} \right)^{-1} = \frac{24}{65},$$ thus $$\pi = \left(\frac{24}{65}, \frac{24}{65}, \frac{12}{65}, \frac{4}{65}, \frac1{65}\right).$$ The average number of customers in the system is given by $$L = \sum_{i=0}^4 i\cdot\pi_i = \frac{24}{65} + 2\cdot\frac{12}{65}+3\cdot\frac4{65}+\frac1{65} = \frac{64}{65}.$$ The effective arrival rate to the system, given that customers may choose to balk, is $$\lambda_{\mathsf{eff}} = \lambda\sum_{i=0}^3 \frac1{i+1}\cdot\pi_i=20\left( \frac{24}{65}+\frac12\cdot \frac{24}{65}+\frac13\cdot \frac{12}{65} + \frac14\cdot\frac{4}{65}\right)=\frac{164}{13}.$$ We use Little's law to compute the mean sojourn time: $$W = \frac L{\lambda_{\mathsf eff}} = \frac{64}{65}\cdot\frac{13}{164} = \frac{16}{205}.$$