LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pollingLand.m
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)
3%
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.
9%
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.
15
16% Copyright (c) 2012-2026, Imperial College London
17% All rights reserved.
18
19rows = [];
20probs = [];
21switch mode
22 case 1 % start or continue a visit at q: pull a waiting class-q job into service
23 buf = space_buf;
24 buf(1,q) = buf(1,q) - 1;
25 pentry = pieist{q};
26 for kentry = 1:K(q)
27 if pentry(kentry) <= 0
28 continue
29 end
30 srv = space_srv;
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>
35 end
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)
39 if swpie(kentry) <= 0
40 continue
41 end
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>
45 end
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];
49 probs = 1;
50end
51end
Definition Station.m:245