![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
DETS, the delay estimator under time-varying staffing of Konrad and Liu (WSC 2023): waiting-time distribution of a customer who arrives at time 0 to the FCFS Mt/M/st+M queue and finds all servers busy with nq customers waiting ahead. More...
#include <algorithm>#include <array>#include <cctype>#include <cmath>#include <cstddef>#include <initializer_list>#include <limits>#include <string>#include <vector>#include "line/util/error.h"#include "line/util/expm.h"#include "line/util/linalg.h"#include "line/util/lu.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::qsys::DetsResult |
| DETS result. More... | |
Namespaces | |
| namespace | line |
| Conservation laws of a layered queueing network, enumerated from its structure. | |
| namespace | line::qsys |
| namespace | line::qsys::detail_dets |
Functions | |
| void | line::qsys::detail_dets::input (const char *kind, const std::string &msg) |
| void | line::qsys::detail_dets::dets_generator (int qbar, int rbar, int s, double mu, double theta, Matrix< double > &Qp, Matrix< double > &Qa) |
| Transient generator over (q, r), q = 0..qbar, r = 0..rbar, index r*(qbar+1) + q. | |
| std::vector< double > | line::qsys::detail_dets::dets_jump (const std::vector< double > &v, int qbar, int rbar, int add, int rem, const std::string &policy, int &qn, int &rn) |
| The staffing change at t_k applied to the row vector v over (q, r); qn < 0 means every state was absorbed. | |
| double | line::qsys::detail_dets::vsum (const std::vector< double > &x) |
| double | line::qsys::detail_dets::dets_mean (const std::vector< std::vector< double > > &v, const std::vector< Matrix< double > > &Qs, const std::vector< double > &tb, const std::vector< char > &alive, double theta, int sK, double kill) |
| Integral over [0, inf) of v_k exp(Q_k (x - t_k)) e exp(-theta t_k) on each piece: a finite piece by the block exponential [Q e; 0 0], the last by (-Q)^{-1} e, Inf when the last chain has no server and no killing. | |
| std::string | line::qsys::detail_dets::lower (const std::string &s) |
| DetsResult | line::qsys::detail_dets::dets_core (double mu, double theta, int s0, const std::vector< double > &tk, const std::vector< int > &add, const std::vector< int > &rem, int nq, const std::vector< double > &tau, const std::string &pol, const std::string &wt) |
| The common body once the changes are split into added and removed servers. | |
| std::array< std::string, 2 > | line::qsys::detail_dets::check_common (double mu, double theta, int s0, const std::vector< double > &tk, int nq, const std::string &policy, const std::string &wait) |
| The checks MATLAB runs before splitting DSK, in its order; returns {policy, wait} lower-cased. | |
| DetsResult | line::qsys::qsys_mtmstm_dets (double mu, double theta, int s0, const std::vector< double > &tk, const std::vector< int > &dsk, int nq, const std::vector< double > &tau, const std::string &policy, const std::string &wait="pwt") |
| DETS waiting-time CCDF with the staffing changes given as net signed changes. | |
| DetsResult | line::qsys::qsys_mtmstm_dets (double mu, double theta, int s0, const std::vector< double > &tk, const std::vector< std::array< int, 2 > > &dsk, int nq, const std::vector< double > &tau, const std::string &policy, const std::string &wait="pwt") |
| DETS with the staffing changes given as [added, removed] pairs, for servers joining and leaving at the same time (differs from the net form only under "ec", Remark 2). | |
| DetsResult | line::qsys::qsys_mtmstm_dets (double mu, double theta, int s0, const std::vector< double > &tk, std::initializer_list< int > dsk, int nq, const std::vector< double > &tau, const std::string &policy, const std::string &wait="pwt") |
| Brace-list spelling of the net-change form, so that qsys_mtmstm_dets(..., {}, {}, ...) and qsys_mtmstm_dets(..., {-1, -1}, ...) pick the net form rather than being ambiguous with the pair overload. | |
DETS, the delay estimator under time-varying staffing of Konrad and Liu (WSC 2023): waiting-time distribution of a customer who arrives at time 0 to the FCFS Mt/M/st+M queue and finds all servers busy with nq customers waiting ahead.
Port of matlab/src/api/qsys/qsys_mtmstm_dets.m, cross-checked against python/line_solver/api/qsys/dets.py.
METHOD. The tagged customer's position in the queue is a transient CTMC. Between two staffing changes it moves down at rate s*mu + q*theta, and it is absorbed when the customer enters service. At a change it jumps by a matrix L(k), so P(W > tau) = beta0 prod_k exp(Q(k-1)(t_k - t_(k-1))) L(k) exp(Q(K)(tau - t_K)) e (Theorem 1). Customers behind the tagged one never overtake it, so the result holds for any arrival process (Gt) as well.
POLICY says what happens to a busy server whose shift ends: "pe" preemptive: its customer goes back to the head of the queue "ec" exhaustive completion: it finishes its customer first and serves nobody else "eh" exhaustive handoff: it keeps its customer until a staying server frees up and takes the customer over, which needs a second state variable, the number r of servers still waiting to leave A server joining under "eh" first takes over a leaving server's customer. The three policies agree when the staffing only increases; "pe" and "eh" agree when mu = theta. The [added, removed] form of the changes differs from the net form only under "ec" (Remark 2).
RIGHT-CONTINUITY. The change at tk[k] is applied at tau = tk[k] itself, so Fc is the right-continuous P(W > tau): a server added at tk[k] can admit the tagged customer exactly then, giving the law an atom there. The paper's Theorem 1 applies only the changes strictly before tau, which gives the left limit P(W >= tau) at the change points and the same values everywhere else.
WAIT. "pwt" is the potential waiting time (an infinitely patient customer), "awt" the actual waiting time min(W, patience) (Remark 1): the AWT chain is the PWT chain killed at rate theta. The means integrate the CCDF piece by piece exactly, a finite piece through the block exponential [Q e; 0 0] and the last through (-Q)^{-1} e; meanPWT is Inf when the final staffing is 0 and theta = 0 (a customer at the head of the queue then waits forever).
INDEXING. The vectors are 0-based C++ vectors; the internal state (q, r) has index r*(qbar+1) + q, as the MATLAB index minus one. No random numbers.
Reference: K. Konrad, Y. Liu, "Real-time estimations for the waiting-time distribution in time-varying queues", Proc. Winter Simulation Conference 2023, 315-326.
Definition in file qsys_mtmstm_dets.h.