LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ProcessType.m
1classdef (Sealed) ProcessType
2 % Enumeration of process ts
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties (Constant)
8 EXP = 0;
9 ERLANG = 1;
10 HYPEREXP = 2;
11 PH = 3;
12 APH = 4;
13 MAP = 5;
14 UNIFORM = 6;
15 DET = 7;
16 COXIAN = 8;
17 GAMMA = 9;
18 PARETO = 10;
19 MMPP2 = 11;
20 REPLAYER = 12;
21 TRACE = 12;
22 IMMEDIATE = 13;
23 DISABLED = 14;
24 COX2 = 15;
25 WEIBULL = 16;
26 LOGNORMAL = 17;
27 DUNIFORM = 18;
28 BERNOULLI = 19;
29 PRIOR = 20;
30 BINOMIAL = 21;
31 POISSON = 22;
32 GEOMETRIC = 23;
33 BMAP = 24;
34 ME = 25;
35 RAP = 26;
36 DISCRETESAMPLER = 27;
37 ZIPF = 28;
38 DMAP = 29;
39 MMAP = 31;
40 EMPIRICALCDF = 32;
41 NHPP = 33;
42 end
43
44 methods (Static)
45 function bool = isMarkovian(t)
46 % BOOL = ISMARKOVIAN(T)
47 %
48 % True when sn.proc carries an exact matrix representation of a
49 % process of type T: a genuine (D0,D1) pair, or its
50 % matrix-exponential analogue for ME/RAP.
51 %
52 % The distinction is about SN.PROC, not about what getProcess
53 % returns. getProcess hands back raw distribution PARAMETERS for
54 % several non-Markovian families -- Gamma, Weibull, Lognormal,
55 % Pareto and Uniform return two scalars (Pareto {alpha,k}, Uniform
56 % {min,max}) -- and refreshProcessRepresentations replaces those
57 % with convertToMAP = map_erlang(mean, n) before storing them in
58 % sn.proc, where n = ceil(1/SCV) capped at 100 (n = 20 when
59 % SCV < CoarseTol). That fit matches the mean, and matches the SCV
60 % only when SCV <= 1: Pareto with SCV 64 gives n = 1, a single
61 % exponential of SCV 1. So for these types sn.proc is an
62 % approximation, not the law that was requested, and nothing on the
63 % cell says so -- the only signal is sn.procid.
64 %
65 % Solvers that read sn.proc as if it were the exact law must gate on
66 % this predicate. It is the procid-level counterpart of the JAR's
67 % Distribution.isMarkovian(), i.e. of the Markovian class hierarchy,
68 % so the two lists must stay in step.
69 bool = any(t == [ProcessType.EXP, ProcessType.ERLANG, ...
70 ProcessType.HYPEREXP, ProcessType.PH, ProcessType.APH, ...
71 ProcessType.MAP, ProcessType.COXIAN, ProcessType.COX2, ...
72 ProcessType.MMPP2, ProcessType.ME, ProcessType.RAP, ...
73 ProcessType.DMAP, ProcessType.BMAP, ProcessType.MMAP]);
74 end
75
76 function t = fromId(id)
77 % ID = TOID(TYPE)
78 t = id;
79 end
80
81 function id = toId(t)
82 % ID = TOID(TYPE)
83 id = t;
84 end
85
86 function t = fromText(text)
87 % TIMMEDIATE = TOID(TYPE)
88 switch text
89 case 'Exp'
90 t = ProcessType.EXP;
91 case 'Erlang'
92 t = ProcessType.ERLANG;
93 case 'HyperExp'
94 t = ProcessType.HYPEREXP;
95 case 'PH'
96 t = ProcessType.PH;
97 case 'APH'
98 t = ProcessType.APH;
99 case 'MAP'
100 t = ProcessType.MAP;
101 case 'Uniform'
102 t = ProcessType.UNIFORM;
103 case 'Det'
104 t = ProcessType.DET;
105 case 'Coxian'
106 t = ProcessType.COXIAN;
107 case 'Gamma'
108 t = ProcessType.GAMMA;
109 case 'Pareto'
110 t = ProcessType.PARETO;
111 case 'MMPP2'
112 t = ProcessType.MMPP2;
113 case {'Replayer', 'Trace'}
114 t = ProcessType.REPLAYER;
115 case 'Immediate'
116 t = ProcessType.IMMEDIATE;
117 case 'Disabled'
118 t = ProcessType.DISABLED;
119 case 'Cox2'
120 t = ProcessType.COX2;
121 case 'Weibull'
122 t = ProcessType.WEIBULL;
123 case 'Lognormal'
124 t = ProcessType.LOGNORMAL;
125 case 'DiscreteUniform'
126 t = ProcessType.DUNIFORM;
127 case 'Bernoulli'
128 t = ProcessType.BERNOULLI;
129 case 'Prior'
130 t = ProcessType.PRIOR;
131 case 'Binomial'
132 t = ProcessType.BINOMIAL;
133 case 'Poisson'
134 t = ProcessType.POISSON;
135 case 'Geometric'
136 t = ProcessType.GEOMETRIC;
137 case 'BMAP'
138 t = ProcessType.BMAP;
139 case {'ME', 'CME'}
140 % A CME is an ME: the concentrated representation is a
141 % subclass of ME and carries no distinct process type, so
142 % every solver gate and sn.procid entry that accepts ME
143 % accepts it. refreshProcessTypes passes the class name, so
144 % the subclass has to be listed here explicitly.
145 t = ProcessType.ME;
146 case 'RAP'
147 t = ProcessType.RAP;
148 case 'DiscreteSampler'
149 t = ProcessType.DISCRETESAMPLER;
150 case 'Zipf'
151 t = ProcessType.ZIPF;
152 case 'DMAP'
153 t = ProcessType.DMAP;
154 case 'NHPP'
155 t = ProcessType.NHPP;
156 case 'EmpiricalCDF'
157 % Class name, as passed by refreshProcessTypes. Without this
158 % case an EmpiricalCDF service aborts fromText during
159 % getStruct, before any solver feature gate can report that
160 % the distribution is unsupported.
161 t = ProcessType.EMPIRICALCDF;
162 case {'MarkedMAP', 'MMAP', 'MarkedMMPP'}
163 t = ProcessType.MMAP;
164 otherwise
165 line_error(mfilename, sprintf('Unrecognized process type: %s', text));
166 end
167 end
168
169 function text = toText(t)
170 % TEXT = TOTEXT(TYPE)
171 switch t
172 case ProcessType.EXP
173 text = 'Exp';
174 case ProcessType.ERLANG
175 text = 'Erlang';
176 case ProcessType.HYPEREXP
177 text = 'HyperExp';
178 case ProcessType.PH
179 text = 'PH';
180 case ProcessType.APH
181 text = 'APH';
182 case ProcessType.MAP
183 text = 'MAP';
184 case ProcessType.UNIFORM
185 text = 'Uniform';
186 case ProcessType.DET
187 text = 'Det';
188 case ProcessType.COXIAN
189 text = 'Coxian';
190 case ProcessType.GAMMA
191 text = 'Gamma';
192 case ProcessType.PARETO
193 text = 'Pareto';
194 case ProcessType.MMPP2
195 text = 'MMPP2';
196 case {ProcessType.REPLAYER, ProcessType.TRACE}
197 text = 'Replayer';
198 case ProcessType.IMMEDIATE
199 text = 'Immediate';
200 case ProcessType.DISABLED
201 text = 'Disabled';
202 case ProcessType.COX2
203 text = 'Cox2';
204 case ProcessType.WEIBULL
205 text = 'Weibull';
206 case ProcessType.LOGNORMAL
207 text = 'Lognormal';
208 case ProcessType.DUNIFORM
209 text = 'DiscreteUniform';
210 case ProcessType.BERNOULLI
211 text = 'Bernoulli';
212 case ProcessType.PRIOR
213 text = 'Prior';
214 case ProcessType.BINOMIAL
215 text = 'Binomial';
216 case ProcessType.POISSON
217 text = 'Poisson';
218 case ProcessType.GEOMETRIC
219 text = 'Geometric';
220 case ProcessType.BMAP
221 text = 'BMAP';
222 case ProcessType.ME
223 text = 'ME';
224 case ProcessType.RAP
225 text = 'RAP';
226 case ProcessType.DISCRETESAMPLER
227 text = 'DiscreteSampler';
228 case ProcessType.ZIPF
229 text = 'Zipf';
230 case ProcessType.DMAP
231 text = 'DMAP';
232 case ProcessType.NHPP
233 text = 'NHPP';
234 case ProcessType.MMAP
235 text = 'MMAP';
236 case ProcessType.EMPIRICALCDF
237 text = 'EmpiricalCDF';
238 otherwise
239 if isnan(t)
240 text = 'Unknown';
241 else
242 text = sprintf('Unknown(%d)', t);
243 end
244 end
245
246 end
247
248 end
249end