LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
getProbAggr.m
1function ProbAggr = getProbAggr(self, node, state)
2% PROBAGGR = GETPROBAGGR(NODE, STATE)
3%
4% Probability of a SPECIFIC per-class job distribution at a station.
5% Returns P(n1 jobs of class 1, n2 jobs of class 2, ...) for given state.
6%
7% Compare with getProbMarg: returns total queue-length distribution,
8% i.e., P(n total jobs) summed over all class combinations.
9%
10% Input:
11% node - Node object
12% state - Per-class job counts, e.g., [2,1] = 2 class-1, 1 class-2
13%
14% Output:
15% ProbAggr - Scalar probability in [0,1] (estimated via simulation)
16
17if GlobalConstants.DummyMode
18 ProbAggr = NaN;
19 return
20end
21
22% we do not use probSysState as that is for joint states
23TranSysStateAggr = self.sampleSysAggr;
24sn = self.getStruct;
25isf = sn.nodeToStateful(node.index);
26TSS = cell2mat({TranSysStateAggr.t,TranSysStateAggr.state{isf}});
27TSS(:,1)=[TSS(1,1);diff(TSS(:,1))];
28if nargin<3 %~exist('state','var')
29 state = sn.state{isf};
30end
31rows = findrows(TSS(:,2:end), state);
32if ~isempty(rows)
33 ProbAggr = sum(TSS(rows,1))/sum(TSS(:,1));
34else
35 line_warning(mfilename,'The state was not seen during the simulation.\n');
36 ProbAggr = 0;
37end
38end