Polling Systems

Analysis of gated, exhaustive, and k-limited polling.

The polling module implements algorithms for polling systems with various polling strategies (gated, exhaustive, k-limited).

Key function categories:

Polling System Analysis Algorithms.

Native Python implementations for analyzing polling/vacation queue systems with various disciplines.

Key algorithms:

polling_qsys_exhaustive: Exhaustive polling discipline polling_qsys_gated: Gated polling discipline polling_qsys_1limited: 1-Limited polling discipline polling_qsys_table: exhaustive/gated polling table (Eisenberg 1972) polling_qsys_klimited: k-limited (Fuhrmann 1985) polling_pcl: pseudo-conservation law (Takagi 1988, eq 10)

polling_qsys_exhaustive(arvMAPs, svcMAPs, switchMAPs)[source]

Compute exact mean waiting times for exhaustive polling system.

In exhaustive polling, the server continues to serve a queue until it becomes empty before moving to the next queue.

Based on Takagi, ACM Computing Surveys, Vol. 20, No. 1, 1988, eq (15).

Parameters:
  • arvMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue arrival MAPs (D0, D1), or arrival rates.

  • svcMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue service MAPs (D0, D1), or [E[S], E[S^2]] arrays.

  • switchMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue switchover MAPs (D0, D1), or [E[R], Var[R]] arrays; the switchover of queue i is the walk OUT of it. See _polling_moments for the numeric form.

Returns:

Array of mean waiting times for each queue.

Return type:

ndarray

polling_qsys_gated(arvMAPs, svcMAPs, switchMAPs)[source]

Compute exact mean waiting times for gated polling system.

In gated polling, the server serves all customers present at the beginning of a visit period.

Based on Takagi, ACM Computing Surveys, Vol. 20, No. 1, 1988, eq (20).

Parameters:
  • arvMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue arrival MAPs (D0, D1), or arrival rates.

  • svcMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue service MAPs (D0, D1), or [E[S], E[S^2]] arrays.

  • switchMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue switchover MAPs (D0, D1), or [E[R], Var[R]] arrays; the switchover of queue i is the walk OUT of it. See _polling_moments for the numeric form.

Returns:

Array of mean waiting times for each queue.

Return type:

ndarray

polling_qsys_1limited(arvMAPs, svcMAPs, switchMAPs)[source]

Compute approximate mean waiting times for a 1-limited polling system.

In 1-limited polling, the server serves at most one customer from each queue before moving to the next queue.

Boxma-Meister approximation (SIGMETRICS/PERFORMANCE ‘86), as reported by Takagi, ACM Computing Surveys, Vol. 20, No. 1, 1988. No exact closed form exists for asymmetric 1-limited systems; the formula is exact for symmetric ones. The last bracket term sums rho_j(1+rho_j) over ALL queues.

Parameters:
  • arvMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue arrival MAPs (D0, D1), or arrival rates.

  • svcMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue service MAPs (D0, D1), or [E[S], E[S^2]] arrays.

  • switchMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue switchover MAPs (D0, D1), or [E[R], Var[R]] arrays; the switchover of queue i is the walk OUT of it. See _polling_moments for the numeric form.

Returns:

Array of mean waiting times for each queue.

Return type:

ndarray

polling_qsys_decrementing(arvMAPs, svcMAPs, switchMAPs)[source]

Compute mean waiting times for a decrementing (semiexhaustive) polling system with open (Poisson) arrivals.

In decrementing service, the server serves a queue until the number of jobs present drops to one less than the number found at the polling instant. The symmetric system admits the exact closed form of Pittel (1973) and Takagi (1984); see Takagi, ACM Computing Surveys, Vol. 20, No. 1, 1988, eq (28). No exact closed form for the individual E[W_i] is known for asymmetric decrementing systems. There an approximation is returned: E[W_i] = c*f_i with f_i = (1-rho_i)/(1-rho-lambda_i(1-rho_i)R), R the total switchover time, and c chosen so that the W satisfy the exact pseudo-conservation law (see polling_pcl). It is exact for symmetric systems; against the exact CTMC of two- and three-queue exponential systems its error was within about 15%.

Parameters:
  • arvMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue arrival MAPs (D0, D1), or arrival rates.

  • svcMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue service MAPs (D0, D1), or [E[S], E[S^2]] arrays.

  • switchMAPs (List[Tuple[ndarray, ndarray]]) – Per-queue switchover MAPs (D0, D1), or [E[R], Var[R]] arrays; the switchover of queue i is the walk OUT of it. See _polling_moments for the numeric form.

Returns:

Array of mean waiting times for each queue.

Return type:

ndarray

polling_qsys_table(arvMAPs, svcMAPs, switchMAPs, table, discipline)[source]

Exact mean waiting times of a polling system with a POLLING TABLE.

Mirrors MATLAB api/polling/polling_qsys_table.m. Open Poisson arrivals; the server visits the queues in the order table[0], table[1], …, cyclically (Haverkort section 9.1.2), every queue appearing at least once and possibly several times. All queues are served exhaustively or all gated.

Parameters:
  • arvMAPs – per queue, a MAP (D0, D1) or the arrival rate (reduced to its rate: arrivals must be Poisson).

  • svcMAPs – per queue, a MAP or [E[S], E[S^2]].

  • switchMAPs – one entry PER TABLE POSITION, the switchover of the leg from position m to position m+1 (the last closing the cycle): a MAP or [E[R], Var[R]].

  • table – 1-based queue indices, e.g. [1, 2, 1, 3] (MATLAB convention).

  • discipline – ‘exhaustive’ or ‘gated’ (or a PollingType).

Method (buffer occupancy, Eisenberg 1972): the first and second moments of the queue lengths at the polling instants obey an affine recursion over the table positions, of dimension n + n^2; the cycle-stationary moment vector solves its fixed point and is propagated to every position. Then

exhaustive W_i = lambda_i b2_i/(2(1-rho_i)) + sum_m E[X_i(X_i-1)]_m / (2 lambda_i sum_m E[X_i]_m) gated W_i = (1+rho_i) sum_m E[X_i(X_i-1)]_m / (2 lambda_i sum_m E[X_i]_m)

the sums running over the positions m of queue i. For table = 1..n this is the classical cyclic system (Takagi 1988, eqs. 15 and 21).

Returns:

W[i] the mean waiting time of queue i, EX[m, :] = E[X] and EX2[m] = E[X X’] at the polling instant of position m.

Return type:

(W, EX, EX2)

polling_qsys_klimited(arvMAPs, svcMAPs, switchMAPs, K)[source]

Approximate mean waiting times of a cyclic k-limited polling system.

Mirrors MATLAB api/polling/polling_qsys_klimited.m. Queue i is served K_i-limited: a visit ends after K_i services or when the queue empties (arrivals during the visit are eligible, as in SolverCTMC’s KLIMITED). The approximation is Fuhrmann’s relation for symmetric k-limited systems (Haverkort eq. 9.27; Takagi 1988 eq. 27),

E[W_i] + b_i = (1-rho) / (1 - rho - lambda_i R / K_i) (E[W_i^E] + b_i),

applied queue by queue, E[W_i^E] being the exact exhaustive mean waiting time of the same system and R the mean total switchover per cycle. Exact in the symmetric case for K=1 and as K grows to infinity.

Parameters:
  • arvMAPs – as polling_qsys_exhaustive.

  • svcMAPs – as polling_qsys_exhaustive.

  • switchMAPs – as polling_qsys_exhaustive.

  • K – a positive integer, or one per queue.

Raises:
  • LineNumericalError (LINE – numerical:Instability) when

  • rho + lambda_i R / K_i >= 1 at some queue. –

polling_pcl(arvMAPs, svcMAPs, switchMAPs, disc)[source]

Pseudo-conservation law of a cyclic polling system with Poisson arrivals.

Mirrors MATLAB api/polling/polling_pcl.m (Boxma and Groenendijk 1987; Takagi, ACM Computing Surveys 20(1), 1988, eq (10)). The law is exact for any mix of exhaustive, gated, 1-limited and decrementing queues: SUM_i w[i]*E[W_i] = rhs.

Parameters:
  • arvMAPs – as polling_qsys_exhaustive (MAPs or the numeric moment forms of _polling_moments).

  • svcMAPs – as polling_qsys_exhaustive (MAPs or the numeric moment forms of _polling_moments).

  • switchMAPs – as polling_qsys_exhaustive (MAPs or the numeric moment forms of _polling_moments).

  • disc – a PollingType (or ‘E’,’G’,’L’,’D’), a (PollingType, K) tuple with K=1 for limited service, or a list of these per queue.

Returns:

the weights, the right-hand side and rhs/sum(w).

Return type:

(w, rhs, pcl)