LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
fj_respt_2way.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_FJ_RESPT_2WAY_H
6
#define LINE_API_FJ_RESPT_2WAY_H
7
8
/**
9
* @file
10
* @ingroup api_fj
11
* Exact mean response time of a 2-way fork-join system of M/M/1 branches.
12
*
13
* Templated port of matlab/src/api/fj/fj_respt_2way.m, cross-checked against
14
* FJ_respt.fj_respt_2way in jar/src/main/java/jline/api/fj/FJ_respt.java
15
* (identical; the JAR inlines qsys_mm1 as 1/(mu-lambda), which is the same
16
* value MATLAB's qsys_mm1 returns).
17
*
18
* R_2 = (H_2 - rho/8) R(rho) = ((12 - rho)/8) / (mu - lambda)
19
*
20
* Rational in rho, hence exact in the field. This is the only fork-join
21
* response time in the family that is exact rather than an approximation, so
22
* it is the natural calibration point for the approximations around it.
23
*/
24
25
#include "
line/api/fj/fj_types.h
"
26
#include "
line/api/qsys/qsys_mm1.h
"
27
#include "
line/num/number.h
"
28
#include "
line/util/error.h
"
29
30
namespace
line
{
31
namespace
fj
{
32
33
/**
34
* @brief Exact mean response time of a 2-way fork-join system of M/M/1
35
* branches.
36
*
37
* @param lambda arrival rate
38
* @param mu per-branch service rate
39
* @return mean 2-way fork-join response time
40
*/
41
template
<
class
T>
42
T
fj_respt_2way
(
const
T& lambda,
const
T& mu) {
43
const
T one =
num_traits<T>::from_int
(1);
44
const
T rho = lambda / mu;
45
if
(rho >= one)
throw
NumericError
(
"fj_respt_2way: unstable system, rho = lambda/mu >= 1"
);
46
const
T R_rho =
qsys::qsys_mm1
(lambda, mu).W;
47
return
(
num_traits<T>::from_int
(12) - rho) /
num_traits<T>::from_int
(8) * R_rho;
48
}
49
50
}
// namespace fj
51
}
// namespace line
52
53
#endif
// LINE_API_FJ_RESPT_2WAY_H
line::NumericError::NumericError
NumericError(const std::string &what)
Definition
error.h:45
error.h
The exception types the port throws.
fj_types.h
Shared return types and arithmetic helpers for the templated fork-join port.
line::fj
Definition
fj_amva.h:34
line::fj::fj_respt_2way
T fj_respt_2way(const T &lambda, const T &mu)
Exact mean response time of a 2-way fork-join system of M/M/1 branches.
Definition
fj_respt_2way.h:42
line::qsys::qsys_mm1
QsysResult< T > qsys_mm1(const T &lambda, const T &mu)
Exact mean response time of the M/M/1 queue.
Definition
qsys_mm1.h:35
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
qsys_mm1.h
Exact mean response time of the M/M/1 queue.
line::num_traits
Definition
number.h:111
include
line
api
fj
fj_respt_2way.h
Generated by
1.18.0