![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The diffusion method: a port of solver_fluid_diffusion.m. More...
#include <cmath>#include <cstddef>#include <random>#include <vector>#include "line/api/mc/dtmc_stochcomp.h"#include "line/lang/qn/network_struct.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::fluid::DiffusionOptions |
| Controls of the Euler-Maruyama trajectory. More... | |
| struct | line::fluid::DiffusionResult |
| Time-averaged queue lengths of the diffusion trajectory. More... | |
Namespaces | |
| namespace | line |
| namespace | line::fluid |
Functions | |
| template<class T> | |
| DiffusionResult | line::fluid::fluid_diffusion (const qn::NetworkStruct< T > &sn, const DiffusionOptions &opt) |
| Run the diffusion approximation of sn. | |
The diffusion method: a port of solver_fluid_diffusion.m.
WHAT IT COMPUTES. The fluid limit follows the MEAN drift and says nothing about fluctuation. The diffusion approximation adds a noise term and integrates the resulting stochastic differential equation by Euler-Maruyama,
x <- max(0, x + drift(x) dt + sqrt(dt) Z), Z standard normal,
renormalising each class back to its population after every step so the closed network stays closed. The reported queue lengths are the TIME AVERAGE over the whole trajectory, not the end state: a single noisy path is meaningless at its last instant and informative in the mean.
THE DRIFT HERE IS SIMPLER THAN THE FLUID ONE. It is flow in minus flow out with the service rate applied to the whole queue – x/mu_inv – and no server-sharing term at all. That is why the reference restricts the method to single-server and infinite-server stations: with c = 1 the fluid rate min(x, c)/mu_inv and this x/mu_inv differ, and the reference chooses the latter, so the two methods answer slightly different questions. All the restrictions below are the reference's and are enforced by name.
PARITY IS STATISTICAL, NOT EXACT. The trajectory is driven by pseudorandom normals, and MATLAB's randn and this port's Mersenne Twister produce different streams from the same seed. Two runs therefore agree in distribution and not digit for digit – the same situation the SSA solvers are in across codebases. Tests must assert on averages and invariants (population conservation, ordering), never on a specific trajectory.
Definition in file fluid_diffusion.h.