1function estVal = estimator_mlps(self,
nodes)
3% ESTIMATORMLPS Maximum Likelihood
for Processor Sharing
4% Estimates service demands
using the MLPS likelihood-based method.
5% Supports closed, open, and mixed queueing networks.
6% For open/mixed models, builds a closed equivalent
using Z_r = N_r / lambda_r.
8% Requires trace-format SampledMetric objects with per-request arrival
9% timestamps and response times. PS stations only.
11% Copyright (c) 2012-2026, Imperial College London
13% This code
is released under the 3-Clause BSD License.
15sn = self.model.getStruct;
18if node.schedStrategy ~= SchedStrategy.PS
19 error(
'The MLPS method is available only for processor sharing stations.');
22% Build closed equivalent model
if any
class is open
23hasOpen = any(sn.njobs == Inf);
25 [eqModel, eqNode] = self.buildClosedEquivalentForPS(node);
31% Extract trace data from SampledMetrics
36 jc = self.model.classes{r};
38 % Arrival timestamps (trace format)
39 arvData = self.getArvR(node, jc);
41 error(
'Arrival timestamp data for node %s in class %d is missing.', node.name, r);
44 error(
'MLPS estimator requires trace-format arrival data. Use setTrace() on the SampledMetric.');
47 % Response times (trace format)
48 rtData = self.getRespT(node, jc);
50 error(
'Response time data for node %s in class %d is missing.', node.name, r);
53 error(
'MLPS estimator requires trace-format response time data. Use setTrace() on the SampledMetric.');
56 nSamples = length(rtData.data);
57 rt_all = [rt_all; rtData.data];
58 at_all = [at_all; arvData.data];
59 class_all = [class_all; r * ones(nSamples, 1)];
62% Compute queue lengths at arrival from trace data
65ql = infer_compute_ql_at_arrival(at_all, jobid, rt_all, jobid, class_all, R);
68[~, sortIdx] = sort(at_all);
69rt_sorted = rt_all(sortIdx);
70class_sorted = class_all(sortIdx);
73% Remove zero response times
75rt_sorted = rt_sorted(valid);
76class_sorted = class_sorted(valid);
79estVal = infer_mlps(eqModel, eqNode, rt_sorted, class_sorted, ql);