LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
infer_lqn_getobs.m
1function z = infer_lqn_getobs(names, metrics, obsSpec)
2% INFER_LQN_GETOBS Extract an observation vector from solved LQN metrics.
3%
4% Z = INFER_LQN_GETOBS(NAMES, METRICS, OBSSPEC) returns the column vector Z
5% of performance measures selected by OBSSPEC from the per-element numeric
6% metric vectors in METRICS. This is the measurement-model half of the LQN
7% parameter identification method (see INFER_LQN): it maps a solved model to
8% the observation vector z = h(a).
9%
10% NAMES : cell array of element names, as in LayeredNetworkStruct.names.
11% METRICS : struct with fields QLen, Util, RespT, Tput (each a vector indexed
12% by element, aligned with NAMES, as returned by getEnsembleAvg).
13% OBSSPEC : struct array; OBSSPEC(i) has fields:
14% .metric : 'RespT' | 'Util' | 'Tput' | 'QLen'
15% .name : element name (processor for utilization; entry or reference
16% task for response time; entry/task for throughput)
17%
18% Copyright (c) 2012-2026, Imperial College London
19% All rights reserved.
20
21no = numel(obsSpec);
22z = zeros(no, 1);
23for i = 1:no
24 idx = find(strcmp(names, obsSpec(i).name), 1);
25 if isempty(idx)
26 line_error(mfilename, sprintf('Element ''%s'' not found in the LQN.', obsSpec(i).name));
27 end
28 switch lower(obsSpec(i).metric)
29 case 'respt'
30 z(i) = metrics.RespT(idx);
31 case 'util'
32 z(i) = metrics.Util(idx);
33 case 'tput'
34 z(i) = metrics.Tput(idx);
35 case 'qlen'
36 z(i) = metrics.QLen(idx);
37 otherwise
38 line_error(mfilename, sprintf('Unknown metric ''%s''.', obsSpec(i).metric));
39 end
40end
41end
Definition Station.m:245