LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_lcfsqn_nc.m
1%{
2 % @file pfqn_lcfsqn_nc.m
3 % @brief Normalizing constant for LCFS queueing networks
4 %
5 % @author LINE Development Team
6%}
7
8%{
9 % @brief Computes the normalizing constant for LCFS queueing networks
10 % @fn pfqn_lcfsqn_nc(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 Ax Cell array of A matrices for each state.
16%}
17function [G,Ax] = pfqn_lcfsqn_nc(alpha,beta,N)
18% [G,AX] = PFQN_LCFSQN_NC(ALPHA, BETA, N)
19% Normalizing constant 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%
33% Returns:
34% G - normalizing constant
35% Ax - cell array of A matrices for each state x=0:K
36%
37% Reference:
38% G. Casale, "A family of multiclass LCFS queueing networks with
39% order-dependent product-form solutions", QUESTA 2026.
40%
41% Copyright (c) 2012-2026, Imperial College London
42% All rights reserved.
43
44K = sum(N);
45R = length(N);
46G = 0;
47Ax=cell(1,K+1);
48for x=0:K
49 Ax{1+x} = make_A(alpha, beta, x, K, R);
50 G = G + perm(Ax{1+x}, N);
51end
52% The permanent counts the N(r)! orderings of the identical class-r jobs, so it
53% overstates G by prod(N!). pfqn_joint.m divides by exactly this factor for the
54% same reason. Without it this routine disagreed with pfqn_lcfsqn_ca, which the
55% NC solver actually uses as the normalizing constant.
56G = G / prod(factorial(N));
57end
58
59
60function A = make_A(alpha, beta, x, K, R)
61% alpha : vector of length R
62% beta : vector of length R
63% x : integer
64% K : matrix size
65% perm(A,N) requires A to be (sum(N) x R): rows are job slots, columns are
66% class groups (see matlab/util/perm.m). This built the TRANSPOSE, class on the
67% row, in a K x K buffer, so rows R+1..K stayed zero and every Ryser term
68% carried a zero factor: G came back as 0 for every population other than the
69% all-ones default, where the matrix happens to be square and symmetric under
70% transposition.
71if issym(alpha)
72 A = sym(zeros(K, R));
73else
74 A = zeros(K, R);
75end
76for i = 1:R
77 for j = 1:x
78 A(j, i) = alpha(i)^j;
79 end
80 for j = 1:(K-x)
81 A(x+j, i) = alpha(i)^(x+j-1) * beta(i);
82 end
83end
84end