![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Counting probabilities of a MAP: P_n(t), the matrix whose (i,j) entry is the probability of n arrivals in [0,t) ending in phase j, given phase i at 0. More...
#include <cmath>#include <cstddef>#include <vector>#include "line/api/mam/map_moment.h"#include "line/util/ode.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::mam |
Functions | |
| template<class T> | |
| std::vector< Matrix< T > > | line::mam::map_pntbisect (const Map< T > &m, std::size_t na, const T &t) |
| P_0(t) . | |
| template<class T> | |
| std::vector< Matrix< T > > | line::mam::map_pnt (const Map< T > &m, std::size_t na, const T &t, long M=-1) |
| P_0(t) . | |
| template<class T> | |
| std::vector< Matrix< T > > | line::mam::map_pntquad (const Map< T > &m, std::size_t na, const T &t) |
| The same counting probabilities by NUMERICAL INTEGRATION, map_pntquad. | |
| template<class T> | |
| Matrix< T > | line::mam::map_pntiter (const Map< T > &m, std::size_t na, const T &t, long M=-1) |
| The reference's entry point: only the highest count is returned. | |
Counting probabilities of a MAP: P_n(t), the matrix whose (i,j) entry is the probability of n arrivals in [0,t) ending in phase j, given phase i at 0.
Port of matlab/lib/kpctoolbox/map/map_pntiter.m (and its map_pntbisect helper), mirrored by jline.api.mam.Map_pntiter and the native Python map_pntiter.
The method is uniformization. With tau = max_i |D0(i,i)|, K = D0/tau + I and K1 = D1/tau, the number of uniformization steps in [0,t) is Poisson(tau t), and conditioning on it gives
V(0,0) = I, V(0,k) = V(0,k-1) K, V(n,k) = V(n,k-1) K + V(n-1,k-1) K1, P_n(t) = sum_{k=0..N} w_k V(n,k), w_k = e^{-tau t} (tau t)^k / k!,
truncated at the N for which the Poisson tail falls below machine epsilon. map_pntiter evaluates this at t/2^M and then squares M times through the discrete convolution P_n <- sum_{j=0..n} P_j P_{n-j}, which is exact because the counts over disjoint intervals add and the phase at the split is summed over by the matrix product.
REFERENCE DEFECT, NOT REPRODUCED (found 2026-08-01, verified in MATLAB R2025a). map_pntbisect.m weights V(n,k) by w_n instead of w_k – the Poisson weight of the ARRIVAL count rather than of the uniformization step count – and never propagates V(0,k), leaving it zero for every k >= 1. Both are wrong and neither is visible on a Poisson process, because there K = 0 collapses V(n,k) to delta(n,k) and the two weights coincide on the only surviving term. On an Erlang-2 MAP of mean 1 at t = 1.3 the reference returns, against the identities any counting law must satisfy:
P_0(t) vs exp(D0 t) max |diff| = 1.93e-1 sum_n P_n(t) vs exp((D0+D1) t) max |diff| = 4.97e-1 sum_n n pie P_n(t) e vs lambda t 0 against 1.3
The version here satisfies all three to round-off, and the tests assert them. map_pntiter and map_pntquad have NO CALLER in any codebase, so the defect is latent and changes no published result; fixing MATLAB, the JAR and Python is tracked separately.
ARITHMETIC: transcendental, for the Poisson weights.
Definition in file map_pnt.h.