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

Kolmogorov reversibility criterion, used as a product-form test. More...

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

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::mc

Functions

template<class T>
bool line::mc::ctmc_testpf_kolmogorov (const Matrix< T > &Qin)
 Kolmogorov reversibility criterion, used as a product-form test.

Detailed Description

Kolmogorov reversibility criterion, used as a product-form test.

Templated port of jar/src/main/java/jline/api/mc/Ctmc_testpf_kolmogorov.java, which has no MATLAB twin. Kolmogorov's criterion states that an irreducible chain is reversible iff for every cycle c0 -> c1 -> ... -> c0 the product of the rates around it equals the product around the reverse cycle, prod_i q(c_i, c_i+1) = prod_i q(c_i+1, c_i), both products taken on the SAME generator. A cycle whose reverse edges are not all present fails outright.

REFERENCE DEFECT (fixed here and in the JAR, 2026-08-01). The reference took the reverse product on the time-reversed generator Qr instead of on Q. Since Qr(a,b) = Q(b,a) pi_b / pi_a, that product is prod_i Q(c_i, c_i+1) pi_c_i / pi_c_i+1, whose pi factors telescope to 1 around any cycle, so it equals the forward product identically and the test returned true for every chain, reversible or not. The two formulations agree exactly when the chain IS reversible, which is why the defect never showed up as a wrong "false".

COST. Every simple cycle through every edge is enumerated, so the work is exponential in the number of states. That is the reference algorithm and is kept: the callers apply it to small chains only.

ARITHMETIC: the tolerance 1e-6 on the relative gap is a double comparison, so the verdict is a floating-point one even at Rational.

Definition in file ctmc_testpf_kolmogorov.h.