2%% Example: EKF estimation with autoMethod selection
3% Copyright (c) 2012-2026, Imperial College London
7model = Network(
'model');
9node{1} = Delay(model,
'Delay');
10node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
11jobclass{1} = ClosedClass(model,
'Class1', 2, node{1}, 0);
13node{1}.setService(
jobclass{1}, Exp.fitMean(1.0));
14node{2}.setService(
jobclass{1}, Exp(NaN)); % NaN = to be estimated
16P = model.initRoutingMatrix;
20%% Generate synthetic dataset
23arvr_samples = 1.5*ones(n,1) - rand(n,1)*0.1;
24util_samples = 0.4*arvr_samples;
25respt_samples = 0.4./(1 - util_samples);
27%% Create SampledMetric objects
28lambda1 = SampledMetric(MetricType.ArvR, ts, arvr_samples, node{2},
jobclass{1});
29respT1 = SampledMetric(MetricType.RespT, ts, respt_samples, node{2},
jobclass{1});
30util = SampledMetric(MetricType.Util, ts, util_samples, node{2});
33fprintf(1,
'\n=== EKF Estimator ===\n');
34options = ParamEstimator.defaultOptions;
35options.method =
'ekf';
36se = ParamEstimator(model, options);
37se.addSamples(lambda1);
41estVal_ekf = se.estimateAt(node{2});
42fprintf(1,
'EKF demand: Class1=%.4f (true=0.4000)\n', estVal_ekf(1));
44%% Now demonstrate autoMethod
45fprintf(1,
'\n=== autoMethod selection ===\n');
46node{2}.setService(
jobclass{1}, Exp(NaN));
49options2 = ParamEstimator.defaultOptions;
50options2.method =
'auto';
51se2 = ParamEstimator(model, options2);
52se2.addSamples(lambda1);
53se2.addSamples(respT1);
56method = se2.autoMethod();
57fprintf(1,
'autoMethod selected: %s\n', method);
58fprintf(1,
'Required metrics for %s: %s\n', method, ParamEstimator.getRequiredMetrics(method));
59estVal_auto = se2.estimateAt(node{2});
60fprintf(1,
'Auto demand: Class1=%.4f (true=0.4000)\n', estVal_auto(1));
63solver{1} = SolverMVA(model);
64fprintf(1,
'\nSOLVER: %s\n', solver{1}.getName());
65AvgTable{1} = solver{1}.getAvgTable();