LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
mmpp2_fit.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_MAM_MMPP2_FIT_H
6
#define LINE_API_MAM_MMPP2_FIT_H
7
8
/**
9
* @file
10
* @ingroup api_mam
11
* MMPP(2) matching three moments and the lag-1 autocorrelation
12
* (matlab/lib/kpctoolbox/mmpp/mmpp2_fit.m).
13
*
14
* The reference duplicates the closed form of mmpp2_fit3 verbatim, differing
15
* only in that it converts the lag-1 autocorrelation into the decay rate
16
* first, G2 = ACFLAG1 / ((1 - 1/SCV)/2); the denominator is the lag-0
17
* autocorrelation of an MMPP(2), so ACFLAG1 is representable only in
18
* [0, (1 - 1/SCV)/2]. The port calls mmpp2_fit3 rather than repeating the
19
* expression, which keeps the two in step by construction.
20
*
21
* Gated on transcendental arithmetic through mmpp2_fit3.
22
*/
23
24
#include "
line/api/mam/map_moment.h
"
25
#include "
line/api/mam/mmpp2_fit3.h
"
26
#include "
line/num/number.h
"
27
#include "
line/util/error.h
"
28
29
namespace
line
{
30
namespace
mam
{
31
32
/** MMPP(2) with moments (E1, E2, E3) and lag-1 autocorrelation ACFLAG1. */
33
template
<
class
T>
34
Map<T>
mmpp2_fit
(
const
T& E1,
const
T& E2,
const
T& E3,
const
T& ACFLAG1) {
35
static_assert
(
num_traits<T>::has_transcendental
,
36
"mmpp2_fit requires transcendental arithmetic"
);
37
const
T one =
num_traits<T>::from_int
(1);
38
const
T two =
num_traits<T>::from_int
(2);
39
if
(E1 ==
num_traits<T>::from_int
(0))
throw
InputError
(
"mmpp2_fit: zero first moment"
);
40
const
T SCV = (E2 - E1 * E1) / (E1 * E1);
41
if
(SCV ==
num_traits<T>::from_int
(0))
throw
InputError
(
"mmpp2_fit: zero SCV"
);
42
const
T rho0 = (one - one / SCV) / two;
43
if
(rho0 ==
num_traits<T>::from_int
(0))
44
throw
InputError
(
"mmpp2_fit: unit SCV admits no autocorrelation"
);
45
return
mmpp2_fit3
(E1, E2, E3, T(ACFLAG1 / rho0));
46
}
47
48
}
// namespace mam
49
}
// namespace line
50
51
#endif
// LINE_API_MAM_MMPP2_FIT_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
error.h
The exception types the port throws.
map_moment.h
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
mmpp2_fit3.h
MMPP(2) matching three moments and the autocorrelation decay rate (matlab/lib/kpctoolbox/mmpp/mmpp2_f...
line::mam
Definition
amap2_adjust_gamma.h:78
line::mam::mmpp2_fit3
Map< T > mmpp2_fit3(const T &E1, const T &E2, const T &E3, const T &G2, const T &g2tol)
MMPP(2) with moments (E1, E2, E3) and autocorrelation decay rate G2.
Definition
mmpp2_fit3.h:51
line::mam::mmpp2_fit
Map< T > mmpp2_fit(const T &E1, const T &E2, const T &E3, const T &ACFLAG1)
MMPP(2) with moments (E1, E2, E3) and lag-1 autocorrelation ACFLAG1.
Definition
mmpp2_fit.h:34
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::mam::Map
A MAP as the pair of matrices (D0, D1).
Definition
map_moment.h:53
line::num_traits
Definition
number.h:111
include
line
api
mam
mmpp2_fit.h
Generated by
1.18.0