LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
matlab
src
solvers
wrappers
QNS
@SolverQNS
SolverQNS.m
1
classdef SolverQNS < NetworkSolver
2
% Wrapper of LQNS
's qnsolver
3
%
4
% Copyright (c) 2012-2026, Imperial College London
5
% All rights reserved.
6
7
methods
8
function self = SolverQNS(model,varargin)
9
% SELF = SolverQNS(MODEL,VARARGIN)
10
11
self@NetworkSolver(model, mfilename);
12
self.setOptions(Solver.parseOptions(varargin, self.defaultOptions));
13
end
14
15
runtime = run(self)
16
17
function sn = getStruct(self)
18
% QN = GETSTRUCT()
19
20
% Get data structure summarizing the model
21
sn = self.model.getStruct(false);
22
end
23
24
[runtime, analyzer] = runAnalyzer(self, options);
25
26
function [allMethods] = listValidMethods(self)
27
% allMethods = LISTVALIDMETHODS()
28
% List valid methods for this solver
29
sn = self.model.getStruct();
30
allMethods = {'
default
','
conway
','
rolia
','
zhou
','
suri
','
reiser
','
schmidt
'};
31
end
32
function featSupported = getMethodFeatureSet(self, method) %#ok<INUSD>
33
% All QNS methods share the solver-level feature envelope.
34
%
35
% Defining this is what lets NetworkSolver.supportsModelMethod name
36
% the offending features: with no method feature set it falls back
37
% to the coarse supports(model), which returns an empty reason, so
38
% the gate could only report "features not supported" without
39
% saying which ones.
40
%
41
% A non-Network model (e.g. a LayeredNetwork) has no
42
% getUsedLangFeatures, so it keeps the coarse path and any
43
% structural checks or redirects that operate on such models.
44
if ~isa(self.model, '
Network
')
45
featSupported = [];
46
return;
47
end
48
featSupported = SolverQNS.getFeatureSet();
49
end
50
51
52
end
53
54
methods (Static)
55
56
function featSupported = getFeatureSet()
57
% FEATSUPPORTED = GETFEATURESET()
58
59
featSupported = SolverFeatureSet;
60
featSupported.setTrue({'
Sink
',...
61
'
Source
',...
62
'
Router
',...
63
'
ClassSwitch
',...
64
'
Delay
',...
65
'
DelayStation
',...
66
'
Queue
',...
67
'
Fork
',...
68
'
Join
',...
69
'
Forker
',...
70
'
Joiner
',...
71
'
Logger
',...
72
'
Coxian
',...
73
'
Cox2
',...
74
'
APH
',...
75
'
Erlang
',...
76
'
Exp
',...
77
'
HyperExp
',...
78
'
Det
',...
79
'
Gamma
',...
80
'
Lognormal
',...
81
'
MAP
',...
82
'
MMPP2
',...
83
'
Normal
',...
84
'
PH
',...
85
'
Pareto
',...
86
'
Weibull
',...
87
'
Replayer
',...
88
'
Trace
',...
89
'
Uniform
',...
90
'
StatelessClassSwitcher
',...
91
'
InfiniteServer
',...
92
'
SharedServer
',...
93
'
Buffer
',...
94
'
Dispatcher
',...
95
'
Server
',...
96
'
JobSink
',...
97
'
RandomSource
',...
98
'
ServiceTunnel
',...
99
'
LogTunnel
',...
100
'
Buffer
', ...
101
'
Linkage
',...
102
'
Enabling
', ...
103
'
Timing
', ...
104
'
Firing
', ...
105
'
Storage
', ...
106
'
Place
', ...
107
'
Transition
', ...
108
'
SchedStrategy_INF
',...
109
'
SchedStrategy_PS
',...
110
'
SchedStrategy_DPS
',...
111
'
SchedStrategy_FCFS
',...
112
'
SchedStrategy_GPS
',...
113
'
SchedStrategy_SIRO
',...
114
'
SchedStrategy_HOL
',...
115
'
SchedStrategy_LCFS
',...
116
'
SchedStrategy_LCFSPR
',...
117
'
SchedStrategy_SEPT
',...
118
'
SchedStrategy_LEPT
',...
119
'
SchedStrategy_SJF
',...
120
'
SchedStrategy_LJF
',...
121
'
RoutingStrategy_PROB
',...
122
'
RoutingStrategy_RAND
',...
123
'
RoutingStrategy_RROBIN
',...
124
'
RoutingStrategy_WRROBIN
',...
125
'
RoutingStrategy_KCHOICES
',...
126
'
SchedStrategy_EXT
',...
127
'
ClosedClass
',...
128
'
OpenClass
'});
129
end
130
131
function [bool, featSupported] = supports(model)
132
% [BOOL, FEATSUPPORTED] = SUPPORTS(MODEL)
133
134
featUsed = model.getUsedLangFeatures();
135
featSupported = SolverQNS.getFeatureSet();
136
bool = SolverFeatureSet.supports(featSupported, featUsed);
137
end
138
end
139
140
methods (Static)
141
function bool = isAvailable()
142
%ISAVAILABLE Check if QNS is available on the system path
143
bool = true;
144
if ispc
145
[~, ret] = dos('
qns -V
');
146
if contains(ret, '
not recognized
', '
IgnoreCase
', true)
147
bool = false;
148
return;
149
end
150
else
151
[~, ret] = unix('
qns -V
');
152
if contains(ret, '
command not found
', '
IgnoreCase
', true)
153
bool = false;
154
return;
155
end
156
end
157
end
158
159
function options = defaultOptions()
160
% OPTIONS = DEFAULTOPTIONS()
161
162
options = SolverOptions('
QNS
');
163
options.timespan = [Inf,Inf];
164
end
165
end
166
end
Generated by
1.9.8