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_ack('QNS', options.verbose);
25
26line_debug(options, 'QNS: starting (method=%s, multiserver=%s)', options.method, options.config.multiserver);
27
28if (strcmp(options.method,'exact')||strcmp(options.method,'mva')) && ~self.model.hasProductFormSolution
29 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.');
30end
31
32method = options.method;
33
34switch options.method
35 case 'conway'
36 options.config.multiserver = 'conway';
37 case 'rolia'
38 options.config.multiserver = 'rolia';
39 case 'zhou'
40 options.config.multiserver = 'zhou';
41 case 'suri'
42 options.config.multiserver = 'suri';
43 case 'reiser'
44 options.config.multiserver = 'reiser';
45 case 'schmidt'
46 options.config.multiserver = 'schmidt';
47 case 'default'
48 options.config.multiserver = 'rolia';
49end
50
51if self.model.hasProductFormSolution() || self.model.hasOpenClasses()
52 % Use qnsolver directly for product-form networks or open networks
53 % (QN2LQN does not support Source/Sink nodes for open networks)
54 line_debug(options, 'QNS: product-form or open model, routing to qns_analyzer');
55 [QN,UN,RN,TN,CN,XN,runtime,actualMethod] = solver_qns_analyzer(sn, options);
56else
57 line_debug(options, 'QNS: non-product-form closed model, converting to LQN and using SolverLQNS');
58 lqnmodel=QN2LQN(self.model);
59 lqn = lqnmodel.getStruct;
60 tic;
61 lqnsoptions = SolverLQNS.defaultOptions;
62 lqnsoptions.verbose = false;
63 actualMethod = options.method; % Track the actual method for LQNS path
64 switch options.method
65 case 'conway'
66 lqnsoptions.config.multiserver = 'conway';
67 actualMethod = 'conway';
68 case 'rolia'
69 lqnsoptions.config.multiserver = 'rolia';
70 actualMethod = 'rolia';
71 case 'zhou'
72 lqnsoptions.config.multiserver = 'zhou';
73 actualMethod = 'zhou';
74 case 'suri'
75 lqnsoptions.config.multiserver = 'suri';
76 actualMethod = 'suri';
77 case 'reiser'
78 lqnsoptions.config.multiserver = 'reiser';
79 actualMethod = 'reiser';
80 case 'schmidt'
81 lqnsoptions.config.multiserver = 'schmidt';
82 actualMethod = 'schmidt';
83 case 'default'
84 actualMethod = 'rolia'; % Default is rolia for LQNS
85 end
86 AvgTable = SolverLQNS(lqnmodel,lqnsoptions).getAvgTable;
87 runtime=toc;
88 for r=1:sn.nclasses
89 for i=1:sn.nstations
90 t = lqn.ashift + r + (i-1)*sn.nclasses;
91 QN(i,r) = AvgTable.QLen(t);
92 % lqns already reports the activity utilization per server, which
93 % is the convention LINE uses at a finite-capacity station, so it
94 % is carried over unscaled. Dividing by nservers here would report
95 % a utilization nservers times too low.
96 UN(i,r) = AvgTable.Util(t);
97 RN(i,r) = AvgTable.RespT(t);
98 WN(i,r) = AvgTable.ResidT(t);
99 TN(i,r) = AvgTable.Tput(t);
100 end
101 end
102 XN=[];
103 CN=[];
104end
105
106if nargout > 1
107 analyzer = @(sn) solver_qns_analyzer(sn, options);
108end
109
110sn = self.getStruct;
111T = getAvgTputHandles(self);
112AN = sn_get_arvr_from_tput(sn, TN, T);
113
114% Apply default(...) convention based on actual method used
115if strcmp(method, 'default')
116 method = ['default/' actualMethod];
117else
118 method = actualMethod;
119end
120
121self.setAvgResults(QN,UN,RN,TN,AN,[],CN,XN,runtime,method);
122
123runtime = toc(T0);
124end
Definition fjtag.m:161