LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pas_selfloop.m
1% Pass-and-swap (PAS) queue with a swapping graph that includes a self-loop.
2% Per Dorsman & Gardner (2024), Sect. 2.3, self-loops in the swapping graph are
3% permissible: a completing class-i job may take the place of another class-i
4% job further back in the queue. The order-independent product form (Theorem 2)
5% still holds and remains invariant to the swapping graph.
6clear node jobclass
7
8% Three unit-rate servers, one per class (an M/M/1-per-class compatibility):
9% mu(c) = number of distinct classes present in c.
10comp = eye(3);
11muFun = @(c) sum( any(comp(:, c(c>0)), 2) );
12
13model = Network('PASselfloop');
14source = Source(model, 'Source');
15queue = Queue(model, 'PASQueue', SchedStrategy.PAS);
16sink = Sink(model, 'Sink');
17
18lambda = [0.6 0.4 0.3];
19jobclass = cell(1,3);
20for r = 1:3
21 jobclass{r} = OpenClass(model, sprintf('Class%d', r));
22 source.setArrival(jobclass{r}, Exp(lambda(r)));
23end
24
25queue.setService(muFun);
26% Swapping graph with a self-loop on class 1 and an edge (2,3)
27G = zeros(3);
28G(1,1) = 1; % self-loop: class 1 swaps with class 1
29G(2,3) = 1; G(3,2) = 1;
30queue.setSwapGraph(G);
31queue.setNumberOfServers(3); % three servers (used for utilization reporting)
32queue.setCap(3);
33
34P = model.initRoutingMatrix;
35for r = 1:3
36 P{jobclass{r}} = Network.serialRouting(source, queue, sink);
37end
38model.link(P);
39
40AvgTable = CTMC(model, 'cutoff', 3).getAvgTable