1function trips = pollingBlocks(pinfo, srvclass, nbuf, R)
2% TRIPS = POLLINGBLOCKS(PINFO, SRVCLASS, NBUF, R)
4% Every controller configuration compatible with a service facility holding a
5%
class-SRVCLASS job (0 when empty) and buffers holding NBUF. Returns one
6% [pos, swk, ctr] triple per configuration, in full regardless of which columns
7% State.pollingInfo materializes (project with State.pollingProject), and zero
8% rows when
the combination
is unoccupiable.
10% The three tangible configurations of State.pollingInfo
map as follows.
12% SERVING(p):
the server stands at
the buffer of
the job it
is serving, so pos
13%
is pinned to srvclass. The visit budget
is free within
the bounds its
14% discipline can have left it in:
15% GATED ctr counts
the jobs admitted at
the polling instant that have
16% not completed,
the one in service included, so ctr >= 1; and
17%
the ctr-1 still uncompleted ones are all waiting in
the
18% buffer, so ctr-1 <= nbuf(p).
19% KLIMITED 1 <= ctr <= K,
the one in service counted.
20% DECREMENTING ctr
is the population
the visit
is driving
the class down to;
21% it started at one below
the level found and
the visit
is still
22% running, so
the current population nbuf(p)+1 exceeds it.
24% SWITCHING(q):
the facility must be empty, and q must be a buffer whose
25% switchover takes time, since a zero-time one
is never dwelt in. Every phase
26% of that switchover
is reachable. Jobs may wait meanwhile: this
is exactly
the
27% configuration that makes a polling station non-work-conserving.
29% PARKED:
the facility and
the whole station are empty and no switchover takes
30% time. With work waiting and only immediate switchovers
the server would have
31% reached it in zero time, so an idle facility and a non-empty station
is
32% unoccupiable and yields no rows at all. That pruning matters even when no
33%
column is materialized: leaving those rows in
the state space would make
the
36% Copyright (c) 2012-2026, Imperial College London
41 if ~pinfo.polled(srvclass)
42 return % a buffer outside
the cyclic order can hold no job
45 case PollingType.EXHAUSTIVE
47 case PollingType.GATED
48 ctrset = 1:(nbuf(srvclass)+1);
49 case PollingType.KLIMITED
51 case PollingType.DECREMENTING
52 ctrset = 0:nbuf(srvclass);
55 trips(end+1,:) = [srvclass, 0, ctr]; %#ok<AGROW>
58 for q = find(pinfo.hasSw)
59 for swk = 1:pinfo.Ksw(q)
60 trips(end+1,:) = [q, swk, 0]; %
#ok<AGROW>
63 if ~any(pinfo.hasSw) && sum(nbuf) == 0
64 trips(end+1,:) = [find(pinfo.polled,1), 0, 0]; % parked, pos canonical