LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_lcfsqn_ca.m
1%{
2 % @file pfqn_lcfsqn_ca.m
3 % @brief Convolution algorithm for 2-station LCFS queueing networks
4 %
5 % @author LINE Development Team
6%}
7
8%{
9 % @brief Convolution algorithm for 2-station LCFS queueing networks
10 % @fn pfqn_lcfsqn_ca(alpha, beta, N)
11 % @param alpha Service rates at LCFS station (1xR vector).
12 % @param beta Service rates at LCFS-PR station (1xR vector).
13 % @param N Population vector (default: ones(1,R)).
14 % @return G Normalizing constant.
15 % @return V Auxiliary normalization term.
16%}
17function [G,V] = pfqn_lcfsqn_ca(alpha,beta,N)
18% [G,V] = PFQN_LCFSQN_CA(ALPHA, BETA, N)
19% Convolution algorithm for multiclass LCFS queueing networks
20%
21% This function computes the normalizing constant for a 2-station closed
22% queueing network with:
23% - Station 1: LCFS (Last-Come-First-Served, non-preemptive)
24% - Station 2: LCFS-PR (LCFS with Preemption-Resume)
25%
26% Parameters:
27% alpha - vector of inverse service rates at station 1 (LCFS)
28% alpha(r) = 1/mu(1,r) for class r
29% beta - vector of inverse service rates at station 2 (LCFS-PR)
30% beta(r) = 1/mu(2,r) for class r
31% N - population vector, N(r) = number of jobs of class r
32% (default: ones(1,R) - one job per class)
33%
34% Returns:
35% G - normalizing constant
36% V - auxiliary normalization term
37%
38% Reference:
39% G. Casale, "A family of multiclass LCFS queueing networks with
40% order-dependent product-form solutions", QUESTA 2026.
41%
42% Copyright (c) 2012-2026, Imperial College London
43% All rights reserved.
44
45R = length(alpha);
46if nargin<3
47 N = ones(1,R);
48end
49K = sum(N);
50
51if K ==0
52 G = 1;
53 V = 1;
54 return
55else
56 prods = zeros(1,R);
57 for r=1:R
58 prods(r)=prod(N(1:r-1)+1);
59 end
60 G = zeros(prod(N+1),1);
61 V = zeros(prod(N+1),1);
62 n = pprod(N);
63 while n>=0
64 idx = hashpop(n,N,R,prods);
65 if sum(n)==0
66 G(idx) = 1;
67 V(idx) = 1;
68 else
69 V(idx) = 0;
70 G(idx) = 0;
71 for r=1:R
72 if n(r)>0
73 idx_r = hashpop(oner(n,r),N,R,prods);
74 % recursive definition of V
75 V(idx) = V(idx) + V(idx_r);
76 % recursive definition of G uses V and beta
77 G(idx) = G(idx) + alpha(r)^(sum(n)-1)*beta(r) * G(idx_r);
78 end
79 end
80 V(idx) = prod(alpha.^n) * V(idx);
81 G(idx) = G(idx) + V(idx);
82 end
83 n = pprod(n,N);
84 end
85 G=G(end);
86 V=V(end);
87end
88end