LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
runAnalyzer.m
1function [runtime, analyzer] = runAnalyzer(self, options)
2% RUNANALYZER Execute the bound-analysis solver.
3%
4% Dispatches noniterative bound families to the shared bound handler
5% solver_ba_analyzer, and hierarchical/iterative families to their
6% SolverBA-native analyzers. Each method returns a single (upper or lower)
7% bound; use getBounds() to obtain the {lower,upper} bracket for a family.
8%
9% Copyright (c) 2012-2026, Imperial College London
10% All rights reserved.
11
12if nargin < 2
13 options = self.getOptions;
14end
15
16sn = self.getStruct;
17
18if sn.nclosedjobs <= 0
19 line_error(mfilename, 'SolverBA supports closed queueing networks only.');
20end
21
22% 'default' -> geometric upper bound; 'qr' -> QRF quadratic reduction; 'lr' ->
23% LP linear reduction (bare 'lr' means 'lr.upper'), distinct from
24% 'qrf.mmi.linear'. see _kb/06-solver-catalog.md for rationale
25method = options.method;
26if strcmp(method,'default')
27 method = 'gb.upper';
28elseif strcmp(method,'lr')
29 method = 'lr.upper';
30elseif strcmp(method,'qr')
31 method = 'qrf.mmi';
32end
33
34% Show library attribution (QRF uses the Optimization Toolbox) once.
35if options.verbose ~= VerboseLevel.SILENT && ~GlobalConstants.isLibraryAttributionShown()
36 libs = SolverBA.getLibrariesUsed([], setfield(options,'method',method)); %#ok<SFLD>
37 if ~isempty(libs)
38 line_printf('The solver will leverage %s.\n', strjoin(libs, ', '));
39 GlobalConstants.setLibraryAttributionShown(true);
40 end
41end
42
43iter = 1;
44if startsWith(method,'qrf')
45 % QRF (Quadratic Reduction Framework) LP-based bounds for single-class
46 % closed networks with PH service. The adapter enforces its own gating.
47 analyzer = @(qn) solver_ba_qrf_analyzer(qn, setfield(options,'method',method)); %#ok<SFLD>
48 bopts = options; bopts.method = method;
49 [QN,UN,RN,TN,CN,XN,runtime] = solver_ba_qrf_analyzer(sn, bopts);
50elseif any(strcmp(method, self.listValidMethods()))
51 analyzer = @(qn) solver_ba_analyzer(qn, setfield(options,'method',method)); %#ok<SFLD>
52 bopts = options; bopts.method = method;
53 [QN,UN,RN,TN,CN,XN,lG,runtime,iter] = solver_ba_analyzer(sn, bopts);
54else
55 line_error(mfilename, ['Unknown bound method ''%s''. Valid methods: %s'], ...
56 method, strjoin(self.listValidMethods(), ', '));
57end
58
59M = sn.nstations;
60R = sn.nclasses;
61% Arrival rates from throughputs via sn_get_arvr_from_tput (not a zero matrix).
62% see _kb/06-solver-catalog.md for rationale
63AN = sn_get_arvr_from_tput(sn, TN, self.getAvgTputHandles());
64WN = zeros(M,R);
65self.setAvgResults(QN,UN,RN,TN,AN,WN,CN,XN,runtime,method,iter);
66end