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

Sojourn-time distribution at multiserver FCFS stations of a closed product-form network (J. More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/mam/map_cdf.h"
#include "line/api/mam/map_transform.h"
#include "line/api/pfqn/pfqn_comomrm_ld.h"
#include "line/api/pfqn/pfqn_mushift.h"
#include "line/api/pfqn/pfqn_mvams.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for pfqn_stdf.h:

Go to the source code of this file.

Classes

struct  line::pfqn::StdfResult< T >
 Result of pfqn_stdf / pfqn_stdf_heur, mirroring the MATLAB cell array RD. More...

Namespaces

namespace  line
namespace  line::pfqn

Functions

template<class T>
StdfResult< T > line::pfqn::pfqn_stdf (const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &S, const std::vector< std::size_t > &fcfsNodes, const Matrix< T > &rates, const std::vector< T > &tset)
 Sojourn-time distribution at the listed FCFS stations.

Variables

static const double line::pfqn::kStdfFineTol = 1e-8
 GlobalConstants.FineTol, as set by matlab/lineStart.m.

Detailed Description

Sojourn-time distribution at multiserver FCFS stations of a closed product-form network (J.

McKenna, JACM 1987).

Templated port of matlab/src/api/pfqn/pfqn_stdf.m. There is no JAR counterpart, so MATLAB is the only reference.

Method. A class-r job arriving at station k sees, by the arrival theorem, the network at population N - e_r. Conditional on finding n jobs already there, its sojourn time is the sum of its own service and of the residual work of the queue ahead, whose distribution at a station with S(k) servers is the convolution

h_k(t | n) = Exp(rate_k) n < S(k) h_k(t | n) = Exp(rate_k) + Erlang_{n-S(k)+1}(S(k) rate_k) n >= S(k),

built here as MAPs and evaluated with map_cdf. Writing G_krt for the transform of the sojourn CDF, the paper sums h_k(t | |nvec|) F_k(nvec) G_k(N - e_r - nvec) over the whole population lattice. The reference keeps that form as dead commented-out code and executes instead the equivalent RECURSIVE form for load-dependent models, which is what this port implements: the aggregate constant is re-evaluated on a rate lattice tilted by the ratio of successive CDF levels,

gamma_k(t, n) = mu_k(n) h_k(t | n-1) / h_k(t | n),

shifted by pfqn_mushift so that station k is one job ahead, giving

H_krt = h_k(t | 0) G_{-k}(N - e_r)

  • sum_s L(k,s) h_k(t | 0) / gamma_k(t,1) Y_ks(t), F(t) = min(1, H_krt / G(N - e_r)),

with Y_ks(t) the constant of the full model at population N - e_r - e_s on the tilted lattice. The single-station case (M == 1) is dispatched to pfqn_comomrm_ld, everything else to pfqn_mvald, exactly as the reference dispatches it.

Guards reproduced verbatim from the reference:

  • a time point equal to 0 is replaced by GlobalConstants.FineTol, because h_k(t | n) is not well defined there. FineTol is 1e-8, set by matlab/lineStart.m (FINE_TOL); it is NOT 1e-12;
  • a not-a-number H_krt becomes FineTol;
  • the result is clamped from above by min(1, .). pfqn_stdf_heur does NOT apply that clamp and can therefore report values above one; the asymmetry is real and is reproduced in both ports;
  • an FCFS station whose per-class service rates differ by more than FineTol is an invalid model and is rejected.

Numerical stability. The reference warns when pfqn_mvald reports an unstable marginal; this port returns that flag on the result instead of writing to a log, since the port has no logging channel.

Arithmetic: INEXACT BY CONSTRUCTION, gated on has_transcendental. map_cdf is a matrix exponential, the normalizing constants are combined in the log domain, and the zero-time and not-a-number guards are floating-point substitutions with no meaning in an exact field. Note also that pfqn_mvald and pfqn_comomrm_ld report their logarithms as double, so the log-domain part of this computation carries double precision whatever T is; T still governs the CDF evaluation, the tilted rate lattice and the constants themselves.

Definition in file pfqn_stdf.h.