LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
snc_bound_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_BOUND_DELAY_H
6
#define LINE_API_SNC_BOUND_DELAY_H
7
8
/**
9
* @file
10
* @ingroup api_snc
11
* Violation probability of a delay target.
12
*
13
* For a flow with arrival envelope (sigmaA,rhoA) served by an element with
14
* service envelope (sigmaS,rhoS), the virtual delay of the stable station obeys,
15
* for every theta > 0,
16
*
17
* P{D(t) > d} <= exp(-theta*(rhoS*d-sigmaA-sigmaS)) / (1-exp(-theta*(rhoS-rhoA))),
18
*
19
* the horizontal rather than vertical deviation between the arrival and service
20
* envelopes. On the M/M/1 read in job units (`snc_env_poisson` with
21
* `snc_srv_exp`) the optimal theta tends to log(mu/lambda), so the bound
22
* reproduces the exact asymptotic decay rate exp(-(mu-lambda)*d).
23
*
24
* Port of matlab/src/api/snc/snc_bound_delay.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 Violation probability of a delay target.
38
*
39
* @param arv arrival envelope
40
* @param srv service envelope
41
* @param d delay target, slots
42
* @param thetamax upper end of the theta search
43
*/
44
inline
SncResult
snc_bound_delay
(
const
Envelope
& arv,
const
Envelope
& srv,
double
d,
45
double
thetamax = 1e3) {
46
if
(d < 0)
throw
UnsupportedError
(
"snc_bound_delay: d must be nonnegative"
);
47
const
SncResult
r =
snc_thetaopt
(
48
[&](
double
theta) {
49
const
detail::SncPair p = detail::snc_pair(arv, srv, theta);
50
if
(!p.ok)
return
std::numeric_limits<double>::infinity();
51
return
std::exp(-theta * (p.s.rho * d - p.a.sigma - p.s.sigma)) /
52
(1.0 - std::exp(-theta * (p.s.rho - p.a.rho)));
53
},
54
thetamax);
55
const
double
eps = (!std::isfinite(r.
value
) || r.
value
> 1.0) ? 1.0 : r.
value
;
56
return
SncResult
{eps, r.
theta
};
57
}
58
59
}
// namespace snc
60
}
// namespace line
61
62
#endif
// LINE_API_SNC_BOUND_DELAY_H
line::UnsupportedError::UnsupportedError
UnsupportedError(const std::string &what)
Definition
error.h:51
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_bound_delay
SncResult snc_bound_delay(const Envelope &arv, const Envelope &srv, double d, double thetamax=1e3)
Violation probability of a delay target.
Definition
snc_bound_delay.h:44
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
line::snc::SncResult::value
double value
The bound: a violation probability, a quantile or a mean bound.
Definition
snc_types.h:53
line::snc::SncResult::theta
double theta
The minimizing theta, NaN when no feasible theta exists.
Definition
snc_types.h:55
include
line
api
snc
snc_bound_delay.h
Generated by
1.18.0