LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
snc_env_cpoisson.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_ENV_CPOISSON_H
6#define LINE_API_SNC_ENV_CPOISSON_H
7
8/**
9 * @file
10 * @ingroup api_snc
11 * MGF arrival envelope of a compound Poisson flow with Exp job sizes.
12 *
13 * Jobs arrive Poisson at rate lambda and each carries an Exp(mu) amount of work,
14 * so `rho(theta) = lambda/(mu-theta)` for `0 < theta < mu` and the burst is
15 * zero. Fed to a constant-rate server of rate mu (`snc_srv_rate`) this is the
16 * network calculus model of the M/M/1 queue in units of WORK, and the delay
17 * bound then decays at the exact rate mu-lambda.
18 *
19 * INFEASIBILITY IS A VALUE, NOT AN ERROR: at `theta >= mu` the job-size MGF
20 * diverges and rho is returned as infinity, which the theta search discards.
21 *
22 * Port of matlab/src/api/snc/snc_env_cpoisson.m.
23 */
24
25#include <cmath>
26#include <limits>
28#include "line/util/error.h"
29
30namespace line {
31namespace snc {
32
33/**
34 * @brief MGF arrival envelope of a compound Poisson flow with Exp job sizes.
35 *
36 * @param lambda job arrival rate, jobs per slot
37 * @param mu rate of the Exp job size, so the mean work per job is 1/mu
38 * @param theta Chernoff parameter, theta > 0
39 */
40inline Env snc_env_cpoisson(double lambda, double mu, double theta) {
41 if (lambda < 0 || mu <= 0)
42 throw UnsupportedError("snc_env_cpoisson: lambda must be nonnegative and mu positive");
43 if (theta <= 0) throw UnsupportedError("snc_env_cpoisson: theta must be positive");
44 if (theta >= mu) return Env{0.0, std::numeric_limits<double>::infinity()};
45 return Env{0.0, lambda / (mu - theta)};
46}
47
48/** The same envelope as a function of theta. */
49inline Envelope snc_env_cpoisson_fn(double lambda, double mu) {
50 return [lambda, mu](double theta) { return snc_env_cpoisson(lambda, mu, theta); };
51}
52
53} // namespace snc
54} // namespace line
55
56#endif // LINE_API_SNC_ENV_CPOISSON_H
UnsupportedError(const std::string &what)
Definition error.h:51
The exception types the port throws.
std::function< Env(double)> Envelope
An envelope as a function of the Chernoff parameter.
Definition snc_types.h:48
Envelope snc_env_cpoisson_fn(double lambda, double mu)
The same envelope as a function of theta.
Env snc_env_cpoisson(double lambda, double mu, double theta)
MGF arrival envelope of a compound Poisson flow with Exp job sizes.
Shared types of the stochastic network calculus domain.
The pair (sigma, rho) of an envelope evaluated at one theta.
Definition snc_types.h:42