LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
sn_has_bursty_arrival.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_SN_SN_HAS_BURSTY_ARRIVAL_H
6
#define LINE_API_SN_SN_HAS_BURSTY_ARRIVAL_H
7
8
/**
9
* @file
10
* @ingroup api_sn
11
* Port of matlab/src/api/sn/sn_has_bursty_arrival.m.
12
*
13
* True iff some external (Source) arrival process is non-renewal (bursty). A MAP
14
* (D0, D1) is renewal iff D1 equals its rank-one renewal form t0*pie, with
15
* t0 = -D0 e = D1 e and pie the embedded stationary vector; any departure from
16
* that form signals correlation between successive inter-arrival times. A
17
* single-phase arrival (Poisson) is renewal by construction. This is the exact
18
* test SolverMVA.resolveMethod uses to upgrade method='default' to 'rqna'.
19
*
20
* ARITHMETIC: field. map_pie is a linear solve; no transcendental appears.
21
*/
22
23
#include <cmath>
24
#include <cstddef>
25
26
#include "
line/api/mam/map_moment.h
"
27
#include "
line/lang/distribution.h
"
28
#include "
line/lang/qn/network_struct.h
"
29
#include "
line/num/number.h
"
30
31
namespace
line
{
32
namespace
api
{
33
34
template
<
class
T>
35
bool
sn_has_bursty_arrival
(
const
qn::NetworkStruct<T>
&
sn
) {
36
for
(std::size_t i = 0; i <
sn
.nstations; ++i) {
37
if
(
sn
.stations[i].nodetype != qn::NodeType::Source)
continue
;
38
for
(std::size_t r = 0; r <
sn
.nclasses; ++r) {
39
if
(!
sn
.disabled.empty() &&
sn
.disabled[i][r])
continue
;
40
const
lang::Distrib<T>
& d =
sn
.service[i][r];
41
if
(d.
disabled
|| !d.
has_map
())
continue
;
42
// Read the (D0, D1) pair directly rather than via dist_to_map: a
43
// non-MAP arrival is renewal (skipped above), and dist_to_map's
44
// Replayer branch instantiates the transcendental aph_fit, which
45
// would forbid this field-arithmetic predicate under Rational.
46
mam::Map<T>
m;
47
m.
D0
= d.
D0
;
48
m.
D1
= d.
D1
;
49
const
std::size_t n = m.
D1
.rows();
50
if
(n <= 1)
continue
;
// single-phase arrival is Poisson, hence renewal
51
const
std::vector<T> pie =
mam::map_pie
(m);
52
// t0 = D1 e (row sums of D1), renewal form D1ren = t0 * pie.
53
std::vector<T> t0(n,
num_traits<T>::from_int
(0));
54
for
(std::size_t a = 0; a < n; ++a) {
55
T acc =
num_traits<T>::from_int
(0);
56
for
(std::size_t b = 0; b < n; ++b) acc = T(acc + m.
D1
(a, b));
57
t0[a] = acc;
58
}
59
double
diff2 = 0.0, norm2 = 0.0;
60
for
(std::size_t a = 0; a < n; ++a)
61
for
(std::size_t b = 0; b < n; ++b) {
62
const
double
dd =
num_traits<T>::to_double
(m.
D1
(a, b));
63
const
double
rr =
num_traits<T>::to_double
(T(t0[a] * pie[b]));
64
diff2 += (dd - rr) * (dd - rr);
65
norm2 += dd * dd;
66
}
67
if
(std::sqrt(diff2) > 1e-8 * std::max(1.0, std::sqrt(norm2)))
return
true
;
68
}
69
}
70
return
false
;
71
}
72
73
}
// namespace api
74
}
// namespace line
75
76
#endif
// LINE_API_SN_SN_HAS_BURSTY_ARRIVAL_H
line::qn::NetworkStruct
A network plus its refreshed NetworkStruct.
Definition
network_struct.h:838
distribution.h
What refreshProcessRepresentations and refreshLST compute FROM a distribution: the (D0,...
map_moment.h
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
line::api
Definition
infer_fmlps.h:69
line::api::sn_has_bursty_arrival
bool sn_has_bursty_arrival(const qn::NetworkStruct< T > &sn)
Definition
sn_has_bursty_arrival.h:35
line::mam::map_pie
std::vector< T > map_pie(const Map< T > &m)
Phase distribution seen by an arriving job, pie = pi D1 / (pi D1 e).
Definition
map_moment.h:89
line::sn
Definition
sn_gd_balance.h:42
line
Definition
aoi_dist2ph.h:52
network_struct.h
A queueing network and its refreshed NetworkStruct.
number.h
Number-type abstraction for the templated API port.
line::lang::Distrib
Definition
lang_types.h:716
line::lang::Distrib::has_map
bool has_map() const
True when the type carries a (D0,D1) pair of its own.
Definition
lang_types.h:1587
line::lang::Distrib::D0
Matrix< T > D0
The (D0,D1) pair when the type carries one directly.
Definition
lang_types.h:759
line::lang::Distrib::disabled
bool disabled
Definition
lang_types.h:732
line::lang::Distrib::D1
Matrix< T > D1
Definition
lang_types.h:759
line::mam::Map
A MAP as the pair of matrices (D0, D1).
Definition
map_moment.h:53
line::mam::Map::D1
Matrix< T > D1
Definition
map_moment.h:55
line::mam::Map::D0
Matrix< T > D0
Definition
map_moment.h:54
line::num_traits
Definition
number.h:111
include
line
api
sn
sn_has_bursty_arrival.h
Generated by
1.18.0