Queueing theory study waiting times in queues. The number of elements or individuals in the system, composed by queue and servers, can be estimated from arrivals and services which are described as mathematical process. In the M/M/k, using Kendall’s notation, arrivals occur according to a Poisson process and the service time is exponentially distributed. Param k describes the number of servers. To show an example, we are going to suppose a M/M/1 system, like a queue formed at a stadium or cash machine.

mu0 <- 0.15 lambda <- 0.2 N <- rep(0,100) for (n in 1:100){ mu <- ifelse(N[n]==0, 0, mu0) N[n+1] <- ifelse(runif(1)<=lambda/(lambda+mu), N[n]+1, N[n]-1) } plot(0:100, N, type="s", col="#1f78b4", xlab="n", ylab="Number of clients in the system", main="M/M/1")

Advertisements