LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pas_compatibility_5class.m
1% Pass-and-swap (PAS) queue: an order-independent queue with a swapping graph.
2% Reproduces the five-class, three-server compatibility example of
3% Dorsman & Gardner (2024), "New directions in pass-and-swap queues",
4% Queueing Systems 107:205-256 (Figs 1-2). A PAS station is parameterized by
5% the total service-rate function mu(c) of the ordered state vector c and by a
6% swapping graph G; both are properties of the Queue object. The stationary
7% distribution is the order-independent product form and is invariant to G.
8clear node jobclass
9
10% Server compatibility (Fig 1): three unit-rate servers over five classes.
11% mu(c) = number of servers compatible with at least one class present in c.
12comp = [1 0 0 1 0; % server 1: classes {1,4}
13 0 1 0 1 0; % server 2: classes {2,4}
14 0 0 1 0 1]; % server 3: classes {3,5}
15muFun = @(c) sum( any(comp(:, c(c>0)), 2) );
16
17model = Network('PAScompatibility');
18source = Source(model, 'Source');
19queue = Queue(model, 'PASQueue', SchedStrategy.PAS);
20sink = Sink(model, 'Sink');
21
22lambda = [0.5 0.4 0.3 0.2 0.1];
23jobclass = cell(1,5);
24for r = 1:5
25 jobclass{r} = OpenClass(model, sprintf('Class%d', r));
26 source.setArrival(jobclass{r}, Exp(lambda(r)));
27end
28
29% PAS service: specify the rate function mu(c) as a whole (no per-class rates)
30queue.setService(muFun);
31% Swapping graph (Fig 2a): E = {(1,3),(1,5),(2,4),(3,4),(4,5)}
32G = zeros(5);
33for e = [1 3; 1 5; 2 4; 3 4; 4 5]'
34 G(e(1), e(2)) = 1; G(e(2), e(1)) = 1;
35end
36queue.setSwapGraph(G);
37queue.setNumberOfServers(3); % three servers (used for utilization reporting)
38queue.setCap(3); % finite buffer (order-independent loss model)
39
40P = model.initRoutingMatrix;
41for r = 1:5
42 P{jobclass{r}} = Network.serialRouting(source, queue, sink);
43end
44model.link(P);
45
46AvgTable = CTMC(model, 'cutoff', 3).getAvgTable