LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
aoi_lcfsd_mgi1.m
1function [meanAoI, lstAoI, peakAoI] = aoi_lcfsd_mgi1(lambda, H_lst, E_H, E_H2)
2%AOI_LCFSD_MGI1 Mean AoI for M/GI/1 non-preemptive LCFS-D queue
3%
4% [meanAoI, lstAoI, peakAoI] = aoi_lcfsd_mgi1(lambda, H_lst, E_H, E_H2)
5%
6% Computes the Age of Information metrics for an M/GI/1 queue with
7% non-preemptive Last-Come First-Served with Discarding (LCFS-D) discipline.
8%
9% In LCFS-D, when a new update arrives while the server is busy:
10% - If there's an update waiting in queue, it is discarded
11% - The new update takes its place in the queue
12% - When service completes, the waiting update (if any) is served
13%
14% This is also known as M/GI/1/2* (buffer size 2 with replacement).
15%
16% Parameters:
17% lambda (double): Arrival rate (Poisson arrivals)
18% H_lst (function_handle): LST of service time, @(s) -> complex
19% E_H (double): Mean service time (first moment)
20% E_H2 (double): Second moment of service time
21%
22% Returns:
23% meanAoI (double): Mean (average) Age of Information
24% lstAoI (function_handle): LST of AoI distribution (empty if not computed)
25% peakAoI (double): Mean Peak Age of Information
26%
27% Formulas (from Inoue et al., IEEE Trans. IT, 2019, Section VI):
28% The analysis uses the concept of effective service time which includes
29% potential waiting while another update is being served.
30%
31% Reference:
32% Y. Inoue, H. Masuyama, T. Takine, T. Tanaka, "A General Formula for
33% the Stationary Distribution of the Age of Information and Its
34% Application to Single-Server Queues," IEEE Trans. Information Theory,
35% vol. 65, no. 12, pp. 8305-8324, 2019.
36%
37% See also: aoi_lcfss_mgi1, aoi_fcfs_mgi1, aoi_lcfspr_mgi1
38
39% Copyright (c) 2012-2026, Imperial College London
40% All rights reserved.
41
42% Validate inputs
43if lambda <= 0
44 line_error(mfilename, 'Arrival rate lambda must be positive');
45end
46if E_H <= 0
47 line_error(mfilename, 'Mean service time E_H must be positive');
48end
49if E_H2 < E_H^2
50 line_error(mfilename, 'Second moment E_H2 must be >= E_H^2');
51end
52
53% Compute utilization
54rho = lambda * E_H;
55
56% Check stability
57if rho >= 1
58 line_error(mfilename, 'System unstable: rho = lambda*E_H = %.4f >= 1', rho);
59end
60
61% Mean interarrival time
62E_Y = 1 / lambda;
63
64% For LCFS-D (also known as M/GI/1/2*), the analysis from Section VI:
65%
66% The effective service time S_eff includes potential residual service
67% of the update being served when the successful update arrived.
68%
69% Key quantity: probability p0 that arriving update finds server idle
70% p0 = 1 - rho (for Poisson arrivals)
71%
72% Mean effective system time:
73% E[T_eff] = E[H] + (1 - p0) * E[H_residual]
74% = E[H] + rho * E[H^2] / (2 * E[H])
75
76E_H_residual = E_H2 / (2 * E_H); % Residual service time
77E_T_eff = E_H + rho * E_H_residual;
78
79% Mean AoI for LCFS-D (Proposition 6, simplified form)
80% E[A] = E[Y] + E[T_eff] + additional term for discarded updates
81%
82% The additional term accounts for the age accumulated while waiting:
83% Additional = rho * (E[H_residual] + E[H]) / (1 + rho)
84%
85% Simplified approximation:
86meanAoI = E_Y + E_H + rho * E_H2 / (2 * E_H) + rho * E_H / (1 + rho);
87
88% Mean Peak AoI
89% Peak AoI is the system time plus interarrival time
90peakAoI = E_Y + E_T_eff;
91
92% LST is complex for LCFS-D; return empty handle
93lstAoI = [];
94
95end