LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ag_jackson_network.m
1%% Jackson Network with MAM
2%
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.
6%
7% Reference: Jackson, J.R. (1957). "Networks of waiting lines"
8%
9% Copyright (c) 2012-2025, Imperial College London
10% All rights reserved.
11
12clear; clc;
13
14%% Parameters
15lambda = 1.0; % External arrival rate
16mu = [2.0, 3.0, 2.5]; % Service rates
17
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
26
27%% Create model
28model = Network('Jackson-3Q');
29
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');
35
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)));
41
42% Set routing matrix
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;
52model.link(P);
53
54%% Solve with MAM using INAP method (default)
55solverINAP = MAM(model, 'method', 'inap');
56avgTableINAP = solverINAP.getAvgTable()
57
58%% Solve with MAM using exact method (AutoCAT)
59solverExact = MAM(model, 'method', 'exact');
60avgTableExact = solverExact.getAvgTable()
61
62%% Solve with MVA for comparison
63solverMVA = MVA(model);
64avgTableMVA = solverMVA.getAvgTable()