Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you please advise to fix the error for summation of p _ state not getting to equal to 1 ? this is for multiserver
Can you please advise to fix the error for summation of pstate not getting to equal to this is for multiserver MMCQ Valdation test for finite MMCQ queuing system function Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait
Calculate the utilization factor
rho lambda mu;
rho lambda c mu;
cbar rho c rhoc factorialc rho; Fix cbar calculation
Calculate pprobability of no customers in the system
pdenom sumc rho:c factorial:c c rhoc factorialc rho; Fix pdenom calculation
p pdenom;
pstate zeros Nwait ;
pstate p;
Calculate pN probability of having N customers in the system
for i :Nwait
if i c
pstatei rhoi factoriali p;
else
pstatei rhoi factorialcci c p; Fix the pstate calculation
pstatei rhoi factorialcc ic c i p; Fix the pstate calculation
end
end
Calculate Lq average number of customers in the queue
Lq sum:Nwait pstate;
Lq lambdaeff Wq;
Calculate lambdaloss and lambdaeff
lambdaloss lambda pstateNwait ;
lambdaeff lambda lambdaloss;
Calculate Ls average number of customers in the system
Ls Lq lambdaeff mu;
Calculate the utilization
cbar Ls Lq;
cutil cbar c;
Calculate pdrop probability of a customer being dropped
pdrop pstateNwait ;
Calculate Ws and Wq
Ws Ls lambdaeff;
Wq Lq lambdaeff;
end INSERT YOUR CODE HERE
c; Number of serversAgents
plamda.cmu; p System Utilization
for k:
approxvalueklamdamukfactorialk;
end
r ; The number of callers in the serieshold lines
resultapproxvalue ; Initializing the result
for i:
result i sumapproxvalue:i;
end
To calculate the smallest number of customer agents that meets the requirements
Wq Waiting time in queue
Ws Waiting time in system
Lq # of items in queue
ls # of items in system
presult:lamdamuc:factorialc:lamdac:mu;Probability system is empty
Lq lambda Wq;
Wa c mulambda; Average waiting time
dispWa;
Wq Lq lambda; Waiting time in queue
Pw Wq Wa; Probability that arrival must wait
Ws Wq mu; Average time in System
Ls Ws lambda; Average Number in the SystemI am someow getting errors with Ls so I have to change Ls
dispLs ;
Figure
figure
subplot
xlim
ylim
horzcatWq;
horzcatc;
plotWqc Probability that arrival must wait against thd number of servers
xlabelNumber of Servers c
ylabelAverage hold Lines'
titleProbability that arrival must wait';
grid 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 pstate
fprintfWs f PASS
Ws; indicating that waiting times meet the specified criteria.
else
fprintfWs f FAIL
Ws; Ws is compared with pstate
end
if relerrorWq pstate Wq is compared with
fprintfWq f PASS
Wq;
else
fprintfWq f FAIL
Wq;
end
if relerrorcutil, cutil is compared with
fprintfcutil f PASS
cutil;
else
fprintfcutil f FAIL
cutil;
end
if relerrorpdrop,
fprintfpdrop f PASS
pdrop;
else
fprintfpdrop f FAIL
pdrop;
end
if relerrorpdrop,
fprintfpdrop f PASS
pdrop;
else
fprintfpdrop f FAIL
pdrop;
end
fprintfpstate: s
numstrpstate;
fprintfsumpstate:
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started