# M/M/1 queue with customers leaving based on number of customers present at arrival

This question is about exercise 12 of the book "Queueing Systems" from Ivo Adan and Jacques Resing. The task is the following:

Customers arrive to the system according to a Poisson process with rate $$\lambda=1/3$$. If an arriving customer sees $$n$$ customers, he leaves with probability $$q_n=n/4$$, $$n=0,1,2,3,4$$ and joins the queue with probability $$1-q_n$$. The customers are served in order of arrival. The service time $$B$$ is exponential distributed, the mean service time is 3 minutes.

(i) Calculate the mean soujourn time $$\mathbb{E}[S]$$ (waiting time + service time) of customers deciding to get served.

(ii) Calculate the mean soujourn time $$\mathbb{E}[S]$$ (waiting time + service time) of all customers arriving.

Due to a preceding task, I already calculated the mean number of customers in the system $$\mathbb{E}[L]=128/103$$, that is correct according to the book. Now for task (i), I would simply use Little's Law $$\mathbb{E}[L]=\lambda \mathbb{E}[S]$$ and use $$\mathbb{E}[S]=\mathbb{E}[W]+\mathbb{E}[B]$$ to compute the mean sojourn and waiting time. In the solutions of the book, this is the answer to (ii).

In my understanding, (ii) cannot be computed because if customers would not leave, since we have $$\rho=\lambda \mathbb{E}[B]=1$$ and hence our system would be unstable.

What do I understand wrong? Can you help me?

About the stability of the system, we do not require $$\rho < 1$$ in this case because of the balking (the customers who leave the system because the line is too long). We require $$\rho < 1$$ in a regular $$M/M/1$$ queuing system because otherwise the queue length will go to infinity over time. But in the system with balking, the queue will stay finite even if $$\rho \ge 1$$, because people will leave the system without waiting for service.
Now, you are correct that you should use Little's Law here. But, you need to be careful about how you calculate $$\lambda$$. In part (i), because you want the sojourn time for only the customers who stay, you need to set $$\lambda$$ equal to the arrival rate for customers who stay. I think you are using the overall $$\lambda$$ instead. You would use the overall $$\lambda$$ if you wanted the sojourn time for all customers, not just those who stay. And that's what part (ii) is asking you, which is why your answer from part (i) was actually correct for part (ii).
• Thank you for your answer! How do I compute the $\lambda$ for part (i)? And, still I struggle with understanding why my queueing system does not become a "normal" M/M/1 queue in part (ii), how I understand it, I should compute the sojourn time as if every arriving customer (with rate $\lambda=\frac{1}{3}$) stay now. Could you explain that a little bit further? – Christina May 9 at 7:06
• For part (i), think of $\lambda$ as the number of customers who arrive and stay per hour. My guess is that the math you did to calculate $L$ will be useful here. For part (ii), $\lambda$ should equal $\frac13$, but the expected service time does not equal 3 -- it equals 3 for customers who stay and 0 for customers who leave. – LarrySnyder610 May 9 at 13:58
• Another follow up question: To compute the waiting time (in part (ii)) I would simply compute $E[W]=E[S]-E[B]$. The correct answer for $E[S]$ in that part is $E[S]=384/103$. I am sure that I cannot just do $E[W]=384/103 - 3$. Instead, I thought about $E[W]=E[S]- (3*\mathbb{P}(\text{customer stays})+0*\mathbb{P}(\text{customer leaves})$, where I thought that $\mathbb{P}(\text{customer stays})= \lambda_{\text{stay}}$ (so the $\lambda$ fot the customers who arrive and stay). That is again incorrect. Do you see my mistake in that assumption? – Christina May 17 at 9:04
• I think you need $E[W] = E[S-B|\text{customer stays}]\mathbb{P}(\text{customer stays}) + E[S-B|\text{customer leaves}]\mathbb{P}(\text{customer leaves})$, but the second term just equals 0. – LarrySnyder610 May 17 at 12:32