LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
getProb.m
1function Pnir = getProb(self, node, state)
2% PNIR = GETPROB(NODE, STATE) Returns state probabilities at equilibrium
3%
4% @brief Returns state probabilities for a given node, including phase information
5%
6% This method computes the steady-state marginal state probability distribution
7% for jobs at a specified station. Unlike getProb_aggr(), this method returns
8% full state-space probabilities including phase information from service distributions.
9%
10% @param self SolverCTMC instance
11% @param node Queue or node object (or node index as integer)
12% @param state (optional) State specification as vector. If provided, returns
13% probability of this specific state. If omitted, returns probabilities
14% for all states at the node.
15%
16% @return Pnir Matrix of state probabilities. If state parameter was provided,
17% returns a scalar probability value. Otherwise returns a matrix where
18% rows represent different states and columns represent job classes.
19% For phase-type distributions, includes phase dimension in state space.
20%
21% @note Only supported by CTMC and SSA solvers due to their state-space formulation.
22% For aggregated probabilities (without phase info), use getProb_aggr() instead.
23%
24% @see getProb_aggr - Returns probabilities aggregated over phases
25% @see getProbSys - Returns joint system state probabilities
26%
27% Example:
28% @code
29% solver = SolverCTMC(model);
30% queue1 = model.nodes{1};
31%
32% % Get all state probabilities for queue1
33% prob_matrix = solver.getProb(queue1);
34%
35% % Get probability for specific state [2 jobs of class 0, 1 job of class 1]
36% queue1.setState([2, 1]);
37% prob_specific = solver.getProb(queue1);
38% @endcode
39
40if GlobalConstants.DummyMode
41 Pnir = NaN;
42 return
43end
44
45if nargin<2 %~exist('node','var')
46 line_error(mfilename,'getProb requires to pass a parameter the station of interest.');
47end
48if ~isfield(self.options,'keep')
49 self.options.keep = false;
50end
51T0 = tic;
52sn = self.getStruct;
53sn.state = sn.state;
54if nargin>=3 %exist('state','var')
55 sn.state{node} = state;
56end
57ind = node.index;
58for isf=1:length(sn.state)
59 isf_param = sn.nodeToStateful(ind);
60 if isf ~= isf_param
61 sn.state{isf} = sn.state{isf}*0 -1;
62 end
63end
64Pnir = solver_ctmc_marg(sn, self.options);
65self.result.('solver') = getName(self);
66self.result.Prob.marginal = Pnir;
67runtime = toc(T0);
68self.result.runtime = runtime;
69Pnir = Pnir(node);
70end
Definition mmt.m:92