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

Exact analysis of the finite-source M/G/1/K/K (machine-repair) queue. More...

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <limits>
#include <string>
#include <vector>
#include "line/api/qsys/qsys_res.h"
#include "line/lang/distribution.h"
#include "line/util/error.h"
#include "line/util/line_console.h"
#include "line/util/lu.h"
#include "line/util/matrix.h"
Include dependency graph for qsys_mg1kk.h:

Go to the source code of this file.

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::qsys

Functions

QsysRes line::qsys::qsys_mg1kk (double alpha, unsigned K, const std::function< double(double)> &lst, double ES)
 Exact M/G/1/K/K finite-source queue, service given by its LST.
QsysRes line::qsys::qsys_mg1kk (double alpha, unsigned K, const lang::Distrib< double > &svc)
 Exact M/G/1/K/K finite-source queue, service given as a Distribution (its LST and mean, as MATLAB's svc.evalLST / svc.getMean).

Detailed Description

Exact analysis of the finite-source M/G/1/K/K (machine-repair) queue.

Port of matlab/src/api/qsys/qsys_mg1kk.m. K sources each operate for an Exp(alpha) time and then queue FCFS at one server of general service law B. Takacs (1962) gives the idle probability from the service LST at the points k alpha,

P0 = 1 / (1 + K alpha E[S] sum_{n=0}^{K-1} C(K-1, n) prod_{k=1}^n (1 - B(k alpha))/B(k alpha)),

whence X = (1 - P0)/E[S] and E[T] = K/X - 1/alpha. The queue-length law comes from the chain embedded at departures, whose transition probabilities are alternating sums of B(k alpha); MATLAB's check that its P0 agrees with Takacs' is kept: when the alternating sums cancel it warns and returns the distribution (and the variance) as NaN, the means being the Takacs sum.

ARITHMETIC: double, as the reference. MATLAB's overdetermined A \ b (least squares on the consistent system [P' - I; 1] pi = [0; 1]) is solved here by LU on the square system that replaces one of the K dependent balance rows by the normalization; the solution of a consistent system is unique, so the two agree to rounding.

Definition in file qsys_mg1kk.h.