LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
aoi_lcfsd_mgi1.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_LCFSD_MGI1_H
6
#define LINE_API_AOI_LCFSD_MGI1_H
7
8
/**
9
* @file
10
* @ingroup api_aoi
11
* Mean and peak Age of Information of an M/GI/1 non-preemptive LCFS queue with
12
* discarding (LCFS-D, equivalently M/GI/1/2*).
13
*
14
* Templated port of matlab/src/api/aoi/aoi_lcfsd_mgi1.m, cross-checked against
15
* jar/src/main/java/jline/api/aoi/Aoi_lcfsd_mgi1.java (identical).
16
*
17
* E[H_res] = E[H^2] / (2 E[H]) (residual service time)
18
* E[T_eff] = E[H] + rho E[H_res]
19
* E[A] = 1/lambda + E[H] + rho E[H^2]/(2 E[H]) + rho E[H]/(1+rho)
20
* E[Apeak] = 1/lambda + E[T_eff]
21
*
22
* from Inoue et al. (2019, Section VI).
23
*
24
* As with LCFS-S, the service-time LST is not used: only the first two moments
25
* enter, so the port takes them directly. Rational throughout, hence exact in
26
* the field. MATLAB returns an empty LST handle, reported here as
27
* has_lst = false.
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 and peak Age of Information of an M/GI/1 non-preemptive LCFS
39
* queue with discarding (LCFS-D, equivalently M/GI/1/2*).
40
*
41
* @param lambda arrival rate, > 0
42
* @param E_H mean service time, > 0
43
* @param E_H2 second raw moment of the service time, >= E_H^2
44
* @return [meanAoI, peakAoI], no LST
45
*/
46
template
<
class
T>
47
AoiLstResult<T>
aoi_lcfsd_mgi1
(
const
T& lambda,
const
T& E_H,
const
T& E_H2) {
48
detail::require_positive(lambda,
"aoi_lcfsd_mgi1"
,
"the arrival rate lambda"
);
49
detail::require_positive(E_H,
"aoi_lcfsd_mgi1"
,
"the mean service time E_H"
);
50
if
(E_H2 < E_H * E_H)
throw
InputError
(
"aoi_lcfsd_mgi1: E_H2 must be at least E_H^2"
);
51
const
T one =
num_traits<T>::from_int
(1), two =
num_traits<T>::from_int
(2);
52
const
T rho = lambda * E_H;
53
detail::require_stable(rho,
"aoi_lcfsd_mgi1"
);
54
55
const
T E_Y = one / lambda;
56
const
T E_H_res = E_H2 / (two * E_H);
57
const
T E_T_eff = E_H + rho * E_H_res;
58
59
const
T meanAoI = E_Y + E_H + rho * E_H2 / (two * E_H) + rho * E_H / (one + rho);
60
const
T peakAoI = E_Y + E_T_eff;
61
return
{meanAoI, peakAoI,
Lst<T>
(),
false
};
62
}
63
64
}
// namespace aoi
65
}
// namespace line
66
67
#endif
// LINE_API_AOI_LCFSD_MGI1_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
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_lcfsd_mgi1
AoiLstResult< T > aoi_lcfsd_mgi1(const T &lambda, const T &E_H, const T &E_H2)
Mean and peak Age of Information of an M/GI/1 non-preemptive LCFS queue with discarding (LCFS-D,...
Definition
aoi_lcfsd_mgi1.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_lcfsd_mgi1.h
Generated by
1.18.0