Question: Python problem Finish the program, fill AA, BB, CC, DD, EE,FF import numpy import matplotlib.pyplot as plt import QueueTools as qt # Execute in a

Python problem

Finish the program, fill AA, BB, CC, DD, EE,FF

import numpy import matplotlib.pyplot as plt import QueueTools as qt

# Execute in a command window if needed: # python -m pip install --upgrade pip # pip install numpy # pip install matplotlib

# QueueTools.py should be in the same location as this program. # See below for documentation of the QueueTools functions: # "MMs", "ME2s1", "ME2s2", and "queuesim".

### DATA

kmax = 2 smax = 3 duration = 4000

### INITIALIZATION

kvals = [i+1 for i in range(kmax)] # 1 ... kmax svals = [i+1 for i in range(smax)] # 1 ... smax musigsqvals = [1/k for k in kvals] musigsqvals.append(0)

rho1 = [.05+.05*x for x in range(9)] # .05, .10 ... .45 rho2 = [.5+.02*x for x in range(21)] # .50, .52 ... .90 rhovals = rho1+rho2 pts = len(rhovals)

axes = [0,smax,0,6]

### MAIN PROGRAM

for s in svals: print("") print("s = "+str(s)) if s==1: # Use M/G/1 theoretical result print("max Lvals for M/M/1, M/E2/1, M/D/1") for musigsq in musigsqvals: f = .5*(1-musigsq) Lvals = [AA for rho in rhovals] print(max(Lvals)) plt.plot(rhovals,Lvals) # check with qt.MMs and qt.ME2s1 Lvals = [BB for gamma in rhovals] print("max Lvals for M/M/1") print(max(Lvals)) plt.plot(rhovals,Lvals) Lvals = CC print("max Lvals for M/E2/1") print(max(Lvals)) plt.plot(rhovals,Lvals) else: gammavals = [s*rho for rho in rhovals] for k in kvals: print("s = "+str(s)+", k = "+str(k)) if k==1: # Use M/M/s computer result (qt.MMs) Lvals = [DD for gamma in gammavals] elif [k,s]==[2,2]: # Use M/E2/2 computer result (qt.ME2s2) Lvals = EE else: # Use simulation for M/Ek/s, k>2, s>2 Lvals = [qt.queuesim(s,1,gamma,1,k,duration)[2] for gamma in gammavals] plt.plot(gammavals,Lvals) # Use simulation for M/D/s, s>1 print("s = "+str(s)+", type D") Lvals = [qt.queuesim(s,2,gamma,1,0,duration)[2] for gamma in gammavals] plt.plot(FF) plt.axis(axes) plt.xlabel("gamma") plt.ylabel("L",rotation=0) plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!