Best way to visualize queueing theory for a Lecture on Markov Chains

83 Views Asked by At

Let the Markov Chain $X:=(X_{n})_{n \in \mathbb N_{0}}$ denote, for every $X_{n}$, the number of people waiting in a line at time $n$. Now note that $X$ is a Markov Chain living on $\mathbb Z_{+}$. Then we denote $\rho$ as the probability mass function of new customers arriving in one time interval.

This leads us to the following definition of our transition matrix $\Pi$, namely, if $x,y \in \mathbb Z_{+}$ then

$\Pi(x,y)=\begin{cases} \rho(y) , \operatorname{ if}x=0\\ \rho(y-x+1) \operatorname{ if}x\geq1 \operatorname{ and} y\geq x-1\\ 0 \operatorname{ else} \end{cases}$

I have proven that if $\mathbb E[\rho]> 1$ then the state $0$ is transient, and conversely if $\mathbb E[\rho ]\leq 1$ then the state $0$ is recurrent.

But I want to visualize this, by showing that a graph comparing two queues with varying expectation (e.g. one where $\mathbb E[\rho]=0.95$ and another where $\mathbb E[\rho]=1.05$

In terms of computation, the trials (or the time intervals would only need to be $\pm200$ and preferably computing during my presentation, and choosing for example the Poisson distribution as the distribution to be investigated.

Those are my ideas, but I have no idea where to start in terms of software, can Mathematica help me out, particularly with regards to the varying expectation? How do I go about this?

Any advice/steps are greatly appreciated

1

There are 1 best solutions below

2
On BEST ANSWER

You can do this with any math software (such as Mathematica) or any reasonable language. I used Python. I attach a picture of the code, which you should try translating into your language / software of choice.

There are three cells. The first loads the required required mathematical module ("numpy") and a plotting module. It also defines your transition kernel.

The second cell steps through the Markov chain $N = 1000$ times. Note that the previous value $x[i]$ is used to determine $x[i+1]$, as in a Markov chain.

The final cell plots the results.

enter image description here

All this being said, this is not a mathematical software forum.