LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
example_lukumar_reentrant.m
1%% Lu-Kumar Unstable Re-entrant Line Example
2%
3% This script demonstrates the Lu-Kumar re-entrant line network, a classic
4% example showing that queueing networks can exhibit instability even when
5% individual station utilizations are below 100%.
6%
7% The network has 2 stations and 4 job classes:
8% - Jobs enter as Class 1, served at Station 1
9% - Switch to Class 2, served at Station 2
10% - Switch to Class 3, served at Station 2 (same station, different class)
11% - Switch to Class 4, served at Station 1 (re-entry)
12% - Exit the network
13%
14% Key insight: Under FCFS, the network is stable when utilization < 1.
15% Under certain priority policies (like giving priority to returning jobs),
16% the network can become unstable due to virtual bottleneck effects.
17%
18% Reference:
19% Lu, S.H. and Kumar, P.R. (1991), "Distributed Scheduling Based on Due
20% Dates and Buffer Priorities", IEEE Trans. Automatic Control.
21
22clear;
23fprintf('=== Lu-Kumar Re-entrant Line Example ===\n\n');
24
25%% Compare FCFS vs HOL Scheduling
26fprintf('Creating models with different scheduling strategies...\n');
27
28model_fcfs = gallery_lukumar_reentrant('FCFS');
29model_hol = gallery_lukumar_reentrant('HOL');
30model_ps = gallery_lukumar_reentrant('PS');
31
32%% Print network information
33fprintf('\nNetwork parameters:\n');
34fprintf(' Arrival rate (lambda): 0.45\n');
35fprintf(' Mean service time at Station 1 (Class 1): 1.0\n');
36fprintf(' Mean service time at Station 2 (Class 2): 1.0\n');
37fprintf(' Mean service time at Station 2 (Class 3): 1.0\n');
38fprintf(' Mean service time at Station 1 (Class 4): 1.0\n');
39fprintf(' Station 1 utilization: 0.90\n');
40fprintf(' Station 2 utilization: 0.90\n\n');
41
42%% Solve with JMT (simulation)
43fprintf('Solving with JMT simulation...\n\n');
44options = lineDefaults;
45options.seed = 23000;
46options.samples = 5e4;
47
48%% FCFS Solution
49fprintf('--- FCFS Scheduling (Stable) ---\n');
50solver_fcfs = JMT(model_fcfs, options);
51AvgTable_fcfs = solver_fcfs.getAvgTable();
52disp(AvgTable_fcfs);
53
54%% HOL Priority Solution
55fprintf('\n--- HOL Priority Scheduling ---\n');
56fprintf('Priority: Class4 > Class1 at Station1, Class2 > Class3 at Station2\n');
57fprintf('(This priority policy can lead to instability in certain parameter regimes)\n\n');
58solver_hol = JMT(model_hol, options);
59AvgTable_hol = solver_hol.getAvgTable();
60disp(AvgTable_hol);
61
62%% PS Solution (for comparison)
63fprintf('\n--- Processor Sharing (Stable) ---\n');
64solver_ps = JMT(model_ps, options);
65AvgTable_ps = solver_ps.getAvgTable();
66disp(AvgTable_ps);
67
68%% Summary
69fprintf('\n=== Summary ===\n');
70fprintf('The Lu-Kumar network demonstrates that scheduling discipline matters!\n');
71fprintf('Even with station utilizations at 90%%, different scheduling policies\n');
72fprintf('can lead to dramatically different queue lengths and response times.\n\n');
73fprintf('Key observations:\n');
74fprintf('1. FCFS is always stable when utilization < 1 in open networks\n');
75fprintf('2. PS is also stable under the same conditions\n');
76fprintf('3. Priority policies can create "virtual bottlenecks" that cause\n');
77fprintf(' queue buildup even when physical utilization is below 100%%\n');