LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
pfqn_xzabaup.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_PFQN_PFQN_XZABAUP_H
6#define LINE_API_PFQN_PFQN_XZABAUP_H
7
8/**
9 * @file
10 * @ingroup api_pfqn
11 * Asymptotic-bound-analysis upper bound on throughput.
12 *
13 * Templated port of matlab/src/api/pfqn/pfqn_xzabaup.m. Single-class model: L is the
14 * per-station demand vector, N the population, Z the think time.
15 *
16 * All operations stay in the field, so the bound is exact in rational
17 * arithmetic: a bound computed exactly is worth having, since a bound violated
18 * only by rounding is indistinguishable from a real violation.
19 */
20
21#include <algorithm>
22#include <vector>
23
24#include "line/num/number.h"
25#include "line/util/error.h"
26#include "line/util/matrix.h"
27
28namespace line {
29namespace pfqn {
30
31/** X <= min(1/Lmax, N/(sum(L)+Z)): capacity bound and population bound. */
32template <class T>
33T pfqn_xzabaup(const std::vector<T>& L, const T& N, const T& Z) {
34 if (L.empty()) throw InputError("pfqn_xzabaup: empty demand vector");
35 T Ltot = num_traits<T>::from_int(0), Lmax = L[0];
36 for (const T& d : L) {
37 Ltot += d;
38 if (d > Lmax) Lmax = d;
39 }
40 if (Lmax == num_traits<T>::from_int(0)) throw InputError("pfqn_xzabaup: all demands are zero");
41 const T cap = num_traits<T>::from_int(1) / Lmax;
42 const T pop = N / (Ltot + Z);
43 return cap < pop ? cap : pop;
44}
45
46} // namespace pfqn
47} // namespace line
48
49#endif
InputError(const std::string &what)
Definition error.h:39
The exception types the port throws.
Dense matrix and non-owning view.
T pfqn_xzabaup(const std::vector< T > &L, const T &N, const T &Z)
X <= min(1/Lmax, N/(sum(L)+Z)): capacity bound and population bound.
Number-type abstraction for the templated API port.