3% Joint-dependent (LJD) model example
4% Service rate scaling depends on per-
class population vector (n1, n2)
5% Scaling table
is stored as linearized lookup table
7N1 = 3; % number of
class-1 jobs
8N2 = 2; % number of
class-2 jobs
11model = Network(
'JointDependenceModel');
12node{1} = Delay(model,
'Delay');
13node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
15jobclass{1} = ClosedClass(model,
'Class1', N1, node{1}, 0);
16jobclass{2} = ClosedClass(model,
'Class2', N2, node{1}, 0);
18node{1}.setService(
jobclass{1}, Exp.fitMean(1.0));
19node{1}.setService(
jobclass{2}, Exp.fitMean(2.0));
20node{2}.setService(
jobclass{1}, Exp.fitMean(1.5));
21node{2}.setService(
jobclass{2}, Exp.fitMean(2.5));
23% Define cutoffs
for per-
class population
24cutoffs = [N1, N2]; % max population per
class
26% Create scaling table
for joint dependence
27% Table size = (N1+1) * (N2+1) = 4 * 3 = 12
28% Linearized index: idx = 1 + n1 + n2*(N1+1) (MATLAB 1-indexed)
30% Example scaling: more jobs of either
class -> lower scaling (higher congestion)
31% Row-major order would be: (0,0), (1,0), (2,0), (3,0), (0,1), ...
32% But we use column-major linearization
for the lookup
33scalingTable = zeros(1, prod(cutoffs + 1));
36 idx = ljd_linearize([n1, n2], cutoffs);
37 % Example: scaling decreases as total population increases
40 scalingTable(idx) = 1.0;
42 scalingTable(idx) = 1.0 / totalN; % slower service with more jobs
44 scalingTable(idx) = 0.5 / totalN; % even slower at high load
49% Set joint dependence on Queue1
50node{2}.setJointDependence(scalingTable, cutoffs);
53P = model.initRoutingMatrix();
54P{1,1} = model.serialRouting(node);
55P{2,2} = model.serialRouting(node);
58%% Solve with MVA (qd method supports LJD)
59fprintf(
'Solving joint-dependent model with MVA (qd):\n');
60AvgTableMVA = MVA(model,
'method',
'qd').getAvgTable;
63%% For comparison, solve an equivalent load-dependent model
64% This
is just
for validation - not exact equivalence
65fprintf(
'\nNote: Joint dependence allows class-specific scaling.\n');
66fprintf(
'This example uses total population scaling as a simpler illustration.\n');