LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
aoi_lcfspr_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_LCFSPR_GIM1_H
6
#define LINE_API_AOI_LCFSPR_GIM1_H
7
8
/**
9
* @file
10
* @ingroup api_aoi
11
* Mean Age of Information, its transform and the peak age of a GI/M/1
12
* preemptive LCFS queue.
13
*
14
* Templated port of matlab/src/api/aoi/aoi_lcfspr_gim1.m, cross-checked
15
* against jar/src/main/java/jline/api/aoi/Aoi_lcfspr_gim1.java (identical).
16
*
17
* E[A] = E[Y] + 1/mu
18
* q = P(S < Y) = 1 - Y*(mu)
19
* E[S|succ] = (1/mu + Y*'(mu) - Y*(mu)/mu) / q
20
* E[Apeak] = E[S|succ] + 1/(lambda q)
21
* A*(s) = Y*(s) mu/(s + mu)
22
*
23
* from Inoue et al. (2019, Section IV).
24
*
25
* static_assert(num_traits<T>::has_transcendental) -- MATLAB's
26
* finite-difference derivative of Y* at mu. The mean is rational in E_Y and mu
27
* and is exact; the transform is exact wherever Y* is.
28
*/
29
30
#include "
line/api/aoi/aoi_types.h
"
31
#include "
line/num/number.h
"
32
#include "
line/util/error.h
"
33
34
namespace
line
{
35
namespace
aoi
{
36
37
/**
38
* @brief Mean Age of Information, its transform and the peak age of a GI/M/1
39
* preemptive LCFS queue.
40
*
41
* @param Y_lst LST of the interarrival time
42
* @param mu service rate, > 0
43
* @param E_Y mean interarrival time, > 0
44
* @return [meanAoI, peakAoI, A*(s)]
45
*/
46
template
<
class
T>
47
AoiLstResult<T>
aoi_lcfspr_gim1
(
const
Lst<T>
& Y_lst,
const
T& mu,
const
T& E_Y) {
48
static_assert
(
num_traits<T>::has_transcendental
,
49
"aoi_lcfspr_gim1 requires transcendental arithmetic"
);
50
detail::require_positive(mu,
"aoi_lcfspr_gim1"
,
"the service rate mu"
);
51
detail::require_positive(E_Y,
"aoi_lcfspr_gim1"
,
"the mean interarrival time E_Y"
);
52
if
(!Y_lst)
throw
InputError
(
"aoi_lcfspr_gim1: the interarrival LST must be callable"
);
53
const
T one =
num_traits<T>::from_int
(1);
54
const
T lambda = one / E_Y;
55
const
T rho = lambda / mu;
56
detail::require_stable(rho,
"aoi_lcfspr_gim1"
);
57
58
const
T meanAoI = E_Y + one / mu;
59
const
T dYstar = detail::lst_derivative<T>(Y_lst, mu);
60
const
T q = one - Y_lst(mu);
61
if
(q ==
num_traits<T>::from_int
(0))
62
throw
NumericError
(
"aoi_lcfspr_gim1: Y*(mu) = 1, no update ever completes"
);
63
const
T ES_succ = (one / mu + dYstar - Y_lst(mu) / mu) / q;
64
const
T peakAoI = ES_succ + one / (lambda * q);
65
66
Lst<T>
lstAoI = [Y_lst, mu](
const
T& s) {
return
T(Y_lst(s) * (mu / (s + mu))); };
67
return
{meanAoI, peakAoI, lstAoI,
true
};
68
}
69
70
}
// namespace aoi
71
}
// namespace line
72
73
#endif
// LINE_API_AOI_LCFSPR_GIM1_H
aoi_types.h
Shared return types and arithmetic helpers for the templated Age of Information port.
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
line::NumericError::NumericError
NumericError(const std::string &what)
Definition
error.h:45
error.h
The exception types the port throws.
line::aoi
Definition
aoi_dist2ph.h:53
line::aoi::Lst
std::function< T(const T &)> Lst
A Laplace-Stieltjes transform evaluated at real arguments.
Definition
aoi_types.h:41
line::aoi::aoi_lcfspr_gim1
AoiLstResult< T > aoi_lcfspr_gim1(const Lst< T > &Y_lst, const T &mu, const T &E_Y)
Mean Age of Information, its transform and the peak age of a GI/M/1 preemptive LCFS queue.
Definition
aoi_lcfspr_gim1.h:47
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::aoi::AoiLstResult
[meanAoI, lstAoI, peakAoI], mirroring jline.api.aoi.AoiLstResult.
Definition
aoi_types.h:58
line::num_traits
Definition
number.h:111
include
line
api
aoi
aoi_lcfspr_gim1.h
Generated by
1.18.0