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

Heuristic sojourn-time distribution at multiserver FCFS stations, a variant of 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_mu_ms.h"
#include "line/api/pfqn/pfqn_mushift.h"
#include "line/api/pfqn/pfqn_mvams.h"
#include "line/api/pfqn/pfqn_rd.h"
#include "line/api/pfqn/pfqn_stdf.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for pfqn_stdf_heur.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::pfqn

Functions

template<class T>
StdfResult< T > line::pfqn::pfqn_stdf_heur (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)
 Heuristic sojourn-time distribution at the listed FCFS stations.

Detailed Description

Heuristic sojourn-time distribution at multiserver FCFS stations, a variant of J.

McKenna, JACM 1987.

Templated port of matlab/src/api/pfqn/pfqn_stdf_heur.m. See pfqn_stdf.h for the method; this file documents only where the heuristic departs from it.

  1. The level CDF is built PER CLASS. Below the server count it uses that class's own rate, Exp(rates(k,r)), instead of the common station rate, so unlike pfqn_stdf the heuristic accepts an FCFS station whose per-class rates differ and performs no rate-agreement check.
  2. At and above the server count the Erlang residual of pfqn_stdf, which assumes one common rate, is replaced by a sum of R independent exponentials, one per class, whose means split the n - S(k) + 1 waiting jobs in proportion to the mean queue lengths Q1(k,s) of the aggregate solve: Exp( Q1(k,s) (n - S(k) + 1) / sum_s Q1(k,s) / rates(k,s) ). Q1 comes from pfqn_mvald, or, when there is a single station, from the ratio of two pfqn_comomrm_ld constants, the second evaluated on the aggregate rate lattice pfqn_mu_ms(sum(N), 2, S(k)) of two S(k)-server stations.
  3. The inner constants Y_ks(t) come from the reduction heuristic pfqn_rd, not from an exact load-dependent solve, and the tilted lattice is NOT truncated before being handed over.
  4. The outer constant lGk always comes from pfqn_mvald, even when there is a single station and the other constants come from pfqn_comomrm_ld.
  5. There is NO min(1, .) clamp on the result. The heuristic therefore reports values above one where the approximation overshoots – this is observed, not hypothetical, and is reproduced deliberately rather than repaired.

TWO DEFECTS OF THE REFERENCE, reproduced as failures rather than as wrong numbers. Neither is repaired here, since MATLAB is the ground truth and both are failures in it too.

(a) Small t. h_k(t | n) underflows to zero for the higher levels, so the tilted rate gamma_k(t, n) becomes infinite, every entry of the beta transform inside pfqn_rd becomes infinite, and pfqn_rd's lastfinite = max(find(isfinite(...))) is empty, whereupon s(ist) = lastfinite raises "Unable to perform assignment because the left and right sides have a different number of elements". The ported pfqn_rd raises NumericError("a station has no finite load-dependent rate") at the same point, which is the same condition with a diagnosis. CORRECTED, MEASURED: this note previously claimed the failure fires at the FineTol substitute for t = 0 "in every model tried", so that the heuristic could not be evaluated at t = 0 at all. That is false. For the single-delay family MATLAB returns 1.9999999767e-08 through 1.9047620835e-09 at N = 1 to 5 there and the port matches every one. The condition is real but model-dependent, not universal.

(b) A class with population zero at N - e_r. Then Q1(k,s) = 0 for that class and item 2 above asks for Exp with mean 0, i.e. an infinite rate. MATLAB builds D0 = -Inf, map_cdf returns NaN, the tilt is NaN and pfqn_rd fails as in (a). This makes the heuristic unusable for every t on any model with a class whose population is one. The port throws InputError from map_exponential_mean at the point the degenerate MAP is requested, which is the earliest place the defect is detectable.

Arithmetic: INEXACT BY CONSTRUCTION, gated on has_transcendental, for the reasons given in pfqn_stdf.h and additionally because pfqn_rd is itself a truncated correction series.

Definition in file pfqn_stdf_heur.h.