![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Transient distribution of a CTMC over a time interval, by integrating the forward equations d pi/dt = pi Q. More...
#include <algorithm>#include <cmath>#include <cstddef>#include <limits>#include <vector>#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::mc::TransientResult< T > |
Namespaces | |
| namespace | line |
| namespace | line::mc |
Functions | |
| template<class T> | |
| TransientResult< T > | line::mc::ctmc_transient (const Matrix< T > &Q, const std::vector< T > &pi0, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6) |
| Transient distribution of a CTMC over a time interval, by integrating the forward equations d pi/dt = pi Q. | |
| template<class T> | |
| TransientResult< T > | line::mc::ctmc_transient (const Matrix< T > &Q, const T &t0, const T &t1, double rtol=1e-3, double atol=1e-6) |
| Overload starting from the uniform distribution, as MATLAB's short forms do. | |
| template<class T> | |
| TransientResult< T > | line::mc::ctmc_transient_on_grid (const Matrix< T > &Q, const TransientResult< T > &r, const std::vector< T > &grid) |
| Resample an adaptive transient onto the uniform grid t0 : dt : t1. | |
| template<class T> | |
| TransientResult< T > | line::mc::ctmc_transient_on_grid (const Matrix< T > &Q, const TransientResult< T > &r, const T &t0, const T &t1, const T &dt) |
Transient distribution of a CTMC over a time interval, by integrating the forward equations d pi/dt = pi Q.
Templated port of matlab/src/api/mc/ctmc_transient.m (and the richer kpctoolbox copy). The reference integrates with ode23, MATLAB's Bogacki-Shampine 3(2) pair with first-same-as-last, adaptive step and default tolerances RelTol 1e-3, AbsTol 1e-6; the same pair, the same step controller and the same defaults are reproduced here, so the returned time grid is the solver's own accepted steps rather than a fixed grid.
MATLAB-VS-JAVA DISAGREEMENT. jline.api.mc.Ctmc_transient integrates the same equations with LSODA at absolute and relative tolerance 1e-6, so the two references return DIFFERENT time grids and solutions agreeing only to the looser of the two tolerances. This port follows MATLAB, the ground truth.
GATED ON TRANSCENDENTAL ARITHMETIC. The step controller raises the error ratio to the power 1/3, and adaptive integration is an approximation with a tolerance rather than a finite exact computation: there is no exact value of pi(t) for a general rational Q, exp(Qt) not being a rational function of t. For a tightly controlled transient use ctmc_foxglynn or ctmc_uniformization at high precision, which bound their truncation error explicitly.
Definition in file ctmc_transient.h.