Repository navigation
Commit a284078
feat: EPIC-079 M/M/1 with a threshold-controlled service rate
Roadmap item R5, completing the "catch up" sub-series (R1-R5: published exact
results the library did not have). Implementation of
Morrison J.A., "Sojourn and waiting times in a single-server system with
state-dependent mean service rate", Queueing Systems 4:213-235, 1989,
doi:10.1007/BF02100267.
The model and exact result are his. Morrison's paper is paywalled and was NOT
read; the derivation here was done from scratch and then checked against the
open modern treatment of the same model (Adan & D'Auria, SIAM J. Appl. Math.
76(1), 2016, arXiv:1509.04111, continuous-inspection case), whose equations (4)
and (6) it reproduces, boundary condition included. That is stated in the
module docstring rather than glossed over. Their random-inspection extension is
a different model and is not implemented.
The server runs at mu_low while at most K customers are present and at mu_high
above that. The queue length is an elementary birth-death chain; the sojourn
time is not, because the rate depends on the total in system INCLUDING arrivals
behind the tagged customer, so its own service can speed up for reasons that
affect it in no other way. That is precisely why Little's distributional law
fails here. This also closes a limitation EPIC-073 and EPIC-078 had stated
explicitly -- service that changes speed mid-service is now handled exactly for
the single-server two-level case.
What makes the scheme finite: from (r, N) the customer leaves after exactly r+1
departures, so the system never drops below N - r first. If N - r > K the rate
is mu_high throughout no matter how many customers arrive, and the sojourn is
exactly Erlang(r+1, mu_high). Each level needs only K states -- zero truncation
error in N.
Validation:
- ordinary M/M/1 at equal rates and at K = 0: 1e-12
- the published stationary distribution (Adan & D'Auria eq. (1)-(2)): 1e-12
- Little's law tying the moments to the stationary distribution: 1e-9
- the same absorbing chain solved as an explicit sparse system with NO boundary
condition at all: 1e-16, which is what actually pins the boundary
- simulation: within 0.93 sigma, and the slowdown case at 8 seeds x 2M comes in
at +0.01..+0.11 sigma (at 250k it shows ~1.8 sigma, which is warm-up; the
third epic running where a uniform same-sign deviation turned out to be budget)
One implementation trap recorded: truncating the arrival-state sum on the
PROBABILITIES alone costs six digits on the fourth moment, since the k-th
moment weights them by roughly n^k. The criterion now depends on the order.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 10f432b commit a284078
12 files changed
Lines changed: 1050 additions & 5 deletions
File tree
- docs
- epics
- models
- roadmaps
- most_queue/theory/fifo
- tests
- units
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
132 | 146 | | |
133 | 147 | | |
134 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
136 | 150 | | |
137 | 151 | | |
138 | 152 | | |
| |||
0 commit comments