LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
fj_respt_closed.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_CLOSED_H
6
#define LINE_API_FJ_RESPT_CLOSED_H
7
8
/**
9
* @file
10
* @ingroup api_fj
11
* Varki bound on the residence time of a closed fork-join subnetwork.
12
*
13
* Templated port of matlab/src/api/fj/fj_respt_closed.m.
14
*
15
* R_{P_K}(M) <= x [ H_K + A ]
16
*
17
* with A the mean number of jobs an arriving job finds at the subnetwork. In a
18
* closed network made of the parallel subsystem alone every other job is
19
* necessarily inside it, so A = M-1 and the bound is tight at K = 2.
20
*/
21
22
#include "
line/api/fj/fj_harmonic.h
"
23
#include "
line/api/fj/fj_types.h
"
24
#include "
line/num/number.h
"
25
#include "
line/util/error.h
"
26
27
namespace
line
{
28
namespace
fj
{
29
30
/** [R, exact] of fj_respt_closed. */
31
template
<
class
T>
32
struct
FJResptClosedResult
{
33
T
R
;
34
bool
exact
;
35
};
36
37
/**
38
* @brief Varki bound on the residence time of a closed fork-join subnetwork.
39
*
40
* @param K number of parallel branches, K >= 1
41
* @param x mean service time of each branch
42
* @param M number of circulating jobs, M >= 1
43
* @param A mean queue length seen on arrival
44
* @return the bound and whether it is known to be tight
45
*/
46
template
<
class
T>
47
FJResptClosedResult<T>
fj_respt_closed
(
unsigned
K,
const
T& x,
unsigned
M,
const
T& A) {
48
detail::require_positive_K(K,
"fj_respt_closed"
);
49
const
T zero =
num_traits<T>::from_int
(0);
50
if
(!(x > zero))
throw
InputError
(
"fj_respt_closed: the mean service time must be positive"
);
51
if
(M < 1)
throw
InputError
(
"fj_respt_closed: M must be a positive integer"
);
52
if
(A < zero)
53
throw
InputError
(
"fj_respt_closed: the arrival-instant queue length must be non-negative"
);
54
FJResptClosedResult<T>
out;
55
out.
R
= x * (
fj_harmonic<T>
(K) + A);
56
out.
exact
=
false
;
57
return
out;
58
}
59
60
/**
61
* The isolated parallel subsystem of Theorem 4.1, where A = M-1.
62
*
63
* @param K number of parallel branches, K >= 1
64
* @param x mean service time of each branch
65
* @param M number of circulating jobs, M >= 1
66
* @return the bound, flagged exact at K = 2
67
*/
68
template
<
class
T>
69
FJResptClosedResult<T>
fj_respt_closed
(
unsigned
K,
const
T& x,
unsigned
M) {
70
if
(M < 1)
throw
InputError
(
"fj_respt_closed: M must be a positive integer"
);
71
FJResptClosedResult<T>
out =
72
fj_respt_closed<T>
(K, x, M,
num_traits<T>::from_int
(
static_cast<
long
>
(M) - 1));
73
out.
exact
= (K == 2);
74
return
out;
75
}
76
77
}
// namespace fj
78
}
// namespace line
79
80
#endif
// LINE_API_FJ_RESPT_CLOSED_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
error.h
The exception types the port throws.
fj_harmonic.h
Harmonic number H_K = sum_{k=1..K} 1/k.
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_closed
FJResptClosedResult< T > fj_respt_closed(unsigned K, const T &x, unsigned M, const T &A)
Varki bound on the residence time of a closed fork-join subnetwork.
Definition
fj_respt_closed.h:47
line::fj::fj_harmonic
T fj_harmonic(unsigned K)
Harmonic number H_K = sum_{k=1..K} 1/k.
Definition
fj_harmonic.h:37
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::fj::FJResptClosedResult
[R, exact] of fj_respt_closed.
Definition
fj_respt_closed.h:32
line::fj::FJResptClosedResult::R
T R
Definition
fj_respt_closed.h:33
line::fj::FJResptClosedResult::exact
bool exact
Definition
fj_respt_closed.h:34
line::num_traits
Definition
number.h:111
include
line
api
fj
fj_respt_closed.h
Generated by
1.18.0