Question: I am getting incorrect values, Ws , Wq , Lq , and p _ state, c _ util and their tests failed. for the following
I am getting incorrect values, Ws Wq Lq and pstate, cutil and their tests failed. for the following MATLAB code: Run this test case to check your code
c ; Number of servers
lambda ; Average Arrival Rate per minute
mu ; Service rate
Nwait ;
Call the MMCQ function with the given parameters
Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait;
Ws Wq cutil, pdrop, pstate MMCQ;
Define a relative error function
relerror @x y absx y y;
Validate the results and print "PASS" or "FAIL" for each metric
if relerrorWs
fprintfWs f PASS
Ws;
else
fprintfWs f FAIL
Ws;
end
if relerrorWq
fprintfWq f PASS
Wq;
else
fprintfWq f FAIL
Wq;
end
if relerrorcutil,
fprintfcutil f PASS
cutil;
else
fprintfcutil f FAIL
cutil;
end
if relerrorpdrop,
fprintfpdrop f PASS
pdrop;
else
fprintfpdrop f FAIL
pdrop;
end
fprintfpstate: s
numstrpstate;
fprintfsumpstate: f
sumpstate;
Extra Tests: pstate
pstate should have Nwait probabilities
dispThe probability of being in state numstrNwait is numstrpstateNwait ;
dispThe probability of being in state is numstrpstate;
Check that the probabilities sum to
if abssumpstatee
dispThe probabilities sum to Test PASSED.;
else
dispThe probabilities do not sum to Test FAILED.;
end function Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait
INPUTS:
lambda arrival rate
mu service rate
Nwait Number of queue elements, not including servers
c Number of servers
OUTPUTS:
Ws Average wait in the system
Wq Average wait in the queue
cutil Average percentage of servers busy
pdrop probability the queue is full
pstate probability of each state
Calculate traffic intensity rho
rho lambda c mu; Calculate the traffic intensity
Calculate pprobability of no customers in the system
pdenom sumrholinspace c c factorial:crhoc factorialc sumrholinspacec Nwait, Nwait c factorialc;
pdenom pdenom crhoc factorialcrhorhoNwait rho;
p pdenom;
n :c;
term sumcrhon factorialn;
termccrhoc factorialccrhocrhoNwait crho;
pterm term;
Calculate the utilization factor
cbar rhoc factorialc p sumrholinspace c c factorial:crhoc factorialc sumrholinspacec Nwait, Nwait c factorialc;
System Utilization for finite call center queue systems with some probability of filling up and rejecting users
cutil cbar c; Calculate system utilization
Calculate pstate
pstate zeros Nwait ;
for n :Nwait
if n c
pstaten rhon factorialnc rhon factorialn p;
else
pstaten rhon factorialnc rhon factorialc p;
end
end
Normalize pstate to ensure probabilities sum to
pstate pstate sumpstate;
pN pstateNwait ; Probability of having N customers in the system
Calculate lambdaloss and lambdaeff
lambdaloss lambda pN;
lambdaeff lambda lambdaloss;
Calculate Lq average number of customers in the queue
Lq sum:Nwait pstate;
Lq sumcrhoc factorialcrho prhoNwaitcNwaitc rhon factorialn;
Calculate Ls average number of customers in the system
Ls Lq lambdaeff mu;
Calculate pdrop probability of a customer being dropped
pdrop pN pN;
Calculate Ws and Wq
Calculate Ws average time a customer spends in the systemWs
Ws Ls lambdaeff;
Calculate Wq average time a customer spends waiting in the queueWq
Wq Lq lambdaeff;
end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
