LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
aoi_lcfspr_dm1.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_DM1_H
6
#define LINE_API_AOI_LCFSPR_DM1_H
7
8
/**
9
* @file
10
* @ingroup api_aoi
11
* Mean, variance and peak Age of Information of a D/M/1 preemptive LCFS queue.
12
*
13
* Templated port of matlab/src/api/aoi/aoi_lcfspr_dm1.m, cross-checked against
14
* jar/src/main/java/jline/api/aoi/Aoi_lcfspr_dm1.java (identical).
15
*
16
* E[A] = tau + 1/mu
17
* q = P(S < tau) = 1 - exp(-mu tau)
18
* E[S|succ]= (1/mu - tau exp(-mu tau) - exp(-mu tau)/mu) / q
19
* E[Apeak] = E[S|succ] + tau/q
20
* Var[A] = 1/mu^2 (the interarrival time is constant)
21
*
22
* from Inoue et al. (2019, Section IV).
23
*
24
* static_assert(num_traits<T>::has_transcendental) -- the exponentials in the
25
* success probability and the conditional service time.
26
*/
27
28
#include "
line/api/aoi/aoi_types.h
"
29
#include "
line/num/number.h
"
30
31
namespace
line
{
32
namespace
aoi
{
33
34
/**
35
* @brief Mean, variance and peak Age of Information of a D/M/1 preemptive
36
* LCFS queue.
37
*
38
* @param tau deterministic interarrival time, > 0
39
* @param mu service rate, > 0
40
* @return [meanAoI, varAoI, peakAoI]
41
*/
42
template
<
class
T>
43
AoiResult<T>
aoi_lcfspr_dm1
(
const
T& tau,
const
T& mu) {
44
static_assert
(
num_traits<T>::has_transcendental
,
45
"aoi_lcfspr_dm1 requires transcendental arithmetic"
);
46
detail::require_positive(tau,
"aoi_lcfspr_dm1"
,
"the interarrival time tau"
);
47
detail::require_positive(mu,
"aoi_lcfspr_dm1"
,
"the service rate mu"
);
48
const
T one =
num_traits<T>::from_int
(1);
49
const
T lambda = one / tau;
50
const
T rho = lambda / mu;
51
detail::require_stable(rho,
"aoi_lcfspr_dm1"
);
52
53
const
T meanAoI = tau + one / mu;
54
const
T e = detail::num_exp(T(-mu * tau));
55
const
T q = one - e;
56
const
T ES_succ = (one / mu - tau * e - e / mu) / q;
57
const
T peakAoI = ES_succ + tau / q;
58
const
T varAoI = one / (mu * mu);
59
return
{meanAoI, varAoI, peakAoI};
60
}
61
62
}
// namespace aoi
63
}
// namespace line
64
65
#endif
// LINE_API_AOI_LCFSPR_DM1_H
aoi_types.h
Shared return types and arithmetic helpers for the templated Age of Information port.
line::aoi
Definition
aoi_dist2ph.h:53
line::aoi::aoi_lcfspr_dm1
AoiResult< T > aoi_lcfspr_dm1(const T &tau, const T &mu)
Mean, variance and peak Age of Information of a D/M/1 preemptive LCFS queue.
Definition
aoi_lcfspr_dm1.h:43
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::aoi::AoiResult
[meanAoI, varAoI, peakAoI], mirroring jline.api.aoi.AoiResult.
Definition
aoi_types.h:45
line::num_traits
Definition
number.h:111
include
line
api
aoi
aoi_lcfspr_dm1.h
Generated by
1.18.0