LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
aoi_lcfss_gim1.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_AOI_LCFSS_GIM1_H
6#define LINE_API_AOI_LCFSS_GIM1_H
7
8/**
9 * @file
10 * @ingroup api_aoi
11 * Mean and peak Age of Information of a GI/M/1 non-preemptive LCFS queue with
12 * set-aside (LCFS-S).
13 *
14 * Templated port of matlab/src/api/aoi/aoi_lcfss_gim1.m, cross-checked against
15 * jar/src/main/java/jline/api/aoi/Aoi_lcfss_gim1.java (identical).
16 *
17 * sigma solves Y*(mu - mu sigma) = sigma in (0,1)
18 * E[D] = 1/(mu (1 - sigma))
19 * E[A] = E[Y] + 1/mu + sigma E[D]
20 * E[Apeak] = E[Y] + E[D]
21 *
22 * from Inoue et al. (2019, Section V) adapted to GI/M/1.
23 *
24 * static_assert(num_traits<T>::has_transcendental) -- sigma is a bracketed
25 * root of a transcendental equation; the rest is rational in sigma.
26 *
27 * As in aoi_lcfsd_gim1, MATLAB's sigma = rho fallback on a bracketing failure
28 * is replaced by an error. MATLAB returns an empty LST handle, reported here
29 * as has_lst = false.
30 */
31
33#include "line/num/number.h"
34#include "line/util/error.h"
35
36namespace line {
37namespace aoi {
38
39/**
40 * @brief Mean and peak Age of Information of a GI/M/1 non-preemptive LCFS
41 * queue with set-aside (LCFS-S).
42 *
43 * @param Y_lst LST of the interarrival time
44 * @param mu service rate, > 0
45 * @param E_Y mean interarrival time, > 0
46 * @return [meanAoI, peakAoI], no LST
47 */
48template <class T>
49AoiLstResult<T> aoi_lcfss_gim1(const Lst<T>& Y_lst, const T& mu, const T& E_Y) {
51 "aoi_lcfss_gim1 requires transcendental arithmetic");
52 detail::require_positive(mu, "aoi_lcfss_gim1", "the service rate mu");
53 detail::require_positive(E_Y, "aoi_lcfss_gim1", "the mean interarrival time E_Y");
54 if (!Y_lst) throw InputError("aoi_lcfss_gim1: the interarrival LST must be callable");
55 const T one = num_traits<T>::from_int(1);
56 const T lambda = one / E_Y;
57 const T rho = lambda / mu;
58 detail::require_stable(rho, "aoi_lcfss_gim1");
59
60 const T E_S = one / mu;
61 const T sigma = detail::gim1_sigma<T>(Y_lst, mu, "aoi_lcfss_gim1");
62 const T E_D = one / (mu * (one - sigma));
63 const T meanAoI = E_Y + E_S + sigma * E_D;
64 const T peakAoI = E_Y + E_D;
65 return {meanAoI, peakAoI, Lst<T>(), false};
66}
67
68} // namespace aoi
69} // namespace line
70
71#endif // LINE_API_AOI_LCFSS_GIM1_H
Shared return types and arithmetic helpers for the templated Age of Information port.
InputError(const std::string &what)
Definition error.h:39
The exception types the port throws.
AoiLstResult< T > aoi_lcfss_gim1(const Lst< T > &Y_lst, const T &mu, const T &E_Y)
Mean and peak Age of Information of a GI/M/1 non-preemptive LCFS queue with set-aside (LCFS-S).
std::function< T(const T &)> Lst
A Laplace-Stieltjes transform evaluated at real arguments.
Definition aoi_types.h:41
Number-type abstraction for the templated API port.
[meanAoI, lstAoI, peakAoI], mirroring jline.api.aoi.AoiLstResult.
Definition aoi_types.h:58