LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
snc_mean_delay.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_DELAY_H
6
#define LINE_API_SNC_MEAN_DELAY_H
7
8
/**
9
* @file
10
* @ingroup api_snc
11
* Upper bound on the mean delay, from integrating the delay tail bound.
12
*
13
* For a nonnegative delay `E[D] = int_0^inf P{D>d} dd`, so integrating the tail
14
* bound of `snc_bound_delay` bounds the MEAN. At fixed theta the bound is
15
* `K*exp(-a*d)` with `a = theta*rhoS` and
16
* `K = exp(theta*(sigmaA+sigmaS))/(1-exp(-theta*(rhoS-rhoA)))`, so, clipping the
17
* bound at 1 where it exceeds it, the integral is available in CLOSED FORM:
18
* `(log(K)+1)/a` when K >= 1 and `K/a` otherwise. No quadrature is involved, so
19
* the result is a bound and not a bound plus a discretization error.
20
*
21
* IT IS A LOOSE MEAN BOUND AND THAT IS INHERENT: on the M/M/1 read in job units
22
* it returns 2.4x the exact 1/(mu-lambda) at rho = 0.1 and 10.4x at rho = 0.95,
23
* because the prefactor of the tail bound, not its decay rate, dominates an
24
* integral over the whole axis. Use `snc_perc_delay` when the quantile is what
25
* matters.
26
*
27
* Port of matlab/src/api/snc/snc_mean_delay.m. This is what the SolverBA
28
* `snc.upper` response-time column calls.
29
*/
30
31
#include <cmath>
32
33
#include "
line/api/snc/snc_thetaopt.h
"
34
#include "
line/api/snc/snc_types.h
"
35
#include "
line/util/error.h
"
36
37
namespace
line
{
38
namespace
snc
{
39
40
/**
41
* @brief Upper bound on the mean delay, from integrating the delay tail
42
* bound.
43
*
44
* @param arv arrival envelope
45
* @param srv service envelope
46
* @param thetamax upper end of the theta search
47
*/
48
inline
SncResult
snc_mean_delay
(
const
Envelope
& arv,
const
Envelope
& srv,
double
thetamax = 1e3) {
49
return
snc_thetaopt
(
50
[&](
double
theta) {
51
const
detail::SncPair p = detail::snc_pair(arv, srv, theta);
52
if
(!p.ok)
return
std::numeric_limits<double>::infinity();
53
const
double
logK = theta * (p.a.sigma + p.s.sigma) -
54
std::log(1.0 - std::exp(-theta * (p.s.rho - p.a.rho)));
55
const
double
a = theta * p.s.rho;
56
return
logK >= 0.0 ? (logK + 1.0) / a : std::exp(logK) / a;
57
},
58
thetamax);
59
}
60
61
}
// namespace snc
62
}
// namespace line
63
64
#endif
// LINE_API_SNC_MEAN_DELAY_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_mean_delay
SncResult snc_mean_delay(const Envelope &arv, const Envelope &srv, double thetamax=1e3)
Upper bound on the mean delay, from integrating the delay tail bound.
Definition
snc_mean_delay.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
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_delay.h
Generated by
1.18.0