LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pollingSpace.m
1function space = pollingSpace(sn, ind, space)
2% SPACE = POLLINGSPACE(SN, IND, SPACE)
3%
4% Append the polling controller columns to the rows of SPACE, which must hold
5% the [buffer, server, routing-variable] layout of a polling station. Rows are
6% expanded into one row per controller configuration the discipline can
7% occupy, and rows for which no configuration exists are dropped.
8%
9% Enumerating the controller per row rather than as a blind cartesian product
10% is what keeps the state space tight and the chain irreducible: pos is pinned
11% to the class in service, a switchover excludes a busy service facility, and a
12% park excludes a non-empty station. A cartesian product would instead admit
13% states such as "serving buffer 1 while a class-2 job occupies the server",
14% which no transition can reach or leave in a way consistent with the marginals.
15
16% Copyright (c) 2012-2026, Imperial College London
17% All rights reserved.
18
19pinfo = State.pollingInfo(sn, ind);
20if isempty(pinfo) || isempty(space)
21 return
22end
23
24R = sn.nclasses;
25ist = sn.nodeToStation(ind);
26K = zeros(1,R);
27for r=1:R
28 if isempty(sn.proc{ist}{r})
29 K(r) = 1;
30 else
31 K(r) = length(sn.proc{ist}{r}{1});
32 end
33end
34nbufcols = 1:R;
35nsrvcols = R + (1:sum(K));
36
37out = [];
38for row=1:size(space,1)
39 nbuf = space(row, nbufcols);
40 srv = space(row, nsrvcols);
41 % class occupying the single service facility, 0 when it is empty
42 srvclass = 0;
43 for r=1:R
44 if sum(srv((sum(K(1:r-1))+1):sum(K(1:r)))) > 0
45 srvclass = r;
46 break
47 end
48 end
49 blocks = State.pollingProject(pinfo, State.pollingBlocks(pinfo, srvclass, nbuf, R));
50 for b=1:size(blocks,1)
51 out(end+1,:) = [space(row,:), blocks(b,:)]; %#ok<AGROW>
52 end
53end
54if isempty(out)
55 space = zeros(0, size(space,2) + pinfo.width);
56else
57 space = out;
58end
59end
Definition Station.m:245