LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
snc_conv.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_CONV_H
6
#define LINE_API_SNC_CONV_H
7
8
/**
9
* @file
10
* @ingroup api_snc
11
* Min-plus convolution of two service envelopes (tandem concatenation).
12
*
13
* Two stations traversed in series offer the flow their min-plus convolution.
14
* For independent servers with exponential-form envelopes, summing the geometric
15
* series over the intermediate epoch gives
16
*
17
* rho = min(rho1,rho2),
18
* sigma = sigma1 + sigma2 - log(1-exp(-theta*|rho1-rho2|))/theta.
19
*
20
* This is the pay-bursts-only-once result: the end-to-end burst term grows
21
* additively rather than the per-station delay bounds being summed. The series
22
* diverges at equal rates, so those are handled by shifting the slower server
23
* down by `delta`, the usual regularization; delta trades rate against burst and
24
* is an argument so it can be optimized jointly with theta.
25
*
26
* Port of matlab/src/api/snc/snc_conv.m. Original: F. Ciucu, A. Burchard,
27
* J. Liebeherr, IEEE Trans. Inf. Theory 52(6), 2300-2312, 2006.
28
*/
29
30
#include <algorithm>
31
#include <cmath>
32
#include <limits>
33
#include "
line/api/snc/snc_types.h
"
34
#include "
line/util/error.h
"
35
36
namespace
line
{
37
namespace
snc
{
38
39
/**
40
* @brief Min-plus convolution of two service envelopes (tandem
41
* concatenation).
42
*
43
* @param s1 envelope of the first station
44
* @param s2 envelope of the second station
45
* @param theta Chernoff parameter, theta > 0
46
* @param delta rate separation used when the two rates coincide; a nonpositive
47
* value selects the default 1e-2*min(rho1,rho2)
48
*/
49
inline
Env
snc_conv
(
const
Env
& s1,
const
Env
& s2,
double
theta,
double
delta = -1.0) {
50
if
(theta <= 0)
throw
UnsupportedError
(
"snc_conv: theta must be positive"
);
51
if
(delta <= 0) delta = 1e-2 * std::min(s1.
rho
, s2.
rho
);
52
if
(delta <= 0)
throw
UnsupportedError
(
"snc_conv: delta must be positive"
);
53
if
(!std::isfinite(s1.
rho
) || !std::isfinite(s2.
rho
))
54
return
Env
{std::numeric_limits<double>::infinity(), std::min(s1.
rho
, s2.
rho
)};
55
double
gap = std::fabs(s1.
rho
- s2.
rho
);
56
double
rho;
57
if
(gap <= delta) {
58
gap = delta;
// equal rates: shift the slower server down to close the series
59
rho = std::min(s1.
rho
, s2.
rho
) - delta;
60
}
else
{
61
rho = std::min(s1.
rho
, s2.
rho
);
62
}
63
if
(rho <= 0)
return
Env
{std::numeric_limits<double>::infinity(), rho};
64
return
Env
{s1.
sigma
+ s2.
sigma
- std::log(1.0 - std::exp(-theta * gap)) / theta, rho};
65
}
66
67
}
// namespace snc
68
}
// namespace line
69
70
#endif
// LINE_API_SNC_CONV_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::snc_conv
Env snc_conv(const Env &s1, const Env &s2, double theta, double delta=-1.0)
Min-plus convolution of two service envelopes (tandem concatenation).
Definition
snc_conv.h:49
line
Definition
aoi_dist2ph.h:52
snc_types.h
Shared types of the stochastic network calculus domain.
line::snc::Env
The pair (sigma, rho) of an envelope evaluated at one theta.
Definition
snc_types.h:42
line::snc::Env::sigma
double sigma
Definition
snc_types.h:43
line::snc::Env::rho
double rho
Definition
snc_types.h:44
include
line
api
snc
snc_conv.h
Generated by
1.18.0