Skip to content

Commit a284078

Browse files
xabarovclaude
andcommitted
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

‎README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ See the executable comparison of **9 disciplines** in
9696
| Impatience & closed | M/M/1+M, Engset | exact |
9797
| Delay-dependent service rates | M/M/c whose service rate switches at a threshold on the customer's own experienced delay (slowdown/speedup) — exact waiting-time distribution, density and mean | exact (mixture of matrix exponentials) |
9898
| Busy-server-dependent service rate | GI/M/2 where a lone busy server works at a different rate than when both are busy (helped by the idle one, or slowed down) — exact state, arrival-observed and waiting-time distributions | exact (Bhat 1966) |
99+
| Threshold-controlled service rate | M/M/1 whose rate switches at a threshold on the number in system — exact sojourn and waiting moments, not elementary because arrivals behind a customer change its own service rate | exact (Morrison 1989) |
99100
| Queueing-inventory | M/M/1, M/M/c, or c heterogeneous servers (identical, exponential, or per-server Erlang-/H2-fitted service) with stock-consuming service, general (s,S) replenishment (exponential or Erlang-fitted lead time), backordering or lost sales | exact QBD |
100101
| EDF scheduling | Earliest-Deadline-First as the actual service discipline (not post-hoc SLA) | DES-exact, no closed form (open problem) |
101102
| Deadline-aware admission control | Accept/reject at arrival based on own-deadline feasibility (not reordering), Exp(θ) deadline — LLM-serving SLO | exact convergent series (level-crossing functional equation) |
@@ -129,6 +130,19 @@ scheduling research (SRPT/LAS with ML size predictions).
129130
moment-fit SLA approximation (which overestimates deep-tail violation
130131
probability by orders of magnitude). 19 new tests, DES-validated.
131132
[Method](docs/research/batch-service-sla-exact-tail-2026.md), [results](docs/research/batch-service-sla-exact-tail-results-2026.md).
133+
- **2026-10, current source tree** — **M/M/1 with a threshold-controlled service rate** (catching
134+
up with the literature, item R5, and completing that sub-series): implementation of Morrison
135+
J.A., *Sojourn and waiting times in a single-server system with state-dependent mean service
136+
rate*, Queueing Systems 4:213-235, 1989. The server runs at a low rate until the backlog crosses
137+
a threshold `K` and at a high rate above it. The queue length is an elementary birth-death
138+
chain; the sojourn time is not, because the rate depends on the total in system **including
139+
arrivals behind the tagged customer**, so its own service can speed up for reasons that affect
140+
it in no other way -- which is exactly why Little's distributional law fails here. Exact sojourn
141+
and waiting moments, conditional and unconditional. This also closes a limitation our own
142+
EPIC-073 and EPIC-078 had stated explicitly. Validated against the M/M/1 reductions, the
143+
published stationary distribution, Little's law, and an explicit matrix solve of the same
144+
absorbing chain with no boundary condition at all.
145+
[Model](docs/models/fifo.md#mm1-with-a-threshold-controlled-service-rate).
132146
- **2026-10, current source tree** — **GI/M/2 with a busy-server-dependent service rate**
133147
(catching up with the literature, item R4): implementation of Bhat U.N., *The queue GI/M/2 with
134148
service rate depending on the number of busy servers*, AISM 18:211-221, 1966. Real servers are

‎README.ru.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ print(f"Среднее ожидание: теория {theory.w[0]:.3f} vs си
101101
| Queueing-inventory | M/M/1, M/M/c, или c гетерогенных серверов (одинаковых, экспоненциальных или с Erlang-/H2-подгонкой на сервер) с расходуемым при обслуживании запасом, общая политика (s,S) (экспоненциальное или Erlang-подогнанное время поставки), backorder или lost sales | точный QBD |
102102
| Интенсивность, зависящая от ожидания | M/M/c, где интенсивность обслуживания переключается по порогу на испытанном заявкой ожидании (замедление/ускорение) — точные распределение, плотность и среднее времени ожидания | точно (смесь матричных экспонент) |
103103
| Интенсивность от числа занятых приборов | GI/M/2, где одинокий занятый прибор работает с другой интенсивностью, чем когда заняты оба (помощь свободного или замедление) — точные распределения состояний, наблюдаемое заявкой и времени ожидания | точно (Bhat 1966) |
104+
| Пороговое переключение интенсивности | M/M/1, где интенсивность переключается по порогу на числе заявок — точные моменты пребывания и ожидания; задача нетривиальна, поскольку приходы позади заявки меняют интенсивность её собственного обслуживания | точно (Morrison 1989) |
104105
| EDF-планирование | Earliest-Deadline-First как реальная дисциплина обслуживания (не post-hoc SLA) | точна по построению (DES), точной теории нет (открытая задача) |
105106
| Admission control по дедлайну | Приём/отказ при поступлении по собственной дедлайн-достижимости (не переупорядочивание), Exp(θ) дедлайн — LLM-serving SLO | точный сходящийся ряд (функциональное уравнение level-crossing) |
106107
| Параллельное обслуживание | Fork-Join, Split-Join; точный тяжёлохвостый (Pareto) максимум n; гетерогенные ветви, series-parallel DAG задач, (n,k)-join поверх гетерогенных/DAG ветвей | марковский / порядковые статистики / точный (Beta-функция) |
@@ -133,6 +134,19 @@ print(f"Среднее ожидание: теория {theory.w[0]:.3f} vs си
133134
приближением SLA-слоя по моментам (которое завышает вероятность нарушения в
134135
глубоком хвосте на порядки). 19 новых тестов, проверено независимой DES.
135136
[Методика](docs/research/batch-service-sla-exact-tail-2026.md), [результаты](docs/research/batch-service-sla-exact-tail-results-2026.md).
137+
- **2026-10, текущие исходники** — **M/M/1 с пороговым переключением интенсивности обслуживания**
138+
(догоняем литературу, пункт Р5; на нём эта подсерия закрыта): реализация работы Morrison J.A.,
139+
*Sojourn and waiting times in a single-server system with state-dependent mean service rate*,
140+
Queueing Systems 4:213-235, 1989. Прибор работает с низкой интенсивностью, пока очередь не
141+
перешагнёт порог `K`, и с высокой сверх того. Число заявок — элементарная цепь рождения-гибели;
142+
время пребывания — нет, поскольку интенсивность зависит от общего числа заявок **включая
143+
пришедших позади помеченной**, так что её собственное обслуживание может ускориться по причине,
144+
которая больше ни на что для неё не влияет; именно поэтому распределительный закон Литтла здесь
145+
неприменим. Точные моменты пребывания и ожидания, условные и безусловные. Попутно снято
146+
ограничение, которое наши же EPIC-073 и EPIC-078 называли явно. Проверено против редукций к
147+
M/M/1, опубликованного стационарного распределения, закона Литтла и явного матричного решения
148+
той же поглощающей цепи вообще без граничного условия.
149+
[Модель](docs/models/fifo.ru.md#mm1-с-пороговым-переключением-интенсивности-обслуживания).
136150
- **2026-10, текущие исходники** — **GI/M/2 с интенсивностью, зависящей от числа занятых
137151
приборов** (догоняем литературу, пункт Р4): реализация работы Bhat U.N., *The queue GI/M/2 with
138152
service rate depending on the number of busy servers*, AISM 18:211-221, 1966. Реальные приборы

0 commit comments

Comments
 (0)