LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
pfqn_bkt.h File Reference

Knessl-Tier expansion with the Stirling-remainder correction (BKT). More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/pfqn/pfqn_asympt_common.h"
#include "line/api/pfqn/pfqn_kt.h"
#include "line/num/number.h"
#include "line/util/matrix.h"
Include dependency graph for pfqn_bkt.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::pfqn

Typedefs

template<class T>
using line::pfqn::BktResult = KtResult<T>
 Return value of pfqn_bkt, mirroring [Gn, lGn] (X and Q are pfqn_kt's seeds).

Functions

template<class T>
line::pfqn::pfqn_stirling_remainder (const T &n)
 s(N) = log(N!) - (N log N - N + log(2 pi N)/2), exactly, for N >= 1.
template<class T>
BktResult< T > line::pfqn::pfqn_bkt (const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z)
 Knessl-Tier expansion with the Stirling-remainder correction (BKT).
template<class T>
BktResult< T > line::pfqn::pfqn_bkt (const Matrix< T > &L, const std::vector< T > &N)

Detailed Description

Knessl-Tier expansion with the Stirling-remainder correction (BKT).

Templated port of matlab/src/api/pfqn/pfqn_bkt.m. pfqn_kt extracts N from the generating function of G by steepest descent on

F(xi) = sum_r Z_r xi_r - sum_k log(1 - U_k) - sum_r N_r log xi_r, U = L xi.

On the demand-free integral the exact coefficient is [xi^N] exp(Z xi) = Z^N/N!, whereas the expansion returns N log Z - (N log N - N + log(2 pi N)/2), which is Stirling's approximation of log(N!) in place of log(N!). So KT lies ABOVE the exact value by the remainder

s(N) = log(N!) - (N log N - N + log(2 pi N)/2) = lgamma(N+1) - (N + 1/2) log N + N - log(2 pi)/2

per Laplaced class direction, and BKT subtracts sum_r s(N_r). s(1) is the constant pfqn_ble adds per STATION direction, and s(N) = 1/(12 N) + O(N^-2); the remainder is evaluated exactly, since truncating it at 1/(12 N) loses an order of magnitude (median |error| on the 1562 models of Cas17 sec5.3.1: 0.083 nats for KT, 1.9e-4 for the truncation, 1.4e-5 for the exact remainder). With a think time BKT is the SAME estimator as pfqn_ble, to the accuracy of the two saddle-point solvers; without one they differ by the constant kappa - r(N+M). See _kb/03-api-layer.md.

WHICH CLASSES. Only the classes pfqn_kt actually Laplaces are corrected: a class with no jobs is dropped by its recursion, and a self-looping class (one nonzero demand and no think time, folded only when more than one class remains) has its coefficient extracted exactly, so neither carries a remainder. The predicate below is pfqn_kt's own, re-derived here rather than trusting R.

ARITHMETIC. Inherited from pfqn_kt: gated on num_traits<T>::has_transcendental.

Definition in file pfqn_bkt.h.