LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
HeteroSchedPolicy.m
1classdef (Sealed) HeteroSchedPolicy
2 % HeteroSchedPolicy Enumeration of scheduling policies for heterogeneous multiserver queues
3 %
4 % HeteroSchedPolicy defines constants for scheduling policies that determine
5 % how jobs are assigned to server types in heterogeneous multiserver queues.
6 % These policies are used when a job's class is compatible with multiple
7 % server types.
8 %
9 % @brief Scheduling policies for heterogeneous server assignment
10 %
11 % Available policies:
12 % - ORDER: Assign to first available compatible server type (in definition order)
13 % - ALIS: Assign Longest Idle Server (round-robin with busy servers at back)
14 % - ALFS: Assign Longest Free Server (fairness sorting by coverage)
15 % - FAIRNESS: Fair distribution across compatible server types
16 % - FSF: Fastest Server First (based on expected service time)
17 % - RAIS: Random Available Idle Server
18 %
19 % Example:
20 % @code
21 % queue = Queue(model, 'HeteroQueue', SchedStrategy.FCFS);
22 % st1 = ServerType('Fast', 2);
23 % queue.addServerType(st1);
24 % queue.setHeteroSchedPolicy(HeteroSchedPolicy.FSF);
25 % @endcode
26 %
27 % Copyright (c) 2012-2026, Imperial College London
28 % All rights reserved.
29
30 properties (Constant)
31 % ORDER - First available compatible server type in definition order (default)
32 ORDER = 0;
33
34 % ALIS - Assign Longest Idle Server (round-robin)
35 ALIS = 1;
36
37 % ALFS - Assign Longest Free Server with fairness sorting
38 ALFS = 2;
39
40 % FAIRNESS - Fair distribution across compatible server types
41 FAIRNESS = 3;
42
43 % FSF - Fastest Server First (minimum expected service time)
44 FSF = 4;
45
46 % RAIS - Random Available Idle Server
47 RAIS = 5;
48 end
49
50 methods (Static)
51 function policy = fromText(text)
52 % FROMTEXT Convert text to HeteroSchedPolicy constant
53 %
54 % policy = FROMTEXT(text) converts a string to the corresponding
55 % HeteroSchedPolicy constant value.
56 %
57 % @param text String representation of the policy
58 % @return policy The corresponding HeteroSchedPolicy constant
59
60 switch upper(text)
61 case 'ORDER'
62 policy = HeteroSchedPolicy.ORDER;
63 case 'ALIS'
64 policy = HeteroSchedPolicy.ALIS;
65 case 'ALFS'
66 policy = HeteroSchedPolicy.ALFS;
67 case 'FAIRNESS'
68 policy = HeteroSchedPolicy.FAIRNESS;
69 case 'FSF'
70 policy = HeteroSchedPolicy.FSF;
71 case 'RAIS'
72 policy = HeteroSchedPolicy.RAIS;
73 otherwise
74 line_error(mfilename, 'Unknown HeteroSchedPolicy: %s', text);
75 end
76 end
77
78 function text = toText(policy)
79 % TOTEXT Convert HeteroSchedPolicy constant to text
80 %
81 % text = TOTEXT(policy) converts a HeteroSchedPolicy constant
82 % to its string representation.
83 %
84 % @param policy The HeteroSchedPolicy constant
85 % @return text String representation of the policy
86
87 switch policy
88 case HeteroSchedPolicy.ORDER
89 text = 'ORDER';
90 case HeteroSchedPolicy.ALIS
91 text = 'ALIS';
92 case HeteroSchedPolicy.ALFS
93 text = 'ALFS';
94 case HeteroSchedPolicy.FAIRNESS
95 text = 'FAIRNESS';
96 case HeteroSchedPolicy.FSF
97 text = 'FSF';
98 case HeteroSchedPolicy.RAIS
99 text = 'RAIS';
100 otherwise
101 text = 'UNKNOWN';
102 end
103 end
104 end
105end