LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
snc_srv_exp.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_SRV_EXP_H
6#define LINE_API_SNC_SRV_EXP_H
7
8/**
9 * @file
10 * @ingroup api_snc
11 * MGF service envelope of an exponential server, in JOB units.
12 *
13 * A single server with Exp(mu) service times completes jobs at the epochs of a
14 * Poisson process of rate mu while it is busy, so its cumulative service counted
15 * in JOBS is Poisson with mean mu*(t-s) and
16 * `rho(theta) = mu*(1-exp(-theta))/theta` with a zero burst.
17 *
18 * THIS IS THE SERVICE ELEMENT TO USE WHENEVER THE WORK UNIT IS THE JOB. Pairing
19 * `snc_srv_rate` with a job-counting arrival envelope would model a server that
20 * completes jobs at deterministic intervals, an M/D/1, and would UNDERSTATE the
21 * delay of an exponential server rather than bound it. The M/M/1 read with this
22 * element reproduces both exact decay rates: the backlog bound decays as
23 * (lambda/mu)^n in jobs and the delay bound as exp(-(mu-lambda)*d) in time,
24 * since the optimal theta tends to log(mu/lambda).
25 *
26 * Job units also compose across hops: a departure envelope from `snc_output` is
27 * a job count and is directly the arrival envelope of the next station, whereas
28 * service-time work units differ from station to station.
29 *
30 * Port of matlab/src/api/snc/snc_srv_exp.m.
31 */
32
33#include <cmath>
35#include "line/util/error.h"
36
37namespace line {
38namespace snc {
39
40/**
41 * @brief MGF service envelope of an exponential server, in JOB units.
42 *
43 * @param mu service rate, jobs per slot
44 * @param theta Chernoff parameter, theta > 0
45 */
46inline Env snc_srv_exp(double mu, double theta) {
47 if (mu <= 0) throw UnsupportedError("snc_srv_exp: mu must be positive");
48 if (theta <= 0) throw UnsupportedError("snc_srv_exp: theta must be positive");
49 return Env{0.0, mu * (1.0 - std::exp(-theta)) / theta};
50}
51
52/** The same envelope as a function of theta. */
53inline Envelope snc_srv_exp_fn(double mu) {
54 return [mu](double theta) { return snc_srv_exp(mu, theta); };
55}
56
57} // namespace snc
58} // namespace line
59
60#endif // LINE_API_SNC_SRV_EXP_H
UnsupportedError(const std::string &what)
Definition error.h:51
The exception types the port throws.
Env snc_srv_exp(double mu, double theta)
MGF service envelope of an exponential server, in JOB units.
Definition snc_srv_exp.h:46
Envelope snc_srv_exp_fn(double mu)
The same envelope as a function of theta.
Definition snc_srv_exp.h:53
std::function< Env(double)> Envelope
An envelope as a function of the Chernoff parameter.
Definition snc_types.h:48
Shared types of the stochastic network calculus domain.
The pair (sigma, rho) of an envelope evaluated at one theta.
Definition snc_types.h:42