LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
SolverFeatureSet.m
1classdef SolverFeatureSet < handle
2 % An auxiliary class to specify the features supported by a solver.
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties
8 list; % list of features
9 end
10
11 properties (Constant)
12 % Canonical feature-name registry; must stay identical to
13 % jar FeatureSet.java and python base.py SolverFeatureSet.FIELDS.
14 % It also lists the distributions that no solver supports as a service
15 % or arrival process (DiscreteSampler, DiscreteUniform, Empirical, GMM,
16 % MMDP, MMDP2, MMPP, MultivariateNormal, NegBinomial, Prior, Zipf):
17 % their names can still be emitted by getUsedLangFeatures, and an
18 % unregistered name is invisible to SUPPORTS, which iterates this list,
19 % so the model would pass the support gate as if the distribution were
20 % absent. No solver declares them, hence a clean rejection instead.
21 fields = {'ClassSwitch',...
22 'Cache', ...
23 'Delay', ...
24 'DelayStation',...
25 'Fork',...
26 'Join',...
27 'Logger',...
28 'Place', ...
29 'QueueingPlace', ...
30 'Queue', ...
31 'JobSink',...
32 'Sink',...
33 'Source',...
34 'Router',...
35 'Transition', ...
36 'Coxian',...
37 'Cox2',...
38 'APH',...
39 'Det', ...
40 'Disabled',...
41 'Erlang',...
42 'Exp',...
43 'Gamma',...
44 'HyperExp', ...
45 'Immediate',...
46 'Lognormal',...
47 'MAP',...
48 'DMAP',...
49 'MMAP',...
50 'BMAP',...
51 'MMPP2',...
52 'NHPP',...
53 'EmpiricalCdf',... % name declared by EmpiricalCDF.m, not the JSON wire type
54 'Expolynomial',...
55 'Normal',...
56 'Pareto',...
57 'PH',...
58 'ME',...
59 'RAP',...
60 'Replayer',...
61 'Trace',...
62 'Uniform', ...
63 'Weibull',...
64 'Bernoulli',...
65 'Binomial',...
66 'Geometric',...
67 'Poisson',...
68 'DiscreteSampler',...
69 'DiscreteUniform',...
70 'Empirical',...
71 'GMM',...
72 'MMDP',...
73 'MMDP2',...
74 'MMPP',...
75 'MultivariateNormal',...
76 'NegBinomial',...
77 'Prior',...
78 'Zipf',...
79 'StatelessClassSwitcher',...
80 'CacheClassSwitcher',...
81 'CacheRetrieval',...
82 'InfiniteServer',...
83 'Forker',...
84 'Joiner',...
85 'LogTunnel', ...
86 'SharedServer', ...
87 'Buffer', ...
88 'Region', ...
89 'Linkage',...
90 'Enabling', ...
91 'Inhibiting', ...
92 'Timing', ...
93 'Firing', ...
94 'Storage', ...
95 'RandomSource', ...
96 'Dispatcher', ...
97 'Server', ...
98 'ServiceTunnel', ...
99 'RoutingStrategy_PROB', ...
100 'RoutingStrategy_RAND', ...
101 'RoutingStrategy_RROBIN', ...
102 'RoutingStrategy_WRROBIN', ...
103 'RoutingStrategy_JSQ', ...
104 'RoutingStrategy_SQ', ...
105 'RoutingStrategy_RL', ...
106 'SchedStrategy_INF', ...
107 'SchedStrategy_FCFS', ...
108 'SchedStrategy_FCFSPR', ...
109 'SchedStrategy_FCFSPI', ...
110 'SchedStrategy_FCFSPRIO', ...
111 'SchedStrategy_FCFSPRPRIO', ...
112 'SchedStrategy_FCFSPIPRIO', ...
113 'SchedStrategy_LCFS', ...
114 'SchedStrategy_LCFSPR', ...
115 'SchedStrategy_LCFSPI', ...
116 'SchedStrategy_LCFSPRIO', ...
117 'SchedStrategy_LCFSPRPRIO', ...
118 'SchedStrategy_LCFSPIPRIO', ...
119 'SchedStrategy_SEPT', ...
120 'SchedStrategy_LEPT', ...
121 'SchedStrategy_SJF', ...
122 'SchedStrategy_LJF', ...
123 'SchedStrategy_SRPT', ...
124 'SchedStrategy_SRPTPRIO', ...
125 'SchedStrategy_PSJF', ...
126 'SchedStrategy_FB', ...
127 'SchedStrategy_LRPT', ...
128 'SchedStrategy_SETF', ...
129 'SchedStrategy_FSP', ...
130 'SchedStrategy_PAS', ...
131 'SchedStrategy_OI', ...
132 'SchedStrategy_PS', ...
133 'SchedStrategy_DPS', ...
134 'SchedStrategy_GPS', ...
135 'SchedStrategy_PSPRIO', ...
136 'SchedStrategy_DPSPRIO', ...
137 'SchedStrategy_GPSPRIO', ...
138 'SchedStrategy_SIRO', ...
139 'SchedStrategy_HOL', ...
140 'SchedStrategy_EXT', ...
141 'SchedStrategy_POLLING', ...
142 'SchedStrategy_EDD', ...
143 'SchedStrategy_EDF', ...
144 'SchedStrategy_LPS', ...
145 'ReplacementStrategy_RR', ...
146 'ReplacementStrategy_FIFO', ...
147 'ReplacementStrategy_SFIFO', ...
148 'ReplacementStrategy_LRU', ...
149 'ReplacementStrategy_HLRU', ...
150 'ReplacementStrategy_CLIMB', ...
151 'ReplacementStrategy_QLRU', ...
152 'ClosedClass', ...
153 'OpenClass', ...
154 'SelfLoopingClass', ...
155 'OpenSignal', ...
156 'ClosedSignal', ...
157 'SignalType_NEGATIVE', ...
158 'SignalType_REPLY', ...
159 'SignalType_CATASTROPHE', ...
160 'SignalBatchRemoval', ...
161 'SignalRemovalPolicy', ...
162 'BatchArrival', ...
163 'LoadDependence', ...
164 'ClassDependence', ...
165 'JointDependence', ...
166 'SetupDelayOff', ...
167 'Retrial', ...
168 'Balking', ...
169 'Reneging', ...
170 'Breakdown', ...
171 'Host', ...
172 'Processor', ...
173 'Task', ...
174 'Entry', ...
175 'Activity', ...
176 'SyncCall', ...
177 'AsyncCall', ...
178 'ActivityPrecedence_PRE_SEQ', ...
179 'ActivityPrecedence_POST_SEQ', ...
180 'ActivityPrecedence_PRE_AND', ...
181 'ActivityPrecedence_POST_AND', ...
182 'ActivityPrecedence_PRE_OR', ...
183 'ActivityPrecedence_POST_OR', ...
184 'SchedStrategy_REF'};
185 end
186
187 methods
188 function self = SolverFeatureSet()
189 % SELF = SOLVERFEATURESET()
190
191 % Nodes and Stations
192 fields = SolverFeatureSet.fields;
193 for f=1:length(fields)
194 self.list.(fields{f})=false;
195 end
196 end
197
198 function self = setTrue(self, feature)
199 % SELF = SETTRUE(FEATURE)
200
201 if iscell(feature)
202 for c=1:length(feature)
203 self.setTrue(feature{c});
204 end
205 else
206 if ~strcmpi(feature,'char') && isfield(self.list, feature)
207 % Unregistered names are ignored on purpose: unlike the jar,
208 % which curates every name it records, MNetwork.addNode
209 % feeds raw node and section class names (Section,
210 % InputSection, ServiceSection, ClassSwitcher, ...) that
211 % denote no capability and that no solver declares, so
212 % registering them would reject every model. The corollary
213 % is that a genuine capability name missing from FIELDS is
214 % silently unenforced: keep FIELDS identical to jar
215 % FeatureSet.java and python SolverFeatureSet.FIELDS.
216 self.list.(feature) = true;
217 end
218 end
219 end
220
221 function self = setFalse(self, feature)
222 % SELF = SETFALSE(FEATURE)
223
224 if iscell(feature)
225 for c=1:length(feature)
226 self.setFalse(feature{c});
227 end
228 else
229 if isfield(self.list, feature) % see SETTRUE
230 self.list.(feature) = false;
231 end
232 end
233 end
234
235 end
236
237 methods(Static)
238 function [bool, reason] = supports(featSupportedList, featUsedList)
239 % [BOOL, REASON] = SUPPORTS(FEATSUPPORTEDLIST, FEATUSEDLIST)
240 %
241 % BOOL is true when every feature used by the model is supported.
242 % REASON is a human-readable list of the offending feature names
243 % (empty when BOOL is true), for use in method-aware error messages.
244
245 bool = true;
246 unsupported = {};
247
248 % Nodes and Stations
249 fields = SolverFeatureSet.fields;
250 for f=1:length(fields)
251 if featUsedList.list.(fields{f}) > featSupportedList.list.(fields{f})
252 bool = false;
253 unsupported{end+1} = fields{f}; %#ok<AGROW>
254 end
255 end
256
257 reason = '';
258 if ~isempty(unsupported)
259 str='Some features are not supported by the chosen solver (feature: ';
260 for u=1:length(unsupported)
261 if u==1
262 str = sprintf('%s%s',str,unsupported{u});
263 else
264 str = sprintf('%s, %s',str,unsupported{u});
265 end
266 end
267 str = sprintf('%s).\n',str);
268 reason = str;
269 % Preserve the historical side-effect warning for the coarse
270 % (solver-level) callers that do not consume REASON.
271 if nargout < 2
272 line_warning(mfilename,str);
273 end
274 end
275 end
276 end
277end