1function estVal = estimator_fmlps(self,
nodes)
3% ESTIMATORFMLPS Fluid Maximum Likelihood
for Processor Sharing
4% Estimates service demands
using the FMLPS fluid likelihood 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 FMLPS 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);
26 eqSn = eqModel.getStruct;
34% Extract trace data from SampledMetrics
39 jc = self.model.classes{r};
41 % Arrival timestamps (trace format)
42 arvData = self.getArvR(node, jc);
44 error(
'Arrival timestamp data for node %s in class %d is missing.', node.name, r);
47 error(
'FMLPS estimator requires trace-format arrival data. Use setTrace() on the SampledMetric.');
50 % Response times (trace format)
51 rtData = self.getRespT(node, jc);
53 error(
'Response time data for node %s in class %d is missing.', node.name, r);
56 error(
'FMLPS estimator requires trace-format response time data. Use setTrace() on the SampledMetric.');
59 nSamples = length(rtData.data);
60 rt_all = [rt_all; rtData.data];
61 at_all = [at_all; arvData.data];
62 class_all = [class_all; r * ones(nSamples, 1)];
65% Compute queue lengths at arrival from trace data
68ql = infer_compute_ql_at_arrival(at_all, jobid, rt_all, jobid, class_all, R);
71[~, sortIdx] = sort(at_all);
72rt_sorted = rt_all(sortIdx);
73class_sorted = class_all(sortIdx);
76% Remove zero response times
78rt_sorted = rt_sorted(valid);
79class_sorted = class_sorted(valid);
82estVal = infer_fmlps(eqModel, eqNode, rt_sorted, class_sorted, ql, W);