<< Chapter < Page Chapter >> Page >

Matlab calculations for two-server queue (in file queue2.m)

Note that the procedure will not calculate P ( D > v ) if λ = μ .

L = input('Enter lambda '); % Type desired value, no extra space M = input('Enter mu '); % Type desired value, no extra spacea = [' lambda mu'];b = [L M];disp(a) disp(b)r = L/(2*M);EQ = (2*r^3)/(1 - r^2); EN = EQ + 2*r;EW = EQ/L; ED = EN/L;A = [' rho EN EQ EW ED']; % Identifies entries in B B = [r EN EQ EW ED]; disp(A)disp(B)v = input('Enter row matrix of values v ');t = 2*M*EW*(1 - r)/(1 - 2*r); PD2 = exp(-M*v).*(1 + t.*(1 - exp(-M*v + L*v))); % Calculates P(D>v) for L not equal MS = [' v P(D>v)'];s = [v; PD2]';disp(S) disp(s)
queue2Enter lambda 0.1 Enter mu 0.2lambda mu 0.1000 0.2000rho EN EQ EW ED0.2500 0.5333 0.0333 0.3333 5.3333Enter row matrix of values v [4 8 16] v P(D>v) 4.0000 0.47908.0000 0.2241 16.0000 0.0473

Comparison of single-server and two-server queues

A queueing system has Poisson arrivals, rate λ and exponential ( μ ) service times.

  1. In system one, there is one server, with expected service time 1 / μ = 1 minute. Determine
    [ E [ N ] , E [ Q ] , E [ W ] , E [ D ] , and P ( D > v ) , v = 1 , 3 , 5 , 10
    for expected arrival rates λ = 0 . 6 , 0 . 9 , 0 . 99 customers per minute.
  2. In system two there are two servers, each with expected service time 1 / μ = 2 minutes. Calculate the same quantities as for system one and compare the results for the two systems.
queue1 Enter lambda 0.6Enter mu 1 lambda mu0.6000 1.0000rho EN EQ EW ED 0.6000 1.5000 0.9000 1.5000 2.5000Enter row matrix of values v [1 3 5 10]v P(D>v) 1.0000 0.67033.0000 0.3012 5.0000 0.135310.0000 0.0183 Ov = ones(1,length(v));R = r*Ov; % Row vector with all terms = r r1 = R;E11 = B; v11 = PD;queue1Enter lambda 0.9 Enter mu 1lambda mu 0.9000 1.0000rho EN EQ EW ED0.9000 9.0000 8.1000 9.0000 10.0000Enter row matrix of values v v % Calls for previously entered vv P(D>v) 1.0000 0.90483.0000 0.7408 5.0000 0.606510.0000 0.3679 R = r*Ov;r2 = R; E12 = B;v12 = PD;queue1Enter lambda 0.99 Enter mu 1lambda mu 0.9900 1.0000rho EN EQ EW ED0.9900 99.0000 98.0100 99.0000 100.0000Enter row matrix of values v v v P(D>v) 1.0000 0.99003.0000 0.9704 5.0000 0.951210.0000 0.9048 R = r*Ov;r3 = R; E13 = B;v13 = PD;queue2 % Begin calculations for second system Enter lambda 0.6Enter mu 0.5 lambda mu0.6000 0.5000rho EN EQ EW ED 0.6000 1.8750 0.6750 1.1250 3.1250Enter row matrix of values v vv P(D>v) 1.0000 0.75013.0000 0.3988 5.0000 0.201910.0000 0.0328 E21 = B; % Not necessary to determne r1, r2, r3, sincev21 = PD2; % they are the same as for system one.queue2 Enter lambda 0.9Enter mu 0.5 lambda mu0.9000 0.5000rho EN EQ EW ED 0.9000 9.4737 7.6737 8.5263 10.5263Enter row matrix of values v vv P(D>v) 1.0000 0.92453.0000 0.7749 5.0000 0.641010.0000 0.3916E22 = B; v22 = PD2;queue2Enter lambda 0.99 Enter mu 0.5lambda mu 0.9900 0.5000rho EN EQ EW ED0.9900 99.4975 97.5175 98.5025 100.5025Enter row matrix of values v v v P(D>v) 1.0000 0.99203.0000 0.9743 5.0000 0.955710.0000 0.9094 E23 = B;v23 = PD2; C = [E11; E21; zeros(E11); E12; E22; zeros(E11); E13; E23]; % Zeros are spacersdisp(A) rho EN EQ EW EDdisp(C) 0.6000 1.5000 0.9000 1.5000 2.50000.6000 1.8750 0.6750 1.1250 3.1250 0 0 0 0 00.9000 9.0000 8.1000 9.0000 10.0000 0.9000 9.4737 7.6737 8.5263 10.52630 0 0 0 0 0.9900 99.0000 98.0100 99.0000 100.00000.9900 99.4975 97.5175 98.5025 100.5025H = [' rho v P(D1>v) P(D2>v)'];PDV = [r1 r2 r3; v v v; v11 v12 v13; v21 v22 v23]';disp(H)rho v P(D1>v) P(D2>v) disp(PDV)1.0000 1.0000 0.6703 0.7501 1.0000 3.0000 0.3012 0.39881.0000 5.0000 0.1353 0.2019 1.0000 10.0000 0.0183 0.03280.9000 1.0000 0.9048 0.9245 0.9000 3.0000 0.7408 0.77490.9000 5.0000 0.6065 0.6410 0.9000 10.0000 0.3679 0.39160.9900 1.0000 0.9900 0.9920 0.9900 3.0000 0.9704 0.97430.9900 5.0000 0.9512 0.9557 0.9900 10.0000 0.9048 0.9094

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Topics in applied probability. OpenStax CNX. Sep 04, 2009 Download for free at http://cnx.org/content/col10964/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Topics in applied probability' conversation and receive update notifications?

Ask