LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ag_closed_network.m
1%% Closed Network with MAM
2%
3% This example demonstrates MAM with RCAT methods on a closed queueing network
4% with processor-sharing (PS) queues using the INAP algorithm.
5%
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.
9%
10% Copyright (c) 2012-2025, Imperial College London
11% All rights reserved.
12
13clear; clc;
14
15%% Parameters
16N = 10; % Number of jobs
17mu1 = 2.0; % Service rate at queue 1
18mu2 = 1.0; % Service rate at queue 2
19
20%% Create model: Queue1 <-> Queue2 (closed loop)
21model = Network('Closed-2Q');
22
23queue1 = Queue(model, 'Queue1', SchedStrategy.PS);
24queue2 = Queue(model, 'Queue2', SchedStrategy.PS);
25
26cclass = ClosedClass(model, 'Class1', N, queue1);
27queue1.setService(cclass, Exp(mu1));
28queue2.setService(cclass, Exp(mu2));
29
30model.link(Network.serialRouting({queue1, queue2}));
31
32%% Solve with MAM using INAP method (default)
33solverINAP = MAM(model, 'method', 'inap');
34avgTableINAP = solverINAP.getAvgTable()
35
36%% Solve with MAM using exact method (AutoCAT)
37solverExact = MAM(model, 'method', 'exact');
38avgTableExact = solverExact.getAvgTable()
39
40%% Solve with MVA for comparison
41solverMVA = MVA(model);
42avgTableMVA = solverMVA.getAvgTable()
43
44%% Solve with CTMC for exact results (if state space is small)
45if N <= 20
46 solverCTMC = CTMC(model);
47 avgTableCTMC = solverCTMC.getAvgTable()
48end