1%% Closed Network with MAM
3% This example demonstrates MAM with RCAT methods on a closed queueing network
4% with processor-sharing (PS) queues
using the INAP algorithm.
6% The RCAT (Reversed Compound Agent Theorem) decomposes the network
7% into interacting stochastic processes and uses fixed-point iteration
8% to compute equilibrium measures.
10% Copyright (c) 2012-2025, Imperial College London
16N = 10; % Number of jobs
17mu1 = 2.0; % Service rate at queue 1
18mu2 = 1.0; % Service rate at queue 2
20%% Create model: Queue1 <-> Queue2 (closed loop)
21model = Network(
'Closed-2Q');
23queue1 = Queue(model,
'Queue1', SchedStrategy.PS);
24queue2 = Queue(model,
'Queue2', SchedStrategy.PS);
26cclass = ClosedClass(model,
'Class1', N, queue1);
27queue1.setService(cclass, Exp(mu1));
28queue2.setService(cclass, Exp(mu2));
30model.link(Network.serialRouting({queue1, queue2}));
32%% Solve with MAM
using INAP method (
default)
33solverINAP = MAM(model,
'method',
'inap');
34avgTableINAP = solverINAP.getAvgTable()
36%% Solve with MAM
using exact method (AutoCAT)
37solverExact = MAM(model,
'method',
'exact');
38avgTableExact = solverExact.getAvgTable()
40%% Solve with MVA
for comparison
41solverMVA = MVA(model);
42avgTableMVA = solverMVA.getAvgTable()
44%% Solve with CTMC
for exact results (
if state space
is small)
46 solverCTMC = CTMC(model);
47 avgTableCTMC = solverCTMC.getAvgTable()