1function runtime = runAnalyzer(self, options)
7 options = self.getOptions;
10if strcmp(options.lang,
'python')
11 line_debug(options, 'MAM: using lang=python, delegating to native line_solver');
12 [QN,UN,RN,TN,AN,WN,runtime] = PYLINE.getAvg(self.name, self.model, options);
13 self.setAvgResults(QN,UN,RN,TN,AN,WN,[],[],runtime,options.method,NaN);
17% runAnalyzerChecks subsumes
the coarse supports(self.model) test (via
18% supportsModelMethod) and additionally reports which features are unsupported.
19% A separate coarse check here would fire first and abort with a message that
21self.runAnalyzerChecks(options);
24% Finite Capacity Region: MAM does not enforce
the aggregate per-region job
25% limit and would silently return
the unconstrained answer.
26if isfield(sn,'nregions') && sn.nregions > 0
27 line_error(mfilename,'This model uses a Finite Capacity Region (addRegion), which
is not supported by SolverMAM. Use SolverCTMC, SolverJMT, SolverSSA or SolverLDES, or setCapacity for a single-station limit.');
30Solver.resetRandomGeneratorSeed(options.seed);
32% Show library attribution if verbose and not yet shown
33if options.verbose ~= VerboseLevel.SILENT && ~GlobalConstants.isLibraryAttributionShown()
34 libs = SolverMAM.getLibrariesUsed(sn, options);
36 line_printf('The solver will leverage %s.\n', strjoin(libs, ', '));
37 GlobalConstants.setLibraryAttributionShown(true);
41%options.lang = 'java';
45 line_debug(options, 'MAM: using lang=java, delegating to JLINE');
46 jmodel = LINE2JLINE(self.model);
47 %M = jmodel.getNumberOfStatefulNodes;
48 M = jmodel.getNumberOfStations;
49 R = jmodel.getNumberOfClasses;
50 jsolver = JLINE.SolverMAM(jmodel, options);
51 [QN,UN,RN,WN,AN,TN] = JLINE.arrayListToResults(jsolver.getAvgTable);
55 QN = reshape(QN',R,M)';
56 UN = reshape(UN',R,M)';
57 RN = reshape(RN',R,M)';
58 WN = reshape(WN',R,M)';
59 AN = reshape(AN',R,M)';
60 TN = reshape(TN',R,M)';
63 self.setAvgResults(QN,UN,RN,TN,AN,WN,CN,XN,runtime,options.method,lastiter);
64 self.result.Prob.logNormConstAggr = lG;
67 line_debug(options, 'MAM: using lang=matlab');
70 % Check if transient analysis
is requested
71 isTran = length(options.timespan) >= 2 && ~isinf(options.timespan(2));
73 if isTran && strcmp(options.method, 'ldqbd')
74 if mam_transient_qbd_applicable(sn)
75 % Correlated MAP arrival/service or non-Poisson arrival: use
the
76 % Laplace-domain transient QBD solver on
the true MAP blocks.
77 line_debug(options, 'MAM: transient analysis via Laplace transient QBD');
78 [Qt, Ut, Tt] = solver_mam_transient_qbd(sn, options);
80 line_debug(options, 'MAM: transient analysis via standard QBD');
81 sn = sn_nonmarkov_toph(sn, options);
82 [Qt, Ut, Tt] = solver_mam_ldqbd_transient(sn, options);
85 Xt = cell(1, sn.nclasses);
86 Ct = cell(1, sn.nclasses);
88 self.setTranAvgResults(Qt, Ut, Rt, Tt, Ct, Xt, runtime);
89 elseif true%~snHasMultipleClosedClasses(sn)
90 line_debug(options, 'MAM: calling solver_mam_analyzer (method=%s)', options.method);
91 % Call solver_mam_analyzer - percResults
is optional 10th output
92 [QN,UN,RN,TN,CN,XN,~,actualmethod,iter,percResults] = solver_mam_analyzer(sn, options);
93 T = getAvgTputHandles(self);
94 AN=sn_get_arvr_from_tput(sn, TN, T);
97 if strcmp(options.method,'default')
98 self.setAvgResults(QN,UN,RN,TN,AN,[],CN,XN,runtime,['default/' actualmethod],iter);
100 self.setAvgResults(QN,UN,RN,TN,AN,[],CN,XN,runtime,options.method,iter);
103 % Store percentile results if FJ_codes was used
104 if ~isempty(percResults)
105 self.result.Percentile = percResults;
108 line_warning(mfilename,'SolverMAM supports at most a single closed class.\n');
110 self.setAvgResults([],[],[],[],[],[],[],[],runtime,options.method,0);