1function [rows, probs] = pollingLand(pinfo, q, mode, budget, space_buf, space_srv, space_var, K, Ks, pieist, R)
2% [ROWS, PROBS] = POLLINGLAND(PINFO, Q, MODE, BUDGET, SPACE_BUF, SPACE_SRV, SPACE_VAR, K, KS, PIEIST, R)
4% Materialize
the state rows a polling server lands in after State.pollingNext
5% has resolved (Q, MODE, BUDGET), together with
the probability of each. The
6% three inputs SPACE_BUF/SPACE_SRV/SPACE_VAR are single rows describing
the
7% station at
the instant
the decision
is taken, i.e. with
the completed job (
if
8% any) already removed from
the service facility.
10% PROBS splits a landing across
the entry phases of a phase-type: which phase a
11% service or a switchover starts in
is a random choice, so one decision yields
12% one row per entry phase, weighted by
the corresponding entry probability.
13% Callers fold PROBS into
the transition rate rather than into outprob, since
14%
the branching happens at
the instant
the active
event fires.
16% Copyright (c) 2012-2026, Imperial College London
22 case 1 % start or
continue a visit at q: pull a waiting
class-q job into service
24 buf(1,q) = buf(1,q) - 1;
27 if pentry(kentry) <= 0
31 srv(1,Ks(q)+kentry) = srv(1,Ks(q)+kentry) + 1;
32 var = State.pollingSet(pinfo, space_var, q, 0, budget);
33 rows(end+1,:) = [buf, srv, var]; %#ok<AGROW>
34 probs(end+1,1) = pentry(kentry); %#ok<AGROW>
36 case 2 % enter
the switchover into q:
the facility stays empty
while walking
37 swpie = pinfo.swpie{q};
38 for kentry = 1:pinfo.Ksw(q)
42 var = State.pollingSet(pinfo, space_var, q, kentry, 0);
43 rows(end+1,:) = [space_buf, space_srv, var]; %#ok<AGROW>
44 probs(end+1,1) = swpie(kentry); %#ok<AGROW>
46 case 0 % park: held until
the next arrival, see State.pollingNext
47 var = State.pollingSet(pinfo, space_var, q, 0, 0);
48 rows = [space_buf, space_srv, var];