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

Stationary distribution of the unfinished work in a single-stage load-dependent generalized-processor-sharing station with Poisson arrivals and blocking. More...

#include <cmath>
#include <cstddef>
#include <functional>
#include <vector>
#include "line/api/qsys/qsys_quadrature.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for qsys_ldps_workload.h:

Go to the source code of this file.

Classes

struct  line::qsys::WorkloadServiceLaw< T >
 The three things Cohen's formula needs from the required-service-time law: its mean, its squared coefficient of variation, and its CDF. More...
struct  line::qsys::LdpsWorkloadResult< T >
 Return value of qsys_ldps_workload, mirroring the three MATLAB outputs. More...

Namespaces

namespace  line
namespace  line::qsys

Functions

template<class T>
LdpsWorkloadResult< T > line::qsys::qsys_ldps_workload (const T &lambda, const WorkloadServiceLaw< T > &B, const std::vector< T > &alpha, std::size_t N, const std::vector< T > &t, std::size_t ngrid)
 Workload distribution of the load-dependent PS station with blocking.
template<class T>
LdpsWorkloadResult< T > line::qsys::qsys_ldps_workload (const T &lambda, const WorkloadServiceLaw< T > &B, const std::vector< T > &alpha, std::size_t N)
 qsys_ldps_workload on the automatic grid with the reference default ngrid = 2001.

Detailed Description

Stationary distribution of the unfinished work in a single-stage load-dependent generalized-processor-sharing station with Poisson arrivals and blocking.

Port of matlab/src/api/qsys/qsys_ldps_workload.m, which is the model of J.W. Cohen, "The multiple phase service network with generalized processor sharing", Acta Informatica 12, 245-284 (1979), Sect. 9.

MODEL. Poisson arrivals of rate lambda; blocking capacity N, an arrival finding N requests present being lost without trace; each of x present requests accrues service at rate f(x), so the stage completes work at total rate x f(x); required service times iid with an absolutely continuous law B of finite mean beta. The port is parametrized, as the reference is, by the LINE load-dependent TOTAL rate scaling alpha(x) = x f(x), which is the argument of setLoadDependence at a PS station.

Cohen's eqs. (9.1)-(9.3): P{psi_t < psi} = sum_{h=0}^{N} p_h Psi^{h*}(psi) p_h propto rho^h/prod_{k=1}^{h} alpha(k), rho = lambda beta Psi(psi) = int_0^psi (1 - B(v))/beta dv with Psi^{h*} the h-fold convolution and Psi^{0*} degenerate at zero, so the workload has an ATOM of size p_0 at the origin. Substituting f(k) = alpha(k)/k cancels the factorial that appears in Cohen's phi(h), leaving the familiar load-dependent birth-death form for p. The state probabilities depend on B only through beta; the workload depends on its shape only through the equilibrium residual law Psi.

WHAT THE PORT TAKES INSTEAD OF A Distribution OBJECT. The reference takes a LINE Distribution and reads getMean, getSCV and evalCDF off it. The C++ port has no model layer, so it takes exactly those three things: the mean, the squared coefficient of variation (used only to size the default grid through the mean equilibrium residual life beta(1+SCV)/2) and the CDF as a callable. Nothing else of the Distribution interface is used by the reference either, so this is the same function with its dependency made explicit.

ACCURACY. The convolutions are formed on a uniform grid with the TRAPEZOIDAL rule, not the rectangle rule that a bare convolution implies. The correction matters because the equilibrium density does not vanish at the origin, e(0) = 1/beta: without it each convolution over-counts by dt e(0) g_i, which accumulates over h and drives the mixture CDF above one. Convergence is second order in the step for an absolutely continuous B, the case Cohen assumes, and falls to first order when B has an atom so that 1 - B is discontinuous, Det being the extreme case; the reference measures 4.00x per grid doubling for Exp and about 2x for Det, and the port reproduces both regimes (see the tests).

ARITHMETIC. Gated on num_traits<T>::has_transcendental. The birth-death weights are accumulated in LOGS, exactly as the reference does, so a large rho or a large N cannot overflow before normalization; that alone needs log/exp. The quadrature is a tolerance-free fixed grid, so it introduces no further requirement, but it does introduce a discretization error, which is why the grid size is an explicit argument rather than hidden.

NOT the weighted GPS/DPS discipline of SchedStrategy.GPS: this formula has no per-class weights and does not represent them.

Definition in file qsys_ldps_workload.h.