1%% Jackson Network with MAM
3% This example demonstrates MAM with RCAT methods on an open Jackson network with
4% probabilistic routing. The RCAT algorithm models job transfers between
5% queues as synchronization actions between interacting processes.
7% Reference: Jackson, J.R. (1957).
"Networks of waiting lines"
9% Copyright (c) 2012-2025, Imperial College London
15lambda = 1.0; % External arrival rate
16mu = [2.0, 3.0, 2.5]; % Service rates
18% Routing probabilities
19p12 = 0.4; % Queue1 -> Queue2
20p13 = 0.3; % Queue1 -> Queue3
21p1s = 0.3; % Queue1 -> Sink
22p21 = 0.2; % Queue2 -> Queue1
23p23 = 0.3; % Queue2 -> Queue3
24p2s = 0.5; % Queue2 -> Sink
25p3s = 1.0; % Queue3 -> Sink
28model = Network(
'Jackson-3Q');
30source = Source(model,
'Source');
31queue1 = Queue(model,
'Queue1', SchedStrategy.FCFS);
32queue2 = Queue(model,
'Queue2', SchedStrategy.FCFS);
33queue3 = Queue(model,
'Queue3', SchedStrategy.FCFS);
34sink = Sink(model,
'Sink');
36oclass = OpenClass(model,
'Class1');
37source.setArrival(oclass, Exp(lambda));
38queue1.setService(oclass, Exp(mu(1)));
39queue2.setService(oclass, Exp(mu(2)));
40queue3.setService(oclass, Exp(mu(3)));
43P = model.initRoutingMatrix();
44P{1,1}(source, queue1) = 1.0;
45P{1,1}(queue1, queue2) = p12;
46P{1,1}(queue1, queue3) = p13;
47P{1,1}(queue1, sink) = p1s;
48P{1,1}(queue2, queue1) = p21;
49P{1,1}(queue2, queue3) = p23;
50P{1,1}(queue2, sink) = p2s;
51P{1,1}(queue3, sink) = p3s;
54%% Solve with MAM
using INAP method (
default)
55solverINAP = MAM(model,
'method',
'inap');
56avgTableINAP = solverINAP.getAvgTable()
58%% Solve with MAM
using exact method (AutoCAT)
59solverExact = MAM(model,
'method',
'exact');
60avgTableExact = solverExact.getAvgTable()
62%% Solve with MVA
for comparison
63solverMVA = MVA(model);
64avgTableMVA = solverMVA.getAvgTable()