LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
snc_mean_backlog.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_SNC_MEAN_BACKLOG_H
6
#define LINE_API_SNC_MEAN_BACKLOG_H
7
8
/**
9
* @file
10
* @ingroup api_snc
11
* Upper bound on the mean backlog, from integrating the backlog tail bound.
12
*
13
* The counterpart of `snc_mean_delay` with `a = theta`: the clipped integral of
14
* `K*exp(-theta*b)` is `(log(K)+1)/theta` when K >= 1 and `K/theta` otherwise.
15
* The unit of the answer is the unit of the envelopes: jobs when the pair is
16
* `snc_env_poisson` with `snc_srv_exp`, units of work when it is
17
* `snc_env_cpoisson` with `snc_srv_rate`.
18
*
19
* SolverBA does NOT use this for its queue-length column: it applies Little's
20
* law to the response-time bound instead, so that Q and R stay consistent with
21
* the exact open-network throughput. The two are close but not identical, since
22
* each optimizes its own theta.
23
*
24
* Port of matlab/src/api/snc/snc_mean_backlog.m.
25
*/
26
27
#include <cmath>
28
29
#include "
line/api/snc/snc_thetaopt.h
"
30
#include "
line/api/snc/snc_types.h
"
31
#include "
line/util/error.h
"
32
33
namespace
line
{
34
namespace
snc
{
35
36
/**
37
* @brief Upper bound on the mean backlog, from integrating the backlog tail
38
* bound.
39
*
40
* @param arv arrival envelope
41
* @param srv service envelope
42
* @param thetamax upper end of the theta search
43
*/
44
inline
SncResult
snc_mean_backlog
(
const
Envelope
& arv,
const
Envelope
& srv,
double
thetamax = 1e3) {
45
return
snc_thetaopt
(
46
[&](
double
theta) {
47
const
detail::SncPair p = detail::snc_pair(arv, srv, theta);
48
if
(!p.ok)
return
std::numeric_limits<double>::infinity();
49
const
double
logK = theta * (p.a.sigma + p.s.sigma) -
50
std::log(1.0 - std::exp(-theta * (p.s.rho - p.a.rho)));
51
return
logK >= 0.0 ? (logK + 1.0) / theta : std::exp(logK) / theta;
52
},
53
thetamax);
54
}
55
56
}
// namespace snc
57
}
// namespace line
58
59
#endif
// LINE_API_SNC_MEAN_BACKLOG_H
error.h
The exception types the port throws.
line::snc
Definition
snc_bound_backlog.h:34
line::snc::Envelope
std::function< Env(double)> Envelope
An envelope as a function of the Chernoff parameter.
Definition
snc_types.h:48
line::snc::snc_thetaopt
SncResult snc_thetaopt(const std::function< double(double)> &fun, double thetamax=1e3)
Minimizes a Chernoff bound over the free parameter theta.
Definition
snc_thetaopt.h:66
line::snc::snc_mean_backlog
SncResult snc_mean_backlog(const Envelope &arv, const Envelope &srv, double thetamax=1e3)
Upper bound on the mean backlog, from integrating the backlog tail bound.
Definition
snc_mean_backlog.h:44
line
Definition
aoi_dist2ph.h:52
snc_thetaopt.h
Minimizes a Chernoff bound over the free parameter theta.
snc_types.h
Shared types of the stochastic network calculus domain.
line::snc::SncResult
A bound together with the theta that attains it.
Definition
snc_types.h:51
include
line
api
snc
snc_mean_backlog.h
Generated by
1.18.0