LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
SchedStrategy.m
1classdef (Sealed) SchedStrategy
2 % SchedStrategy Enumeration of queueing scheduling disciplines and strategies
3 %
4 % SchedStrategy defines constants for all supported scheduling disciplines
5 % in LINE queueing systems. These strategies determine the order in which
6 % jobs are selected for service from queues, affecting system performance
7 % and fairness characteristics.
8 %
9 % @brief Comprehensive enumeration of queueing scheduling disciplines
10 %
11 % Key scheduling categories:
12 % - Order-based: FCFS, LCFS, SIRO (service order policies)
13 % - Size-based: SJF, LJF, SEPT, LEPT (job length policies)
14 % - Sharing: PS, DPS, GPS (processor sharing variants)
15 % - Priority: HOL, PSPRIO, DPSPRIO, GPSPRIO (priority disciplines)
16 % - Special: INF, FORK, POLLING, EXT, REF (specialized strategies)
17 %
18 % Common scheduling strategies:
19 % - FCFS: First-Come-First-Served (FIFO)
20 % - LCFS: Last-Come-First-Served (LIFO/Stack)
21 % - PS: Processor Sharing (round-robin with infinitesimal time slices)
22 % - SJF: Shortest Job First (preemptive shortest remaining time)
23 % - HOL: Head-of-Line priority (non-preemptive priority)
24 % - INF: Infinite server (delay station, no queueing)
25 %
26 % SchedStrategy is used in:
27 % - Queue node configuration
28 % - Service discipline specification
29 % - Performance analysis parameterization
30 % - Model validation and compatibility checking
31 % - Solver method selection
32 %
33 % Example:
34 % @code
35 % queue1 = Queue(model, 'Server1', SchedStrategy.FCFS);
36 % queue2 = Queue(model, 'Server2', SchedStrategy.PS);
37 % delay = Queue(model, 'ThinkTime', SchedStrategy.INF);
38 % @endcode
39 %
40 % Copyright (c) 2012-2026, Imperial College London
41 % All rights reserved.
42
43 properties (Constant)
44 INF = 0;
45 FCFS = 1;
46 LCFS = 2;
47 SIRO = 3;
48 SJF = 4;
49 LJF = 5;
50 PS = 6;
51 DPS = 7;
52 GPS = 8;
53 SEPT = 9;
54 LEPT = 10;
55 HOL = 11;
56 FORK = 12;
57 EXT = 13;
58 REF = 14;
59 LCFSPR = 15;
60 POLLING = 16;
61 PSPRIO = 17;
62 DPSPRIO = 18;
63 GPSPRIO = 19;
64 LCFSPI = 20;
65 LCFSPRIO = 21;
66 LCFSPRPRIO = 22;
67 LCFSPIPRIO = 23;
68 FCFSPRIO = 11; % Alias for HOL
69 FCFSPR = 24;
70 FCFSPI = 25;
71 FCFSPRPRIO = 26;
72 FCFSPIPRIO = 27;
73 SRPT = 28;
74 SRPTPRIO = 29;
75 EDD = 30; % Earliest Due Date (non-preemptive)
76 EDF = 31; % Earliest Deadline First (preemptive)
77 LPS = 32; % Least Progress Scheduling
78 end
79
80 methods (Static)
81 function id = toId(type)
82 % ID = TOID(TYPE)
83 if isnumeric(type)
84 id = type;
85 else
86 line_error(mfilename, 'Invalid scheduling strategy type.');
87 end
88 end
89
90 function type = fromId(id)
91 % TYPE = FROMID(ID)
92 if ismember(id, [SchedStrategy.INF, SchedStrategy.FCFS, SchedStrategy.LCFS, ...
93 SchedStrategy.SIRO, SchedStrategy.SJF, SchedStrategy.LJF, ...
94 SchedStrategy.PS, SchedStrategy.DPS, SchedStrategy.GPS, ...
95 SchedStrategy.SEPT, SchedStrategy.LEPT, SchedStrategy.SRPT, SchedStrategy.SRPTPRIO, SchedStrategy.HOL, ...
96 SchedStrategy.FORK, SchedStrategy.EXT, SchedStrategy.REF, ...
97 SchedStrategy.LCFSPR, SchedStrategy.POLLING, ...
98 SchedStrategy.PSPRIO, SchedStrategy.DPSPRIO, SchedStrategy.GPSPRIO, ...
99 SchedStrategy.LCFSPI, SchedStrategy.LCFSPRIO, SchedStrategy.LCFSPRPRIO, SchedStrategy.LCFSPIPRIO, ...
100 SchedStrategy.FCFSPRIO, SchedStrategy.FCFSPR, SchedStrategy.FCFSPI, SchedStrategy.FCFSPRPRIO, SchedStrategy.FCFSPIPRIO, ...
101 SchedStrategy.EDD, SchedStrategy.EDF, SchedStrategy.LPS])
102 type = id;
103 else
104 line_error(mfilename, 'Unrecognized scheduling strategy ID.');
105 end
106 end
107
108 function text = toText(type)
109 % TEXT = TOTEXT(TYPE)
110 switch type
111 case SchedStrategy.INF
112 text = 'inf';
113 case SchedStrategy.FCFS
114 text = 'fcfs';
115 case SchedStrategy.FCFSPR
116 text = 'fcfspr';
117 case SchedStrategy.FCFSPI
118 text = 'fcfspi';
119 case SchedStrategy.LCFS
120 text = 'lcfs';
121 case SchedStrategy.SIRO
122 text = 'siro';
123 case SchedStrategy.SJF
124 text = 'sjf';
125 case SchedStrategy.LJF
126 text = 'ljf';
127 case SchedStrategy.PS
128 text = 'ps';
129 case SchedStrategy.DPS
130 text = 'dps';
131 case SchedStrategy.GPS
132 text = 'gps';
133 case SchedStrategy.SEPT
134 text = 'sept';
135 case SchedStrategy.LEPT
136 text = 'lept';
137 case SchedStrategy.SRPT
138 text = 'srpt';
139 case SchedStrategy.SRPTPRIO
140 text = 'srptprio';
141 case SchedStrategy.HOL
142 text = 'hol';
143 case SchedStrategy.FCFSPRIO
144 text = 'hol';
145 case SchedStrategy.FORK
146 text = 'fork';
147 case SchedStrategy.EXT
148 text = 'ext';
149 case SchedStrategy.REF
150 text = 'ref';
151 case SchedStrategy.LCFSPR
152 text = 'lcfspr';
153 case SchedStrategy.LCFSPI
154 text = 'lcfspi';
155 case SchedStrategy.LCFSPRIO
156 text = 'lcfsprio';
157 case SchedStrategy.LCFSPRPRIO
158 text = 'lcfsprprio';
159 case SchedStrategy.LCFSPIPRIO
160 text = 'lcfspiprio';
161 case SchedStrategy.FCFSPRPRIO
162 text = 'fcfsprprio';
163 case SchedStrategy.FCFSPIPRIO
164 text = 'fcfspiprio';
165 case SchedStrategy.POLLING
166 text = 'polling';
167 case SchedStrategy.PSPRIO
168 text = 'psprio';
169 case SchedStrategy.DPSPRIO
170 text = 'dpsprio';
171 case SchedStrategy.GPSPRIO
172 text = 'gpsprio';
173 case SchedStrategy.EDD
174 text = 'edd';
175 case SchedStrategy.EDF
176 text = 'edf';
177 case SchedStrategy.LPS
178 text = 'lps';
179 otherwise
180 line_error(mfilename, 'Unrecognized scheduling strategy type.');
181 end
182 end
183
184 function type = fromText(text)
185 % TYPE = FROMTEXT(TEXT)
186 if iscell(text)
187 text = text{:};
188 end
189 switch lower(text)
190 case 'inf'
191 type = SchedStrategy.INF;
192 case 'fcfs'
193 type = SchedStrategy.FCFS;
194 case 'fcfspr'
195 type = SchedStrategy.FCFSPR;
196 case 'fcfspi'
197 type = SchedStrategy.FCFSPI;
198 case 'lcfs'
199 type = SchedStrategy.LCFS;
200 case 'siro'
201 type = SchedStrategy.SIRO;
202 case 'sjf'
203 type = SchedStrategy.SJF;
204 case 'ljf'
205 type = SchedStrategy.LJF;
206 case 'ps'
207 type = SchedStrategy.PS;
208 case 'dps'
209 type = SchedStrategy.DPS;
210 case 'gps'
211 type = SchedStrategy.GPS;
212 case 'sept'
213 type = SchedStrategy.SEPT;
214 case 'lept'
215 type = SchedStrategy.LEPT;
216 case 'srpt'
217 type = SchedStrategy.SRPT;
218 case 'srptprio'
219 type = SchedStrategy.SRPTPRIO;
220 case 'hol'
221 type = SchedStrategy.HOL;
222 case 'fcfsprio'
223 type = SchedStrategy.FCFSPRIO;
224 case 'fork'
225 type = SchedStrategy.FORK;
226 case 'ext'
227 type = SchedStrategy.EXT;
228 case 'ref'
229 type = SchedStrategy.REF;
230 case 'lcfspr'
231 type = SchedStrategy.LCFSPR;
232 case 'lcfspi'
233 type = SchedStrategy.LCFSPI;
234 case 'lcfsprio'
235 type = SchedStrategy.LCFSPRIO;
236 case 'lcfsprprio'
237 type = SchedStrategy.LCFSPRPRIO;
238 case 'lcfspiprio'
239 type = SchedStrategy.LCFSPIPRIO;
240 case 'fcfsprprio'
241 type = SchedStrategy.FCFSPRPRIO;
242 case 'fcfspiprio'
243 type = SchedStrategy.FCFSPIPRIO;
244 case 'polling'
245 type = SchedStrategy.POLLING;
246 case 'psprio'
247 type = SchedStrategy.PSPRIO;
248 case 'dpsprio'
249 type = SchedStrategy.DPSPRIO;
250 case 'gpsprio'
251 type = SchedStrategy.GPSPRIO;
252 case 'edd'
253 type = SchedStrategy.EDD;
254 case 'edf'
255 type = SchedStrategy.EDF;
256 case 'lps'
257 type = SchedStrategy.LPS;
258 otherwise
259 line_error(mfilename, 'Unrecognized scheduling strategy text.');
260 end
261 end
262
263 function property = toProperty(text)
264 % PROPERTY = TOPROPERTY(TEXT)
265 if iscell(text)
266 text = text{:};
267 end
268 switch lower(text)
269 case 'inf'
270 property = 'INF';
271 case 'fcfs'
272 property = 'FCFS';
273 case 'fcfspr'
274 property = 'FCFSPR';
275 case 'fcfspi'
276 property = 'FCFSPI';
277 case 'lcfs'
278 property = 'LCFS';
279 case 'siro'
280 property = 'SIRO';
281 case 'sjf'
282 property = 'SJF';
283 case 'ljf'
284 property = 'LJF';
285 case 'ps'
286 property = 'PS';
287 case 'dps'
288 property = 'DPS';
289 case 'gps'
290 property = 'GPS';
291 case 'sept'
292 property = 'SEPT';
293 case 'lept'
294 property = 'LEPT';
295 case 'srpt'
296 property = 'SRPT';
297 case 'srptprio'
298 property = 'SRPTPRIO';
299 case 'hol'
300 property = 'HOL';
301 case 'fcfsprio'
302 property = 'FCFSPRIO';
303 case 'fork'
304 property = 'FORK';
305 case 'ext'
306 property = 'EXT';
307 case 'ref'
308 property = 'REF';
309 case 'lcfspr'
310 property = 'LCFSPR';
311 case 'lcfspi'
312 property = 'LCFSPI';
313 case 'lcfsprio'
314 property = 'LCFSPRIO';
315 case 'lcfsprprio'
316 property = 'LCFSPRPRIO';
317 case 'lcfspiprio'
318 property = 'LCFSPIPRIO';
319 case 'fcfsprprio'
320 property = 'FCFSPRPRIO';
321 case 'fcfspiprio'
322 property = 'FCFSPIPRIO';
323 case 'polling'
324 property = 'POLLING';
325 case 'psprio'
326 property = 'PSPRIO';
327 case 'dpsprio'
328 property = 'DPSPRIO';
329 case 'gpsprio'
330 property = 'GPSPRIO';
331 case 'edd'
332 property = 'EDD';
333 case 'edf'
334 property = 'EDF';
335 case 'lps'
336 property = 'LPS';
337 otherwise
338 line_error(mfilename, 'Unrecognized scheduling strategy property.');
339 end
340 end
341
342 function text = toFeature(type)
343 % TEXT = TOFEATURE(TYPE)
344 switch type
345 case SchedStrategy.INF
346 text = 'SchedStrategy_INF';
347 case SchedStrategy.FCFS
348 text = 'SchedStrategy_FCFS';
349 case SchedStrategy.FCFSPR
350 text = 'SchedStrategy_FCFSPR';
351 case SchedStrategy.FCFSPI
352 text = 'SchedStrategy_FCFSPI';
353 case SchedStrategy.LCFS
354 text = 'SchedStrategy_LCFS';
355 case SchedStrategy.SIRO
356 text = 'SchedStrategy_SIRO';
357 case SchedStrategy.SJF
358 text = 'SchedStrategy_SJF';
359 case SchedStrategy.LJF
360 text = 'SchedStrategy_LJF';
361 case SchedStrategy.PS
362 text = 'SchedStrategy_PS';
363 case SchedStrategy.DPS
364 text = 'SchedStrategy_DPS';
365 case SchedStrategy.GPS
366 text = 'SchedStrategy_GPS';
367 case SchedStrategy.SEPT
368 text = 'SchedStrategy_SEPT';
369 case SchedStrategy.LEPT
370 text = 'SchedStrategy_LEPT';
371 case SchedStrategy.SRPT
372 text = 'SchedStrategy_SRPT';
373 case SchedStrategy.SRPTPRIO
374 text = 'SchedStrategy_SRPTPRIO';
375 case SchedStrategy.HOL
376 text = 'SchedStrategy_HOL';
377 case SchedStrategy.FCFSPRIO
378 text = 'SchedStrategy_HOL';
379 case SchedStrategy.FORK
380 text = 'SchedStrategy_FORK';
381 case SchedStrategy.EXT
382 text = 'SchedStrategy_EXT';
383 case SchedStrategy.REF
384 text = 'SchedStrategy_REF';
385 case SchedStrategy.LCFSPR
386 text = 'SchedStrategy_LCFSPR';
387 case SchedStrategy.LCFSPI
388 text = 'SchedStrategy_LCFSPI';
389 case SchedStrategy.LCFSPRIO
390 text = 'SchedStrategy_LCFSPRIO';
391 case SchedStrategy.LCFSPRPRIO
392 text = 'SchedStrategy_LCFSPRPRIO';
393 case SchedStrategy.LCFSPIPRIO
394 text = 'SchedStrategy_LCFSPIPRIO';
395 case SchedStrategy.FCFSPRPRIO
396 text = 'SchedStrategy_FCFSPRPRIO';
397 case SchedStrategy.FCFSPIPRIO
398 text = 'SchedStrategy_FCFSPIPRIO';
399 case SchedStrategy.POLLING
400 text = 'SchedStrategy_POLLING';
401 case SchedStrategy.PSPRIO
402 text = 'SchedStrategy_PSPRIO';
403 case SchedStrategy.DPSPRIO
404 text = 'SchedStrategy_DPSPRIO';
405 case SchedStrategy.GPSPRIO
406 text = 'SchedStrategy_GPSPRIO';
407 case SchedStrategy.EDD
408 text = 'SchedStrategy_EDD';
409 case SchedStrategy.EDF
410 text = 'SchedStrategy_EDF';
411 case SchedStrategy.LPS
412 text = 'SchedStrategy_LPS';
413 otherwise
414 line_error(mfilename, 'Unrecognized scheduling strategy feature.');
415 end
416 end
417 end
418end