LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
lossn_erlangfp.m
1%{ @file lossn_erlangfp.m
2 % @brief Erlang fixed point approximation for loss networks
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes performance metrics for loss networks using Erlang FP
9 %
10 % @details
11 % This function uses the Erlang fixed point approximation to compute
12 % performance metrics for loss networks. Calls on route r arrive according
13 % to Poisson rate nu_r with unit mean service times. Link capacity
14 % requirements are: sum_r A(j,r) n(j,r) <= C(j) for all links j.
15 %
16 % @par Syntax:
17 % @code
18 % [QLen, Loss, E, niter] = lossn_erlangfp(nu, A, C)
19 % @endcode
20 %
21 % @par Parameters:
22 % <table>
23 % <tr><th>Name<th>Description
24 % <tr><td>nu<td>Arrival rate of route (class) r (1xR vector)
25 % <tr><td>A<td>Capacity requirement of link j for route r (JxR matrix)
26 % <tr><td>C<td>Available capacity of link j (Jx1 vector)
27 % </table>
28 %
29 % @par Returns:
30 % <table>
31 % <tr><th>Name<th>Description
32 % <tr><td>QLen<td>Mean queue-length for route r
33 % <tr><td>Loss<td>Loss probability for route r
34 % <tr><td>E<td>Blocking probability for link j
35 % <tr><td>niter<td>Number of iterations required for convergence
36 % </table>
37%}
38function [QLen,Loss,E,niter] = lossn_erlangfp(nu,A,C)
39% [QLen,Loss,E] = LOSS_ERLANGFP(rho,A,C)
40% Erlang fixed point approximation for loss networks
41%
42% Calls (i.e., jobs) on route (i.e., class) r arrive according to Poisson
43% rate nu_r, r=1..R. Call service times on route r have unit mean.
44%
45% Link capacity requirements are:
46% \sum_r A(j,r) n(j,r) <= C(j)
47% for all links j=1..J, where n(j,r) counts the calls on route r on link j.
48%
49% INPUT:
50% nu (1xR): arv. rate of route (class) r = 1..R
51% A (J,R): capacity requirement of link j for route r = 1..R
52% C (J,1): available capacity of link j
53%
54% OUTPUT:
55% Q (1xR): mean queue-length for route r = 1..R calls
56% L (1xR): loss probability for route r = 1..R calls
57% E (Jx1): blocking probability of for link j = 1..J
58%
59% NOTE: nu_r may be replaced by a utilization rho_r=nu_r/mu_r, where mu_r
60% is the service rate for route r.
61
62R = length(nu);
63J = length(C);
64
65% Erlang fixed point on the link blocking probabilities, driven by the
66% generic DA successive-substitution driver
67fpopts = struct('iter_max', 10000, 'iter_tol', 1e-8);
68fpopts.config.da_norm = @(d) norm(d,1);
69fpopts.config.da_nanstop = true; % legacy while-loop exited on NaN measure
70[E, niter] = da_fpi(@efp_sweep, 0.5*ones(J,1), fpopts);
71
72 function [Enew, Eref] = efp_sweep(E_1, ~)
73 Enew = E_1;
74 for j=1:J
75 rhoj_1 = 0;
76 for r=1:R
77 if A(j,r)>0
78 termj=nu(r)*A(j,r);
79 for i=1:J
80 if A(i,r)>0
81 termj=termj*(1-E_1(i))^A(i,r);
82 end
83 end
84 rhoj_1 = rhoj_1 + termj;
85 end
86 end
87 rhoj_1 = rhoj_1 / (1-E_1(j));
88 Enew(j) = ErlangB(rhoj_1,C(j));
89 end
90 Eref = E_1;
91 end
92QLen = nu;
93for r=1:R
94 for j=1:J
95 QLen(r) = QLen(r)*(1-E(j))^A(j,r);
96 end
97end
98QLen = real(QLen);
99Loss = 1 - QLen./nu; % blocking probability = 1 - carried/offered
100end
101
102function blockProb = ErlangB(nu,C)
103% Erlang B formula
104% blockProb = E(nu,C) = (nu^C/C!) / (sum_{i=1}^C nu^i/i!)
105den = 0;
106for i=0:C
107 d = i*log(nu)-factln(i);
108 den = den + exp(d);
109end
110blockProb = C*log(nu) -factln(C) -log(den);
111blockProb = exp(blockProb);
112end
Definition Station.m:245