1function ProbAggr = getProbAggr(self, node, state)
2% PROBAGGR = GETPROBAGGR(NODE, STATE) Returns aggregated state probability via DES simulation
4% @brief Estimates steady-state aggregated (per-
class) state probabilities via DES simulation
6% This method estimates the probability of observing a specific per-class job distribution
7% (e.g., [2 jobs of class 1, 1 job of class 2]) at a station. States are aggregated over
8% service phases - only the number of jobs per class matters.
10% @param self SolverDES instance
11% @param node Queue or node
object (or node index as integer)
12% @param state (optional) Aggregated state specification as vector (per-class job counts).
13% If omitted, uses current network state aggregated over phases.
15% @return ProbAggr Estimated aggregated state probability value
16% - 0 if state not seen during simulation (rare event)
18% @note DES estimates probabilities from finite simulation. Accuracy improves with
21% @warning Simulation-based estimate - results vary between runs unless seed
is set.
23% @see getProb - Returns phase-detailed state probabilities
24% @see getProbSysAggr - Returns joint aggregated system state probabilities
28% solver = SolverDES(model, 'samples', 50000, 'seed', 42);
29% queue1 = model.
nodes{1};
31% % Estimate probability of having 3
class-1 jobs and 2
class-2 jobs
32% prob_aggr = solver.getProbAggr(queue1, [3, 2]);
33% fprintf(
'Estimated Pr[n1=3, n2=2] = %.4f\n', prob_aggr);
36if GlobalConstants.DummyMode
41% Convert model to Java
42jmodel = LINE2JLINE(self.model);
44% Create Java DES options
45joptions = jline.solvers.des.DESOptions();
46joptions.samples = self.options.samples;
47joptions.seed = self.options.seed;
50jsolver = jline.solvers.des.SolverDES(jmodel, joptions);
52% Get stateful node from model
53sn = self.model.getStruct;
60% Find the corresponding Java node
61statefulNodes = jmodel.getStatefulNodes();
62isf = sn.nodeToStateful(nodeIdx);
63jnode = statefulNodes.get(isf - 1); % Java
is 0-indexed
65% Convert state to Java Matrix if provided
66if nargin < 3 || isempty(state)
69 jstate = JLINE.to_jline_matrix(state(:)');
72% Call Java getProbAggr method and extract probability value
74 jresult = jsolver.getProbAggr(jnode);
76 jresult = jsolver.getProbAggr(jnode, jstate);
79% Extract the probability value from the ProbabilityResult
object
80ProbAggr = jresult.probability;