LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
pfqn_ibjb_bounds.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_PFQN_PFQN_IBJB_BOUNDS_H
6
#define LINE_API_PFQN_PFQN_IBJB_BOUNDS_H
7
8
/**
9
* @file
10
* @ingroup api_pfqn
11
* Dallery (1987) improved balanced job bounds for single-class closed
12
* networks of single-server stations and a delay station.
13
*
14
* Templated port of matlab/src/api/pfqn/pfqn_ibjb_bounds.m (native Python
15
* twin: python/line_solver/api/pfqn/throughput_bounds.py). Y. Dallery, "An
16
* Improved Balanced Job Bound Analysis of Closed Queueing Networks", Oper.
17
* Res. Lett. 6(2) (1987) 77-82. With R0 = sum L, Lb = max L,
18
* Lc = sum L.^2/R0 and Ld = sum L.^2/(R0+Z):
19
*
20
* Theorem 1 (Z = 0) N/(R0+(N-1)Lb) <= X(N) <= N/(R0+(N-1)Lc)
21
* Theorem 2 (Z > 0) N/(R0+Z+(N-1)Lb) <= X(N)
22
* <= min(N/(R0+Z+(N-1)Ld), N/(R0+(N-1)Lc))
23
*
24
* The upper side is also capped by the bottleneck 1/Lb, the ABA bound the
25
* paper pairs it with (Sec. 3), since the tight upper BJB tends to
26
* 1/Lc >= 1/Lb.
27
*
28
* ARITHMETIC: field operations and comparisons only. Exact under Rational.
29
*/
30
31
#include <cstddef>
32
#include <vector>
33
34
#include "
line/num/number.h
"
35
#include "
line/util/error.h
"
36
37
namespace
line
{
38
namespace
pfqn
{
39
40
/** Return value of pfqn_ibjb_bounds, mirroring [Xlo, Xhi]. */
41
template
<
class
T>
42
struct
IbjbBounds
{
43
T
Xlo
;
44
T
Xhi
;
45
};
46
47
/**
48
* @brief Dallery (1987) improved balanced job bounds.
49
*
50
* @param L (M) loadings of the single-server stations; zeros are dropped
51
* @param N population, at least 1
52
* @param Z total loading of the delay station
53
*/
54
template
<
class
T>
55
IbjbBounds<T>
pfqn_ibjb_bounds
(
const
std::vector<T>& Lin,
int
N,
const
T& Z) {
56
const
T zero =
num_traits<T>::from_int
(0), one =
num_traits<T>::from_int
(1);
57
std::vector<T> L;
58
for
(
const
T& x :
Lin
)
59
if
(x > zero) L.push_back(x);
60
if
(L.empty())
61
throw
InputError
(
ErrorKind
{
"Invalid"
},
62
"pfqn_ibjb_bounds needs at least one station with positive loading."
);
63
if
(N < 1)
throw
InputError
(
ErrorKind
{
"Invalid"
},
"pfqn_ibjb_bounds needs N >= 1."
);
64
const
T NT =
num_traits<T>::from_int
(N), N1 =
num_traits<T>::from_int
(N - 1);
65
T R0 = zero, Lb = L[0], S2 = zero;
66
for
(
const
T& x : L) {
67
R0 += x;
68
S2 += x * x;
69
if
(x > Lb) Lb = x;
70
}
71
const
T
Lc
= T(S2 / R0);
72
IbjbBounds<T>
out;
73
out.
Xlo
= T(NT / T(R0 + Z + N1 * Lb));
74
out.
Xhi
= T(NT / T(R0 + N1 *
Lc
));
75
if
(Z > zero) {
76
const
T Ld = T(S2 / T(R0 + Z));
77
const
T x2 = T(NT / T(R0 + Z + N1 * Ld));
78
if
(x2 < out.
Xhi
) out.
Xhi
= x2;
79
}
80
const
T cap = T(one / Lb);
81
if
(cap < out.
Xhi
) out.
Xhi
= cap;
82
return
out;
83
}
84
85
}
// namespace pfqn
86
}
// namespace line
87
88
#endif
// LINE_API_PFQN_PFQN_IBJB_BOUNDS_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:105
error.h
The exception types the port throws.
line::pfqn
Definition
cd_peak_scaling.h:43
line::pfqn::LinearizerMxMethod::Lin
@ Lin
Definition
pfqn_linearizermx.h:87
line::pfqn::NcMethod::Lc
@ Lc
Birman-Kogan Algorithm 2, single chain subproblems by MVA.
Definition
pfqn_nc.h:117
line::pfqn::pfqn_ibjb_bounds
IbjbBounds< T > pfqn_ibjb_bounds(const std::vector< T > &Lin, int N, const T &Z)
Dallery (1987) improved balanced job bounds.
Definition
pfqn_ibjb_bounds.h:55
line
Conservation laws of a layered queueing network, enumerated from its structure.
Definition
aoi_dist2ph.h:51
number.h
Number-type abstraction for the templated API port.
line::ErrorKind
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Definition
error.h:37
line::num_traits
Definition
number.h:123
line::pfqn::IbjbBounds
Return value of pfqn_ibjb_bounds, mirroring [Xlo, Xhi].
Definition
pfqn_ibjb_bounds.h:42
line::pfqn::IbjbBounds::Xhi
T Xhi
Definition
pfqn_ibjb_bounds.h:44
line::pfqn::IbjbBounds::Xlo
T Xlo
Definition
pfqn_ibjb_bounds.h:43
include
line
api
pfqn
pfqn_ibjb_bounds.h
Generated by
1.18.0