In: Computer Science
IN PYTHON
Develop a program in python that includes a number of functions for the multi-server queue. The program accepts arrival and services rates and the number of servers and calls your functions to output the average number of customers and average waiting time in the system.
I multi server queue we need to output the average number of customers and average waiting time in the system. We will use following formulas -
Below is the python program for above formulae's
'''
Run the following code in online python compiler
"https://www.onlinegdb.com/online_python_compiler"
'''
import math
lmbda = float(input("Enter arrival rates"))
srvc_rate = float(input("Enter services rates "))
num_srvs = int(input("Enter the number of servers"))
rho = (lmbda/(num_srvs*srvc_rate))
summ = 0.0
for m in range(num_srvs):
summ = summ + ( (pow((rho*num_srvs), m))/(math.factorial(m)) )
sumt = (pow((rho*num_srvs),
num_srvs))/((math.factorial(num_srvs))*(1-rho))
tot = summ + sumt
prob_zero_cust = 1/tot
lengque = (prob_zero_cust*rho*pow((lmbda/srvc_rate),
num_srvs))/((math.factorial(num_srvs))*(1-rho)*(1-rho))
lengsys = lengque + (lmbda/srvc_rate)
avg_wait_sys = lengsys/lmbda
print("average number of customers and average waiting time in the system",lengsys,avg_wait_sys)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I have implemented above code based on formulae's I know. The above code can be modified as conditions changes in multi server queue model.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////