![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Sojourn time distribution in a MAP/M/1 processor-sharing queue. More...
#include <cmath>#include <cstddef>#include <vector>#include "line/api/mam/map_moment.h"#include "line/api/mam/qbd_r.h"#include "line/api/mc/ctmc_solve.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/linalg.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::mam::MapM1psResult< T > |
| What the two MAP/M/1-PS sojourn entry points return. More... | |
Namespaces | |
| namespace | line |
| namespace | line::mam |
Functions | |
| template<class T> | |
| T | line::mam::map_compute_R_residual (const Matrix< T > &C, const Matrix< T > &D, const T &mu, const Matrix< T > &R) |
| Residual ||D + R (C - mu I) + mu R^2||_inf of the MAP/M/1 rate equation. | |
| template<class T> | |
| Matrix< T > | line::mam::map_compute_R (const Matrix< T > &C, const Matrix< T > &D, const T &mu, unsigned max_iter, const T &tol) |
| Rate matrix R of a MAP/M/1 queue, the minimal nonnegative solution of D + R (C - mu I) + mu R^2 = 0, by the iteration R <- -D (C - mu I + mu R)^-1 (map_compute_R.m). | |
| template<class T> | |
| Matrix< T > | line::mam::map_compute_R (const Matrix< T > &C, const Matrix< T > &D, const T &mu) |
| map_compute_R with the reference defaults, 1000 iterations and tolerance 1e-10. | |
| template<class T> | |
| Matrix< T > | line::mam::map_compute_R_quadratic (const Matrix< T > &C, const Matrix< T > &D, const T &mu, unsigned max_iter, const T &tol) |
| The same R by the other splitting, R <- (D + mu R^2) (mu I - C)^-1, warm started at -D (C - mu I)^-1 and with the scalar case solved in closed form (the private compute_R_matrix of map_m1ps_cdfrespt.m). | |
| template<class T> | |
| Matrix< T > | line::mam::map_compute_R_quadratic (const Matrix< T > &C, const Matrix< T > &D, const T &mu) |
| map_compute_R_quadratic with the reference defaults, 5000 iterations, 1e-10. | |
| template<class T> | |
| std::vector< std::vector< std::vector< T > > > | line::mam::map_m1ps_h_recursive (const Matrix< T > &C, const Matrix< T > &D, const T &mu, std::size_t N, std::size_t K) |
| The vectors h_{n,k} of Theorem 1 (map_m1ps_h_recursive.m). | |
| template<class T> | |
| MapM1psResult< T > | line::mam::map_m1ps_sojourn (const Matrix< T > &C, const Matrix< T > &D, const T &mu, const std::vector< T > &x, const T &epsilon, const T &epsilon_prime) |
| Complementary sojourn time distribution of a MAP/M/1-PS queue (map_m1ps_sojourn.m). | |
| template<class T> | |
| MapM1psResult< T > | line::mam::map_m1ps_sojourn (const Matrix< T > &C, const Matrix< T > &D, const T &mu, const std::vector< T > &x) |
| map_m1ps_sojourn with the reference defaults, epsilon 1e-11 and 1e-10. | |
| template<class T> | |
| MapM1psResult< T > | line::mam::map_m1ps_cdfrespt (const Matrix< T > &C, const Matrix< T > &D, const T &mu, const std::vector< T > &x, const T &epsilon, const T &epsilon_prime) |
| Complementary sojourn time distribution of a MAP/M/1-PS queue by the spectral-radius truncation (map_m1ps_cdfrespt.m). | |
| template<class T> | |
| MapM1psResult< T > | line::mam::map_m1ps_cdfrespt (const Matrix< T > &C, const Matrix< T > &D, const T &mu, const std::vector< T > &x) |
| map_m1ps_cdfrespt with the reference defaults, epsilon 1e-11 and 1e-10. | |
Sojourn time distribution in a MAP/M/1 processor-sharing queue.
Templated port of matlab/src/api/mam/map_compute_R.m, map_m1ps_h_recursive.m, map_m1ps_sojourn.m and map_m1ps_cdfrespt.m, which implement Theorem 1 of H. Masuyama and T. Takine, "Sojourn time distribution in a MAP/M/1 processor-sharing queue", Operations Research Letters 31(6), 2003, 406-412.
The arrival process is the MAP (C, D) – C carries the hidden transitions, D the arrivals – and service is exponential of rate mu shared equally, so with n jobs present each is served at rate mu/n. The queue length is a QBD whose rate matrix R is the minimal nonnegative solution of
D + R (C - mu I) + mu R^2 = 0,
and the complementary sojourn time distribution is, by uniformization at theta + mu with theta = max_i |C_ii|,
W^c(x) = (1/lambda) sum_n pi_0 R^n D sum_k e^-(theta+mu)x
((theta+mu) x)^k / k! h_{n,k},
with pi_0 = pi (I - R) and the vectors h_{n,k} from the recursion
h_{n,0} = e
h_{n,k+1} = [ n mu/(n+1) h_{n-1,k} + (theta I + C) h_{n,k}
+ D h_{n+1,k} ] / (theta + mu), h_{-1,k} = 0.
ARITHMETIC.
THE TWO ENTRY POINTS ARE NOT THE SAME FUNCTION, despite identical signatures and identical documentation in the reference. They differ in three ways, all reproduced here:
REFERENCE DEFECT. The second output of both functions, W_bar_n, is documented as "the conditional complementary distribution for customers finding n customers in the system", but both compute it as sum(sum_k)/M – the arithmetic MEAN OVER PHASES of the uniformized h-weighted sum, with no reference to the phase distribution at an arrival and no normalization by the probability of finding n customers. It is not a conditional distribution: on the M/M/1-PS instance of the tests (M = 1, lambda = 0.8, mu = 1) the n = 0 curve at x = 0 is 1.0 and DECREASES correctly, but for M > 1 the phases are weighted uniformly rather than by pie, so it is not a probability of anything. The port returns it under the name w_bar_n_unweighted to make the meaning explicit, and computes it identically so a caller comparing against MATLAB sees the same numbers.
Definition in file map_m1ps.h.