LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
runAnalyzer.m
1function [runtime, analyzer] = runAnalyzer(self, options)
2% RUNTIME = RUN()
3% Run the solver
4
5T0=tic;
6if nargin<2
7 options = self.getOptions;
8end
9
10QN = []; UN = [];
11RN = []; TN = [];
12CN = []; XN = [];
13lG = NaN;
14
15% The shared gate subsumes the coarse supports(self.model) test (through
16% supportsModelMethod) and additionally reports which features are unsupported;
17% a separate coarse check here would fire first and name nothing. It also
18% validates options.method, as in the other solvers.
19self.runAnalyzerChecks(options);
20
21Solver.resetRandomGeneratorSeed(options.seed);
22
23sn = getStruct(self); % doesn't need initial state
24line_debug(options, 'QNS: starting (method=%s, multiserver=%s)', options.method, options.config.multiserver);
25
26if (strcmp(options.method,'exact')||strcmp(options.method,'mva')) && ~self.model.hasProductFormSolution
27 line_error(mfilename,'The exact method requires the model to have a product-form solution. This model does not have one. You can use Network.hasProductFormSolution() to check before running the solver.');
28end
29
30method = options.method;
31
32switch options.method
33 case 'conway'
34 options.config.multiserver = 'conway';
35 case 'rolia'
36 options.config.multiserver = 'rolia';
37 case 'zhou'
38 options.config.multiserver = 'zhou';
39 case 'suri'
40 options.config.multiserver = 'suri';
41 case 'reiser'
42 options.config.multiserver = 'reiser';
43 case 'schmidt'
44 options.config.multiserver = 'schmidt';
45 case 'default'
46 options.config.multiserver = 'rolia';
47end
48
49if self.model.hasProductFormSolution() || self.model.hasOpenClasses()
50 % Use qnsolver directly for product-form networks or open networks
51 % (QN2LQN does not support Source/Sink nodes for open networks)
52 line_debug(options, 'QNS: product-form or open model, routing to qns_analyzer');
53 [QN,UN,RN,TN,CN,XN,runtime,actualMethod] = solver_qns_analyzer(sn, options);
54else
55 line_debug(options, 'QNS: non-product-form closed model, converting to LQN and using SolverLQNS');
56 lqnmodel=QN2LQN(self.model);
57 lqn = lqnmodel.getStruct;
58 tic;
59 lqnsoptions = SolverLQNS.defaultOptions;
60 lqnsoptions.verbose = false;
61 actualMethod = options.method; % Track the actual method for LQNS path
62 switch options.method
63 case 'conway'
64 lqnsoptions.config.multiserver = 'conway';
65 actualMethod = 'conway';
66 case 'rolia'
67 lqnsoptions.config.multiserver = 'rolia';
68 actualMethod = 'rolia';
69 case 'zhou'
70 lqnsoptions.config.multiserver = 'zhou';
71 actualMethod = 'zhou';
72 case 'suri'
73 lqnsoptions.config.multiserver = 'suri';
74 actualMethod = 'suri';
75 case 'reiser'
76 lqnsoptions.config.multiserver = 'reiser';
77 actualMethod = 'reiser';
78 case 'schmidt'
79 lqnsoptions.config.multiserver = 'schmidt';
80 actualMethod = 'schmidt';
81 case 'default'
82 actualMethod = 'rolia'; % Default is rolia for LQNS
83 end
84 AvgTable = SolverLQNS(lqnmodel,lqnsoptions).getAvgTable;
85 runtime=toc;
86 for r=1:sn.nclasses
87 for i=1:sn.nstations
88 t = lqn.ashift + r + (i-1)*sn.nclasses;
89 QN(i,r) = AvgTable.QLen(t);
90 % lqns already reports the activity utilization per server, which
91 % is the convention LINE uses at a finite-capacity station, so it
92 % is carried over unscaled. Dividing by nservers here would report
93 % a utilization nservers times too low.
94 UN(i,r) = AvgTable.Util(t);
95 RN(i,r) = AvgTable.RespT(t);
96 WN(i,r) = AvgTable.ResidT(t);
97 TN(i,r) = AvgTable.Tput(t);
98 end
99 end
100 XN=[];
101 CN=[];
102end
103
104if nargout > 1
105 analyzer = @(sn) solver_qns_analyzer(sn, options);
106end
107
108sn = self.getStruct;
109T = getAvgTputHandles(self);
110AN = sn_get_arvr_from_tput(sn, TN, T);
111
112% Apply default(...) convention based on actual method used
113if strcmp(method, 'default')
114 method = ['default/' actualMethod];
115else
116 method = actualMethod;
117end
118
119self.setAvgResults(QN,UN,RN,TN,AN,[],CN,XN,runtime,method);
120
121runtime = toc(T0);
122end
Definition fjtag.m:157
Definition Station.m:245