![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The moment closures the fluid drift is built from: fluid_min_closure.m, fluid_capacity_closure.m, fluid_lld_scaling.m, fluid_share_closure.m and fluid_gps_share.m. More...
#include <algorithm>#include <cmath>#include <cstddef>#include <limits>#include <string>#include <vector>#include "line/lang/lang_types.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::fluid::ClosureValue |
| A closure's value and its first two derivatives with respect to the first mean. More... | |
| struct | line::fluid::ShareValue |
| A share closure's value and Jacobian, and the joint-closure covariance. More... | |
| struct | line::fluid::ExpansionWeight |
| How much of the second-order correction the series admits, and d tau / d ratio. More... | |
Namespaces | |
| namespace | line |
| namespace | line::fluid |
Functions | |
| double | line::fluid::closure_normcdf (double z) |
| The standard normal cdf, without a statistics library. | |
| double | line::fluid::closure_normpdf (double z) |
| The standard normal pdf. | |
| ClosureValue | line::fluid::fluid_min_closure (double n, double c, double s2, double vc=0.0, double cov_nc=0.0) |
| Port of fluid_min_closure.m: E[min(X,Y)] for jointly normal X, Y, and its derivative with respect to E[X]. | |
| ClosureValue | line::fluid::fluid_lld_scaling (const std::vector< double > &lldrow, double n) |
| Port of fluid_lld_scaling.m: the limited load-dependent multiplier alpha at a CONTINUOUS population, by linear interpolation of the integer table. | |
| ClosureValue | line::fluid::fluid_capacity_closure (double n, double c, double s2, const std::vector< double > &lldrow, bool is_inf) |
| Port of fluid_capacity_closure.m: E[psi(X)] and its derivative, where psi(n) = min(n,c)*alpha(n) at a queueing station and n*alpha(n) at an infinite server. | |
| void | line::fluid::fluid_project_rate (std::vector< double > &r, const std::vector< double > &xb, bool capped, double tot) |
| Port of local_project_rate in ode_rates_closing_factors.m: project a jointly closed per-coordinate service share onto the set it has to live in, namely r >= 0, r <= xb where that bound applies, and sum(r) = tot. | |
| ExpansionWeight | line::fluid::fluid_expansion_weight (double ratio) |
| Port of local_expansion_weight in fluid_share_closure.m. | |
| ShareValue | line::fluid::fluid_share_closure (const std::vector< double > &x, const std::vector< double > &wv, const Matrix< double > &C, bool want_jac, bool want_cov=false) |
| Port of fluid_share_closure.m: E[w_j X_j / sum_m w_m X_m] by the delta method, and its Jacobian at fixed covariance. | |
| ShareValue | line::fluid::fluid_gps_share (const std::vector< double > &xk, const std::vector< double > &wk_in, const std::vector< double > &vk, bool want_jac) |
| Port of fluid_gps_share.m: the expected capacity share of a GPS station under a normal marginal, and its Jacobian. | |
The moment closures the fluid drift is built from: fluid_min_closure.m, fluid_capacity_closure.m, fluid_lld_scaling.m, fluid_share_closure.m and fluid_gps_share.m.
WHY THESE ARE ONE HEADER AND NOT PART OF THE DRIFT. Each answers the same question about a different non-linear term of the rate function: what is E[f(X)] when X is not known but its first two moments are. The first-order fluid closure answers f(E[X]) for all of them, which is why they collapse to nothing when the variance is zero and why every routine below returns the first-order value on that path rather than special-casing it at the caller. The drift needs the VALUE, the covariance equation needs the DERIVATIVE, and they must be the derivative OF that value or the Lyapunov solve is linearizing a different drift than the one integrated; each routine returns both together for exactly that reason.
THREE DISTINCT NON-LINEARITIES, and they are not interchangeable: min(n, c) the server capacity, closed by a normal marginal (fluid_min_closure, and fluid_capacity_closure once a load-dependent alpha(n) multiplies it) w_j x_j / sum the capacity share of PS and DPS, a RATIO, closed by the delta method (fluid_share_closure) 1{x_k >= 1} the backlog indicator of GPS, closed by ENUMERATING the 2^K backlog patterns (fluid_gps_share) The third is not a correction but the whole mechanism: with continuous mass every class is always backlogged, so a first-order closure prices GPS at its heavy-traffic constant regardless of load.
Definition in file fluid_closures.h.