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

Transient distribution of a CTMC by uniformization (Jensen's method), and the time-averaged distribution over [0, t]. More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for ctmc_uniformization.h:

Go to the source code of this file.

Classes

struct  line::mc::UniformizationResult< T >
struct  line::mc::TimeAverageResult< T >

Namespaces

namespace  line
namespace  line::mc

Functions

template<class T>
UniformizationResult< T > line::mc::ctmc_uniformization (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double tol=1e-12, long maxiter=-1)
 Transient distribution of a CTMC by uniformization (Jensen's method), and the time-averaged distribution over [0, t].
template<class T>
TimeAverageResult< T > line::mc::ctmc_timeaverage (const std::vector< T > &pi0, const Matrix< T > &Q, const T &t, double tol=1e-12, long maxiter=-1)
 Time-averaged distribution (1/t) int_0^t pi(u) du, plus pi(t) itself.

Detailed Description

Transient distribution of a CTMC by uniformization (Jensen's method), and the time-averaged distribution over [0, t].

Templated port of matlab/src/api/mc/ctmc_uniformization.m and matlab/src/api/mc/ctmc_timeaverage.m.

pi(t) = pi0 exp(Qt) = sum_j Poisson(j; q t) pi0 P^j, P = I + Q/q

with q = 1.1 max |diag(Q)|. The series is truncated at the first k whose Poisson tail falls below tol, and long horizons are split into segments of q t <= 500 exactly as MATLAB does, because the Poisson weights underflow before that bound is reached.

Unlike the steady-state routines in ctmc_solve.h, this one is NOT exact in the rational field: exp(-q t) is transcendental and the truncation itself is an approximation controlled by tol. The static_assert makes that explicit at compile time rather than leaving a caller to discover it at runtime. The high-precision instantiation is still useful: it pushes the underflow of the Poisson weights far out, which is the failure mode that forces the segmentation in the first place.

Definition in file ctmc_uniformization.h.