2%% Example: MCMC estimation on a closed network
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);
12jobclass{2} = ClosedClass(model,
'Class2', 3, node{1}, 0);
14node{1}.setService(
jobclass{1}, Exp.fitMean(1.0));
15node{1}.setService(
jobclass{2}, Exp.fitMean(1.0));
17node{2}.setService(
jobclass{1}, Exp(NaN)); % NaN = to be estimated
18node{2}.setService(
jobclass{2}, Exp(NaN)); % NaN = to be estimated
20P = model.initRoutingMatrix;
25%% Generate synthetic dataset
28qlen_samples = 1.5 + rand(n,1)*0.5; % aggregate queue-length observations
30%% Create SampledMetric objects (aggregate, no
class specified)
31ql = SampledMetric(MetricType.QLen, ts, qlen_samples, node{2});
34fprintf(1,
'\n=== MCMC Estimator ===\n');
35options = ParamEstimator.defaultOptions;
36options.method =
'mcmc';
37se = ParamEstimator(model, options);
40estVal = se.estimateAt(node{2});
41fprintf(1,
'MCMC demands: Class1=%.4f, Class2=%.4f\n', estVal(1), estVal(2));
44solver{1} = SolverMVA(model);
45fprintf(1,
'\nSOLVER: %s\n', solver{1}.getName());
46AvgTable{1} = solver{1}.getAvgTable();