LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
sn_get_buffer_size.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_SN_SN_GET_BUFFER_SIZE_H
6#define LINE_API_SN_SN_GET_BUFFER_SIZE_H
7
8/**
9 * @file
10 * @ingroup api_sn
11 * Physical buffer size of a station, in jobs, the one in service included.
12 *
13 * Port of matlab/src/api/sn/sn_get_buffer_size.m. Kendall's K: the tighter of
14 * the station capacity sn.cap and the SUM of the per-class capacities
15 * sn.classcap, +inf when the station is unbounded. Both fields already fold
16 * setCapacity, setClassCapacity, a finite orbit and the closed-chain
17 * population, so this is the single place that decides whether a buffer BINDS.
18 *
19 * Two details that are easy to get wrong and both matter. The per-class
20 * capacities are SUMMED, not minimised: a zero marks a class the station does
21 * not serve and is dropped first. And the "unreachable capacity" suppression
22 * compares against the population that can actually REACH this station, i.e.
23 * the classes it serves, not the model's total, without which a MIXED model
24 * reads as finite-buffered at every station an open class never visits.
25 *
26 * This lived inside solvers/nc/solver_nc_mem.h as `nc::detail::buffer_size`.
27 * It is the gate of every finite-buffer branch, not an NC internal, so it now
28 * sits on the api surface. The BODY is `NetworkStruct::buffer_size`, which this
29 * forwards to: the struct's own `has_blocking` (the product-form conjunct the
30 * cpp solvers read through `has_product_form`) needs the same rule, and two
31 * copies of a predicate this load-bearing is exactly how the member and the
32 * free function drift apart.
33 */
34
35#include <algorithm>
36#include <cstddef>
37#include <limits>
38
40
41namespace line {
42namespace sn {
43
44/**
45 * @brief Physical buffer size of a station, in jobs, the one in service
46 * included.
47 *
48 * @param ist 1-based station index.
49 */
50template <class T>
51double sn_get_buffer_size(const qn::NetworkStruct<T>& sn, std::size_t ist) {
52 return sn.buffer_size(ist);
53}
54
55} // namespace sn
56} // namespace line
57
58#endif // LINE_API_SN_SN_GET_BUFFER_SIZE_H
A network plus its refreshed NetworkStruct.
double sn_get_buffer_size(const qn::NetworkStruct< T > &sn, std::size_t ist)
Physical buffer size of a station, in jobs, the one in service included.
A queueing network and its refreshed NetworkStruct.