LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pollingBlocks.m
1function trips = pollingBlocks(pinfo, srvclass, nbuf, R)
2% TRIPS = POLLINGBLOCKS(PINFO, SRVCLASS, NBUF, R)
3%
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.
9%
10% The three tangible configurations of State.pollingInfo map as follows.
11%
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.
23%
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.
28%
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
34% generator reducible.
35
36% Copyright (c) 2012-2026, Imperial College London
37% All rights reserved.
38
39trips = zeros(0,3);
40if srvclass > 0
41 if ~pinfo.polled(srvclass)
42 return % a buffer outside the cyclic order can hold no job
43 end
44 switch pinfo.ptype
45 case PollingType.EXHAUSTIVE
46 ctrset = 0;
47 case PollingType.GATED
48 ctrset = 1:(nbuf(srvclass)+1);
49 case PollingType.KLIMITED
50 ctrset = 1:pinfo.pk;
51 case PollingType.DECREMENTING
52 ctrset = 0:nbuf(srvclass);
53 end
54 for ctr = ctrset
55 trips(end+1,:) = [srvclass, 0, ctr]; %#ok<AGROW>
56 end
57else
58 for q = find(pinfo.hasSw)
59 for swk = 1:pinfo.Ksw(q)
60 trips(end+1,:) = [q, swk, 0]; %#ok<AGROW>
61 end
62 end
63 if ~any(pinfo.hasSw) && sum(nbuf) == 0
64 trips(end+1,:) = [find(pinfo.polled,1), 0, 0]; % parked, pos canonical
65 end
66end
67end
Definition Station.m:287
Definition Station.m:245