
130520201343
Queueing Theory is used to evaluate systems that should not be queued in theory. That is, systems in which the number of items per minute (λ) is less than the number of items handled per minute (μ), i.e. λ <μ.
If the number of inflowing elements is greater than the service speed: λ => μ then a queue appears.
In combat conditions, when the planes returned from the front there was no way there was a queue. The methodology described below is used to determine the likelihood that an aircraft will safely land in an environment where theoretically there is no queue.
The following formulas come from the study: Hillier F.S., Lieberman G.J. Instruction of Operation Research. New York: McGrew Hill 1990 oraz Z. Jędrzejczyk, K.Kukuła, J.Skrzypek, A. Walkosz Badania operacyjne w przykładach i zadaniach, Wydawnictwo Naukowe PWN
Arrival rate: λ
These are planes arriving within a minute.
import numpy as np
import numpy as np
np.random.seed(148)
Λ = (np.random.random_sample(100)*1.0)
a= sum(Λ)
p= len(Λ)
λ = 1/(p/a)
print('Number of planes: ', p)
print('Sume of landing time: print('Arrival_λ: Λ[:14]
Service rate: μ
In our example, this is the number of aircraft arrived in one minute.
np.random.seed(148)
M = (np.random.random_sample(100)*1.2)
a= sum(M)
p= len(M)
μ = 1/(p/a)
print('Number of planes: ', p)
print('Sume of service time: print('Service_μ: Λ[:14]
Traffic intensity: ϱ
Traffic intensity is the ratio of arrival rate to service rate.
\bbox[#f3f3f3,12px,border:1px solid black] {
{ϱ}=\frac{λ}{μ}
} \qquad (1)
$$
ϱ = λ/μ
ϱ
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > service rate μ')
else:
print("The system is stable, you can calculate the probabilities!")
print('Arrival rate λ > service rate μ')
print('Arrival rate λ: print('Service rate μ: print('Traffic intensity ϱ:
The average number of airplanes waiting in the air for landing ψ:
\bbox[#f3f3f3,12px,border:1px solid black] {
ψ = \frac{?^2}{1-{?}}
} \qquad (2)
$$
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > service rate μ')
else:
ψ = ?**2/abs(1-?)
print('Average number of aircraft waiting≈
Probability of n pending items
The probability that there will be more than n waiting aircraft in the air.
\bbox[#f3f3f3,12px,border:1px solid black] {
p(n>n_0)= {?}^{{n_0}+1}
} \qquad (3)
$$
What is the probability that there are more than 3 planes in the air?
n=3
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > service rate μ')
else:
p3 = ?**(n+1)
print('The probability that there are more than 3 planes in the air≈
Probability of longer waiting than t¶
The time the aircraft waits for permission to land.
\bbox[#f3f3f3,12px,border:1px solid black] {
p(t>t_0)= {? e}^{-t_0 (μ-λ)}
} \qquad (4)
$$
What is the probability that the plane will wait for a landing over 3 minut?
## time in minutes
t=3
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > service rate μ')
else:
p4 = ?*np.e**(-t*(μ-λ))
print('The probability that there are more than 3 planes in the air ≈
Multiple service channel¶
We assume in this algorithm that the arrival of aircraft (arrival rate) has a normal distribution. Planes are directed to several nearby airports with the same level of service. The planes form a joint queue and fly to this airport, where a place has just vacated. To maintain system balance, inequality must be maintained:
$\begin{align}
λ < rμ &&\text{where r is the number of service channels} \tag 5\\
\end{align}$
\bbox[#f3f3f3,12px,border:1px solid black] {
p(n=0) = \displaystyle\frac{1}{sum_{n=1}^\infty}
} \qquad (6)
$$
The probability that there are no queues at r service stations.
\bbox[#f3f3f3,12px,border:1px solid black] {
p(n=0) =\frac{1}{\displaystyle\sum_{i=0}^{r-1} \frac{?^i}{i!}+\frac{?^r}{{\left(r-{?}\right)}{\left(r-1\right)!}}}
} \qquad (7)
$$
\bbox[#f3f3f3,12px,border:1px solid black] {
ψ =\frac{{?^{r+1}{p(n=0)}}}{{(r-?)}^2{(r-1)!}}
} \qquad (8)
$$
\bbox[#f3f3f3,12px,border:1px solid black] {p(n) =\begin{cases}
\frac{{ψ^n}{p(n=0)}}{n!}, & \text{if $n\le r$}
\frac{{r^{r-n}}{ψ^n}{p(n=0)}}{r!}, & \text{if $n\gt r$}
\end{cases}
} \qquad (9)
$$
The probability that the system has more than zero elements and elements is more than r channels.
\bbox[#f3f3f3,12px,border:1px solid black] {
p(n>n_0) =\frac{{r^{r-n_{0}}}{?^{n_{0}+1}}{p(n=0)}}{(r-{?})r!}
} \qquad (10)
$$
\bbox[#f3f3f3,12px,border:1px solid black] {
p(t>t_0) ={{p{(n>r-1)}}{e^{μt(r-ψ)}}}
} \qquad (11)
$$
We check for inequality:
λ<rμ¶
r=2
λ<r*μ
print('Arrival rate λ: print('Service rate μ: ϱ = λ/(r*μ)
print('Traffic intensity ϱ:
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
print("The system is stable, you can calculate the probabilities!")
print('Arrival rate λ > split service rate μ')
def factorial(n):
return 1 if (n==1 or n==0) else n * factorial(n - 1);
Since there are two airports, the time to accept the plane is 2*μ
Probability of no queues, pattern no. 7¶
$${
p(n=0) =\frac{1}{\displaystyle\sum_{i=0}^{r-1} \frac{?^i}{i!}+\frac{?^r}{{\left(r-{?}\right)}{\left(r-1\right)!}}}
}\qquad (7)$$
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
p7=1/((1+ϱ)+(((ϱ**r)/((r-ϱ)*factorial(r-1)))))
print('Probability of no queues ?(?=0)≈
Probability that you will have to wait in queue, template no. 10¶
$${
p(n>n_0) =\frac{{r^{r-n_{0}}}{?^{n_{0}+1}}{p(n=0)}}{(r-{?})r!}
} \qquad (10)$$
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
n0 = 0
p10 = ((r**(r-n0))*(?**(n0+1))*p7)/((r-?)*factorial(r))
print('Probability to wait in queue ?(?>?0)≈
Probability of two items in the queue: $p(n>2)$ where $n_0 =2$¶
n0 = 2
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
n0 = 2
p11 = ((r**(r-n0))*(?**(n0+1))*p7)/((r-?)*factorial(r))
print('Probability of two items in the queue: ?(?>2)≈
The probability that the item will have to queue over k minutes: $p(t>?_0)$¶
$${
p(n>n_0) =\frac{{r^{r-n_{0}}}{?^{n_{0}+1}}{p(n=0)}}{(r-{?})r!}
} \qquad (10)$$
$${
p(t>t_0) ={{p{(n>r-1)}}{e^{μt(r-ψ)}}}
} \qquad (11)
$$
## time in minutes
t0=10
t0=t0/60
print('n - unspecified number of units in the queue')
print('number of channels r =', r)
$ p(n>r-1) = p(n>1)$
equation ⟹ 10 for $p(n>1)$
n0=1
p12 = ((r**(r-n0))*(?**(n0+1))*p7)/((r-?)*factorial(r))
p12
# wzór 11
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
p13 = p12*(np.e**(-μ*t0*(r-?)))
print('The probability that the item will have to queue over n minutes: ?(?>?0)≈
What is the average number of plane waiting?!¶
${
ψ =\frac{{?^{r+1}{p(n=0)}}}{{(r-?)}^2{(r-1)!}}
} \qquad (8)$
if ϱ > 1:
print("The system is unstable, we do not carry out further calculations!")
print('Arrival rate λ > split service rate μ')
else:
p14 = ((?**(r+1))*p7)/(((r-?)**2)*factorial(r-1))
print('The average number of items waiting ψ ≈