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 PSJF = 33; % Preemptive Shortest Job First (priority by original size)
79 FB = 34; % Feedback / Least Attained Service (priority by age)
80 LAS = 34; % Alias for FB (Least Attained Service)
81 LRPT = 35; % Longest Remaining Processing Time
82 SETF = 36; % Shortest Elapsed Time First (non-preemptive FB)
83 SET = 36; % Alias for SETF
84 end
85
86 methods (Static)
87 function id = toId(type)
88 % ID = TOID(TYPE)
89 if isnumeric(type)
90 id = type;
91 else
92 line_error(mfilename, 'Invalid scheduling strategy type.');
93 end
94 end
95
96 function type = fromId(id)
97 % TYPE = FROMID(ID)
98 if ismember(id, [SchedStrategy.INF, SchedStrategy.FCFS, SchedStrategy.LCFS, ...
99 SchedStrategy.SIRO, SchedStrategy.SJF, SchedStrategy.LJF, ...
100 SchedStrategy.PS, SchedStrategy.DPS, SchedStrategy.GPS, ...
101 SchedStrategy.SEPT, SchedStrategy.LEPT, SchedStrategy.SRPT, SchedStrategy.SRPTPRIO, SchedStrategy.HOL, ...
102 SchedStrategy.FORK, SchedStrategy.EXT, SchedStrategy.REF, ...
103 SchedStrategy.LCFSPR, SchedStrategy.POLLING, ...
104 SchedStrategy.PSPRIO, SchedStrategy.DPSPRIO, SchedStrategy.GPSPRIO, ...
105 SchedStrategy.LCFSPI, SchedStrategy.LCFSPRIO, SchedStrategy.LCFSPRPRIO, SchedStrategy.LCFSPIPRIO, ...
106 SchedStrategy.FCFSPRIO, SchedStrategy.FCFSPR, SchedStrategy.FCFSPI, SchedStrategy.FCFSPRPRIO, SchedStrategy.FCFSPIPRIO, ...
107 SchedStrategy.EDD, SchedStrategy.EDF, SchedStrategy.LPS, ...
108 SchedStrategy.PSJF, SchedStrategy.FB, SchedStrategy.LRPT, SchedStrategy.SETF])
109 type = id;
110 else
111 line_error(mfilename, 'Unrecognized scheduling strategy ID.');
112 end
113 end
114
115 function text = toText(type)
116 % TEXT = TOTEXT(TYPE)
117 switch type
118 case SchedStrategy.INF
119 text = 'inf';
120 case SchedStrategy.FCFS
121 text = 'fcfs';
122 case SchedStrategy.FCFSPR
123 text = 'fcfspr';
124 case SchedStrategy.FCFSPI
125 text = 'fcfspi';
126 case SchedStrategy.LCFS
127 text = 'lcfs';
128 case SchedStrategy.SIRO
129 text = 'siro';
130 case SchedStrategy.SJF
131 text = 'sjf';
132 case SchedStrategy.LJF
133 text = 'ljf';
134 case SchedStrategy.PS
135 text = 'ps';
136 case SchedStrategy.DPS
137 text = 'dps';
138 case SchedStrategy.GPS
139 text = 'gps';
140 case SchedStrategy.SEPT
141 text = 'sept';
142 case SchedStrategy.LEPT
143 text = 'lept';
144 case SchedStrategy.SRPT
145 text = 'srpt';
146 case SchedStrategy.SRPTPRIO
147 text = 'srptprio';
148 case SchedStrategy.HOL
149 text = 'hol';
150 case SchedStrategy.FCFSPRIO
151 text = 'hol';
152 case SchedStrategy.FORK
153 text = 'fork';
154 case SchedStrategy.EXT
155 text = 'ext';
156 case SchedStrategy.REF
157 text = 'ref';
158 case SchedStrategy.LCFSPR
159 text = 'lcfspr';
160 case SchedStrategy.LCFSPI
161 text = 'lcfspi';
162 case SchedStrategy.LCFSPRIO
163 text = 'lcfsprio';
164 case SchedStrategy.LCFSPRPRIO
165 text = 'lcfsprprio';
166 case SchedStrategy.LCFSPIPRIO
167 text = 'lcfspiprio';
168 case SchedStrategy.FCFSPRPRIO
169 text = 'fcfsprprio';
170 case SchedStrategy.FCFSPIPRIO
171 text = 'fcfspiprio';
172 case SchedStrategy.POLLING
173 text = 'polling';
174 case SchedStrategy.PSPRIO
175 text = 'psprio';
176 case SchedStrategy.DPSPRIO
177 text = 'dpsprio';
178 case SchedStrategy.GPSPRIO
179 text = 'gpsprio';
180 case SchedStrategy.EDD
181 text = 'edd';
182 case SchedStrategy.EDF
183 text = 'edf';
184 case SchedStrategy.LPS
185 text = 'lps';
186 case SchedStrategy.PSJF
187 text = 'psjf';
188 case SchedStrategy.FB
189 text = 'fb';
190 case SchedStrategy.LRPT
191 text = 'lrpt';
192 case SchedStrategy.SETF
193 text = 'setf';
194 otherwise
195 line_error(mfilename, 'Unrecognized scheduling strategy type.');
196 end
197 end
198
199 function type = fromText(text)
200 % TYPE = FROMTEXT(TEXT)
201 if iscell(text)
202 text = text{:};
203 end
204 switch lower(text)
205 case 'inf'
206 type = SchedStrategy.INF;
207 case 'fcfs'
208 type = SchedStrategy.FCFS;
209 case 'fcfspr'
210 type = SchedStrategy.FCFSPR;
211 case 'fcfspi'
212 type = SchedStrategy.FCFSPI;
213 case 'lcfs'
214 type = SchedStrategy.LCFS;
215 case 'siro'
216 type = SchedStrategy.SIRO;
217 case 'sjf'
218 type = SchedStrategy.SJF;
219 case 'ljf'
220 type = SchedStrategy.LJF;
221 case 'ps'
222 type = SchedStrategy.PS;
223 case 'dps'
224 type = SchedStrategy.DPS;
225 case 'gps'
226 type = SchedStrategy.GPS;
227 case 'sept'
228 type = SchedStrategy.SEPT;
229 case 'lept'
230 type = SchedStrategy.LEPT;
231 case 'srpt'
232 type = SchedStrategy.SRPT;
233 case 'srptprio'
234 type = SchedStrategy.SRPTPRIO;
235 case 'hol'
236 type = SchedStrategy.HOL;
237 case 'fcfsprio'
238 type = SchedStrategy.FCFSPRIO;
239 case 'fork'
240 type = SchedStrategy.FORK;
241 case 'ext'
242 type = SchedStrategy.EXT;
243 case 'ref'
244 type = SchedStrategy.REF;
245 case 'lcfspr'
246 type = SchedStrategy.LCFSPR;
247 case 'lcfspi'
248 type = SchedStrategy.LCFSPI;
249 case 'lcfsprio'
250 type = SchedStrategy.LCFSPRIO;
251 case 'lcfsprprio'
252 type = SchedStrategy.LCFSPRPRIO;
253 case 'lcfspiprio'
254 type = SchedStrategy.LCFSPIPRIO;
255 case 'fcfsprprio'
256 type = SchedStrategy.FCFSPRPRIO;
257 case 'fcfspiprio'
258 type = SchedStrategy.FCFSPIPRIO;
259 case 'polling'
260 type = SchedStrategy.POLLING;
261 case 'psprio'
262 type = SchedStrategy.PSPRIO;
263 case 'dpsprio'
264 type = SchedStrategy.DPSPRIO;
265 case 'gpsprio'
266 type = SchedStrategy.GPSPRIO;
267 case 'edd'
268 type = SchedStrategy.EDD;
269 case 'edf'
270 type = SchedStrategy.EDF;
271 case 'lps'
272 type = SchedStrategy.LPS;
273 case 'psjf'
274 type = SchedStrategy.PSJF;
275 case 'fb'
276 type = SchedStrategy.FB;
277 case 'las'
278 type = SchedStrategy.LAS;
279 case 'lrpt'
280 type = SchedStrategy.LRPT;
281 case 'setf'
282 type = SchedStrategy.SETF;
283 case 'set'
284 type = SchedStrategy.SET;
285 case 'pp'
286 % LQNS preemptive priority - maps to FCFS with preemptive resume priority
287 type = SchedStrategy.FCFSPRPRIO;
288 case 'cfs'
289 % LQNS completely fair scheduling - maps to Generalized Processor Sharing
290 type = SchedStrategy.GPS;
291 otherwise
292 line_error(mfilename, 'Unrecognized scheduling strategy text.');
293 end
294 end
295
296 function property = toProperty(text)
297 % PROPERTY = TOPROPERTY(TEXT)
298 if iscell(text)
299 text = text{:};
300 end
301 switch lower(text)
302 case 'inf'
303 property = 'INF';
304 case 'fcfs'
305 property = 'FCFS';
306 case 'fcfspr'
307 property = 'FCFSPR';
308 case 'fcfspi'
309 property = 'FCFSPI';
310 case 'lcfs'
311 property = 'LCFS';
312 case 'siro'
313 property = 'SIRO';
314 case 'sjf'
315 property = 'SJF';
316 case 'ljf'
317 property = 'LJF';
318 case 'ps'
319 property = 'PS';
320 case 'dps'
321 property = 'DPS';
322 case 'gps'
323 property = 'GPS';
324 case 'sept'
325 property = 'SEPT';
326 case 'lept'
327 property = 'LEPT';
328 case 'srpt'
329 property = 'SRPT';
330 case 'srptprio'
331 property = 'SRPTPRIO';
332 case 'hol'
333 property = 'HOL';
334 case 'fcfsprio'
335 property = 'FCFSPRIO';
336 case 'fork'
337 property = 'FORK';
338 case 'ext'
339 property = 'EXT';
340 case 'ref'
341 property = 'REF';
342 case 'lcfspr'
343 property = 'LCFSPR';
344 case 'lcfspi'
345 property = 'LCFSPI';
346 case 'lcfsprio'
347 property = 'LCFSPRIO';
348 case 'lcfsprprio'
349 property = 'LCFSPRPRIO';
350 case 'lcfspiprio'
351 property = 'LCFSPIPRIO';
352 case 'fcfsprprio'
353 property = 'FCFSPRPRIO';
354 case 'fcfspiprio'
355 property = 'FCFSPIPRIO';
356 case 'polling'
357 property = 'POLLING';
358 case 'psprio'
359 property = 'PSPRIO';
360 case 'dpsprio'
361 property = 'DPSPRIO';
362 case 'gpsprio'
363 property = 'GPSPRIO';
364 case 'edd'
365 property = 'EDD';
366 case 'edf'
367 property = 'EDF';
368 case 'lps'
369 property = 'LPS';
370 case 'psjf'
371 property = 'PSJF';
372 case 'fb'
373 property = 'FB';
374 case 'las'
375 property = 'LAS';
376 case 'lrpt'
377 property = 'LRPT';
378 case 'setf'
379 property = 'SETF';
380 case 'set'
381 property = 'SET';
382 otherwise
383 line_error(mfilename, 'Unrecognized scheduling strategy property.');
384 end
385 end
386
387 function text = toFeature(type)
388 % TEXT = TOFEATURE(TYPE)
389 switch type
390 case SchedStrategy.INF
391 text = 'SchedStrategy_INF';
392 case SchedStrategy.FCFS
393 text = 'SchedStrategy_FCFS';
394 case SchedStrategy.FCFSPR
395 text = 'SchedStrategy_FCFSPR';
396 case SchedStrategy.FCFSPI
397 text = 'SchedStrategy_FCFSPI';
398 case SchedStrategy.LCFS
399 text = 'SchedStrategy_LCFS';
400 case SchedStrategy.SIRO
401 text = 'SchedStrategy_SIRO';
402 case SchedStrategy.SJF
403 text = 'SchedStrategy_SJF';
404 case SchedStrategy.LJF
405 text = 'SchedStrategy_LJF';
406 case SchedStrategy.PS
407 text = 'SchedStrategy_PS';
408 case SchedStrategy.DPS
409 text = 'SchedStrategy_DPS';
410 case SchedStrategy.GPS
411 text = 'SchedStrategy_GPS';
412 case SchedStrategy.SEPT
413 text = 'SchedStrategy_SEPT';
414 case SchedStrategy.LEPT
415 text = 'SchedStrategy_LEPT';
416 case SchedStrategy.SRPT
417 text = 'SchedStrategy_SRPT';
418 case SchedStrategy.SRPTPRIO
419 text = 'SchedStrategy_SRPTPRIO';
420 case SchedStrategy.HOL
421 text = 'SchedStrategy_HOL';
422 case SchedStrategy.FCFSPRIO
423 text = 'SchedStrategy_HOL';
424 case SchedStrategy.FORK
425 text = 'SchedStrategy_FORK';
426 case SchedStrategy.EXT
427 text = 'SchedStrategy_EXT';
428 case SchedStrategy.REF
429 text = 'SchedStrategy_REF';
430 case SchedStrategy.LCFSPR
431 text = 'SchedStrategy_LCFSPR';
432 case SchedStrategy.LCFSPI
433 text = 'SchedStrategy_LCFSPI';
434 case SchedStrategy.LCFSPRIO
435 text = 'SchedStrategy_LCFSPRIO';
436 case SchedStrategy.LCFSPRPRIO
437 text = 'SchedStrategy_LCFSPRPRIO';
438 case SchedStrategy.LCFSPIPRIO
439 text = 'SchedStrategy_LCFSPIPRIO';
440 case SchedStrategy.FCFSPRPRIO
441 text = 'SchedStrategy_FCFSPRPRIO';
442 case SchedStrategy.FCFSPIPRIO
443 text = 'SchedStrategy_FCFSPIPRIO';
444 case SchedStrategy.POLLING
445 text = 'SchedStrategy_POLLING';
446 case SchedStrategy.PSPRIO
447 text = 'SchedStrategy_PSPRIO';
448 case SchedStrategy.DPSPRIO
449 text = 'SchedStrategy_DPSPRIO';
450 case SchedStrategy.GPSPRIO
451 text = 'SchedStrategy_GPSPRIO';
452 case SchedStrategy.EDD
453 text = 'SchedStrategy_EDD';
454 case SchedStrategy.EDF
455 text = 'SchedStrategy_EDF';
456 case SchedStrategy.LPS
457 text = 'SchedStrategy_LPS';
458 case SchedStrategy.PSJF
459 text = 'SchedStrategy_PSJF';
460 case SchedStrategy.FB
461 text = 'SchedStrategy_FB';
462 case SchedStrategy.LRPT
463 text = 'SchedStrategy_LRPT';
464 case SchedStrategy.SETF
465 text = 'SchedStrategy_SETF';
466 otherwise
467 line_error(mfilename, 'Unrecognized scheduling strategy feature.');
468 end
469 end
470 end
471end