اگر در یک بازه دو تماس شروع شده باشد، آیا ضربِ نرخِ ورود در میانگینِ مدتِ همان دو تماس، میانگینِ تماس‌های هم‌زمان را می‌دهد؟ پاسخ به مرزِ مشاهده بستگی دارد. تماسی که پیش از شروعِ بازه وارد شده، در نرخِ ورودِ این بازه شمرده نمی‌شود، اما می‌تواند خط را اشغال کند. از طرف دیگر، بخشی از مدتِ کاملِ یک تماسِ تازه‌وارد ممکن است پس از پایانِ مشاهده باشد. این درس حسابِ این دو سهم را با کسرهای دقیق روشن می‌کند.

داده‌ها ساختگی و کامل‌اند: برای هر شناسه، زمانِ ورود و خروج را داریم. هدف، بازسازیِ یک حسابِ قابل‌بررسی در پنجره‌ای دلخواه است. این مثال اندازه‌گیریِ شبکه، برآوردِ تماس‌های نادیده یا پیشنهادِ تعدادِ کانالِ یک سامانه نیست.

۱. ردِ حضور تماس را از سیاستِ پذیرش جدا کنیم

سه نوارِ مستقلِ حضور کنار یک دفتر ثبتِ بدون نوشته قرار گرفته‌اند
تصویر مفهومی: سه نوارِ مستقلِ حضور کنار یک دفتر ثبتِ بدون نوشته قرار گرفته‌اند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

مرزِ «حضور» باید پیش از محاسبه تعریف شود. در اینجا بازهٔ هر تماس از ورود تا خروج است؛ دربارهٔ زنگ‌خوردن، پاسخ‌دادن یا زمانِ پردازشِ رسانه، معنای اضافی تحمیل نمی‌کنیم. ورودی، تاریخچهٔ کاملِ حضورهای ازپیش‌داده‌شده است و برنامه تصمیم نمی‌گیرد کدام تماس پذیرفته شود. اگر سامانهٔ شما مرزِ دیگری برای حضور دارد، ابتدا باید همان مرز را در داده‌ها یکسان کنید.

بازه‌ها را نیمه‌باز می‌گیریم: ابتدای حضور داخل و لحظهٔ خروج خارج است. پنجرهٔ مشاهده نیز چنین است؛ ورود دقیقاً روی لبهٔ راست، عضوِ گروهِ ورودِ پنجره نیست. زمانِ منفی فقط جابه‌جایی نسبت به مبدأِ انتخابی است؛ مدتِ حضور همیشه مثبت می‌ماند. ورودها می‌توانند هم‌زمان باشند، ولی شناسه‌ها یکتا هستند.

در درسِ ظرفیتِ تماس، پذیرش با سقفِ کانال و مساحتِ اشغالِ کلِ تاریخچه بررسی شده است. اینجا سیاستِ پذیرش نداریم؛ مسئلهٔ تازه، تفاوتِ گروهِ ورود با حضورِ بریده‌شده در پنجره است. همچنین مدلِ انتظار و انصرافِ FCFS ترتیبِ خدمت را می‌سازد؛ این درس هیچ صف یا ترتیبِ خدمتی را شبیه‌سازی نمی‌کند.

۲. میانگینِ هم‌زمانی را از مساحتِ زمان‌دار بسازیم

کاشی‌های هم‌اندازهٔ حضور در کنارِ هم سطحی از اشغال می‌سازند
تصویر مفهومی: کاشی‌های هم‌اندازهٔ حضور در کنارِ هم سطحی از اشغال می‌سازند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

در هر لحظه، تعدادِ حضورهای فعال را N می‌نامیم. سهمِ هر قطعهٔ زمانی، تعدادِ فعال ضرب‌در طولِ همان قطعه است. جمعِ این سهم‌ها، Q، واحدِ «تماس‌میلی‌ثانیه» دارد. با تقسیمِ Q بر طولِ کاملِ پنجره، T، میانگینِ هم‌زمانی L به دست می‌آید. زمان‌های خالی نیز جزوِ مخرج‌اند؛ حذفِ آن‌ها سؤال را به میانگینِ مشروط به مشغول‌بودن تغییر می‌دهد.

مثالِ بسته را دستی بسازیم: حضورهای A از صفر تا چهار، B از دو تا هشت و C از شش تا ده هستند و پنجره از صفر تا ده است. هر سه حضور کاملاً داخل‌اند، بنابراین Q برابرِ ۴+۶+۴، یعنی ۱۴ تماس‌میلی‌ثانیه و L برابرِ ۱۴/۱۰ یا ۷/۵ است. سه ورود در ده میلی‌ثانیه، نرخِ ۳/۱۰ می‌دهد؛ میانگینِ مدتِ کاملِ همین سه حضور ۱۴/۳ است و حاصل‌ضرب نیز ۷/۵ می‌شود.

میانگینِ تعدادها روی قطعه‌های رویدادی، بدون وزنِ طولِ قطعه، عموماً پاسخ نیست. در مثالِ عبوریِ بخشِ بعد، تعدادها به‌ترتیب ۱، ۲، ۱ و ۱ هستند، اما طول‌ها ۱، ۲، ۱ و ۱ میلی‌ثانیه‌اند. میانگینِ سادهٔ چهار تعداد ۵/۴ است؛ میانگینِ زمان‌وزن‌دار ۷/۵. ثبتِ یک نمونه در هر رویداد، معادلِ نمونه‌برداریِ یکنواخت از زمان نیست.

۳. گروهِ شمارش و مرزِ پنجره را در رابطهٔ لیتل یکسان کنیم

قابِ شفاف فقط بخشِ میانیِ نوارها را در بر می‌گیرد و دو امتدادِ بیرونی جدا باقی می‌مانند
تصویر مفهومی: قابِ شفاف فقط بخشِ میانیِ نوارها را در بر می‌گیرد و دو امتدادِ بیرونی جدا باقی می‌مانند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

اکنون A از منفیِ دو تا سه، B از یک تا چهار و C از چهار تا نه حضور دارند؛ پنجره صفر تا پنج است. سهمِ داخلِ پنجره برای A، B و C به‌ترتیب ۳، ۳ و ۱ است. پس Q برابرِ ۷ و L برابرِ ۷/۵ است. فقط B و C داخلِ پنجره وارد شده‌اند: نرخِ ورود ۲/۵ و میانگینِ مدتِ کاملشان ۴ میلی‌ثانیه است. حاصل‌ضربِ این دو، ۸/۵، با میانگینِ مشاهده‌شده برابر نیست.

تصحیحِ دقیق چنین است: مساحتِ مشاهده برابر است با مجموعِ مدتِ کاملِ ورودهای داخلِ پنجره، به‌علاوهٔ حضورِ داخلِ پنجره از ورودهای قدیمی، منهای امتدادِ پس از پنجره برای ورودهای تازه. اینجا مدتِ کاملِ B و C جمعاً ۸، سهمِ انتقالیِ A برابرِ ۳ و دنبالهٔ بیرونیِ C برابرِ ۴ است؛ بنابراین ۷=۸+۳−۴. این هویت برای همین تاریخچه‌های محدود است و فرضِ تصادفی لازم ندارد. حتی برابریِ حاصل‌ضربِ ساده هم ثابت نمی‌کند مرزها بی‌اثرند؛ دو تصحیح می‌توانند همدیگر را خنثی کنند.

در بخشِ کاملِ قضیهٔ لیتل در یادداشتِ MIT، رابطهٔ L=λW با میانگین‌های حدی و فرض‌های صریحِ استدلالِ باززایی بیان می‌شود؛ صورتِ قضیه برای صفِ G/G/1، متناهی‌بودنِ امیدِ فاصلهٔ باززایی را ذکر می‌کند. هندسهٔ مساحت الهام‌بخشِ این حساب است، ولی چند حضورِ ساختگی، آن فرض‌ها یا وجودِ میانگینِ بلندمدت را اثبات نمی‌کند. اگر خروجِ بعضی تماس‌ها واقعاً نامعلوم باشد، این برنامه آن دادهٔ سانسورشده را حدس نمی‌زند.

۴. کدِ دقیق را با مرجعِ مستقلِ هر تماس بسنجیم

دو شیوهٔ ساخت با قطعات مستقل به سطحِ هم‌اندازه‌ای در دو سینی می‌رسند
تصویر مفهومی: دو شیوهٔ ساخت با قطعات مستقل به سطحِ هم‌اندازه‌ای در دو سینی می‌رسند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

قراردادِ آموزشی عمداً کوچک است: صفر تا هشت رکورد در تاپل، شناسهٔ ASCII یکتا با طولِ حداکثرِ هشت، و زمان‌های صحیح از منفیِ شانزده تا سی‌ودو. پنجره نیز تاپلِ دو زمانِ مرتب است. نوعِ دقیقِ int لازم است؛ مقدارِ بولی، عددِ اعشاری، زیرکلاس و مولد پذیرفته نمی‌شوند. همهٔ رکوردها پیش از ساختِ نتیجه اعتبارسنجی می‌شوند. این حدود، دامنهٔ همین تمرین‌اند و محدودهٔ فیزیکیِ تماس را توصیف نمی‌کنند.

مسیرِ اصلی، مرزهای حضورِ بریده‌شده را مرتب می‌کند و تغییرِ تعداد را روی هر مرز جمع می‌زند. مرجعِ مستقل، در سلول‌های یک‌میلی‌ثانیه‌ایِ دادهٔ صحیح، عضویتِ خامِ هر حضور را می‌شمارد؛ تابعِ اصلی یا دلتای رویداد را فراخوانی نمی‌کند. خانوادهٔ محدود شاملِ ۱۱۱ تاریخچه و شش پنجره، یعنی ۶۶۶ مقایسه است و فقط یک گروهِ بررسی محسوب می‌شود. نمونه‌های دستی، مرزهای نیمه‌باز، جمع‌پذیریِ پنجره، تغییرِ مبدأ، تغییرِ واحد و ورودی‌های نامعتبر گروه‌های معناییِ جدا دارند.

Fraction در کتابخانهٔ استانداردِ Python نسبت‌های صحیح را دقیق نگه می‌دارد. در JSON، کسرها رشته‌اند و میانگینِ گروهِ خالی null است. کد و خروجیِ کاملِ ثبت‌شده در ادامه قرار می‌گیرند؛ نسخهٔ واقعیِ مفسر داخلِ خروجی می‌آید. نسخهٔ مستنداتِ خوانده‌شده ۳.۱۴.۸ است و با نسخهٔ اجرای محلی یکی فرض نمی‌شود.

"""Finite residence-window accounting; no calls, admission, queue or benchmark."""
from fractions import Fraction as F
from itertools import combinations, permutations, product
import json
import platform
import re
import sys


def validate(histories, window):
    if type(window) is not tuple or len(window) != 2:
        raise ValueError("window_tuple")
    if any(type(t) is not int or not -16 <= t <= 32 for t in window):
        raise ValueError("window_times")
    if window[0] >= window[1]:
        raise ValueError("window_order")
    if type(histories) is not tuple or len(histories) > 8:
        raise ValueError("histories_tuple")
    seen = set()
    for row in histories:
        if type(row) is not tuple or len(row) != 3:
            raise ValueError("history_shape")
        name, arrival, departure = row
        if (type(name) is not str or
                re.fullmatch(r"[A-Za-z][A-Za-z0-9_]{0,7}", name) is None or
                name in seen):
            raise ValueError("history_ID")
        if any(type(t) is not int or not -16 <= t <= 32
               for t in (arrival, departure)):
            raise ValueError("history_times")
        if arrival >= departure:
            raise ValueError("history_order")
        seen.add(name)


def account_window(histories, window):
    """All complete supplied residence intervals use [arrival, departure).

    The observer window is [left,right). An arrival at right is outside its
    arrival cohort. Negative timestamps are relative offsets, not durations.
    """
    validate(histories, window)  # Complete validation before any computation.
    left, right = window
    ordered = sorted(histories, key=lambda row: row[0])
    delta = {left: 0, right: 0}
    clipped = {}
    arrivals = []
    full_sum = carry_in = right_tail = 0
    for name, arrival, departure in ordered:
        low, high = max(arrival, left), min(departure, right)
        inside = max(0, high - low)
        clipped[name] = inside
        if inside:
            delta[low] = delta.get(low, 0) + 1
            delta[high] = delta.get(high, 0) - 1
        if arrival < left:
            carry_in += inside
        if left <= arrival < right:
            arrivals.append(name)
            full_sum += departure - arrival
            right_tail += max(0, departure - right)
    points = sorted(delta)
    active = area = 0
    segments = []
    for low, high in zip(points, points[1:]):
        active += delta[low]
        assert 0 <= active <= len(histories)
        segments.append({"start_ms": low, "end_ms": high, "active": active})
        area += active * (high - low)
    assert active + delta[right] == 0
    assert area == full_sum + carry_in - right_tail
    span = right - left
    rate = F(len(arrivals), span)
    mean_full = F(full_sum, len(arrivals)) if arrivals else None
    return {
        "window_ms": window,
        "window_length_ms": span,
        "segments": segments,
        "clipped_residence_ms": clipped,
        "area_call_ms": area,
        "mean_concurrency_calls": F(area, span),
        "arrival_cohort_IDs": tuple(arrivals),
        "arrival_rate_calls_per_ms": rate,
        "arrival_cohort_full_sum_call_ms": full_sum,
        "arrival_cohort_mean_full_ms": mean_full,
        "arrival_rate_times_mean_full_calls":
            rate * mean_full if mean_full is not None else None,
        "carry_in_call_ms": carry_in,
        "arrival_right_tail_call_ms": right_tail,
        "boundary_correction_call_ms": carry_in - right_tail,
    }


def cell_oracle(histories, window):
    """Valid tiny fixtures only: count raw interval membership per unit cell.

    No event deltas, clipping min/max, production function or validator call.
    Complete residence length and right tails are also enumerated as cells.
    """
    left, right = window
    counts = [sum(arrival <= t < departure
                  for _, arrival, departure in histories)
              for t in range(left, right)]
    per_ID = {name: sum(arrival <= t < departure for t in range(left, right))
              for name, arrival, departure in sorted(histories)}
    cohort = tuple(sorted(name for name, a, _ in histories if left <= a < right))
    full = sum(sum(1 for _ in range(a, d)) for _, a, d in histories
               if left <= a < right)
    carry = sum(per_ID[name] for name, a, _ in histories if a < left)
    tail = sum(sum(t >= right for t in range(a, d)) for _, a, d in histories
               if left <= a < right)
    return {"counts": counts, "per_ID": per_ID, "cohort": cohort,
            "area": sum(counts), "full": full, "carry": carry, "tail": tail}


def rejected(histories, window):
    try:
        account_window(histories, window)
    except ValueError:
        return True
    return False


def json_exact(value):
    if type(value) is F:
        return str(value)
    raise TypeError("Only exact Fraction needs custom JSON representation")


def self_check():
    closed_rows = (("A", 0, 4), ("B", 2, 8), ("C", 6, 10))
    closed = account_window(closed_rows, (0, 10))
    crossing_rows = (("A", -2, 3), ("B", 1, 4), ("C", 4, 9))
    crossing = account_window(crossing_rows, (0, 5))
    checks = {}
    checks["closed_cohort_hand_area_fourteen_and_matching_product"] = (
        closed["area_call_ms"] == 14 and
        closed["mean_concurrency_calls"] == F(7, 5) and
        closed["arrival_rate_calls_per_ms"] == F(3, 10) and
        closed["arrival_cohort_mean_full_ms"] == F(14, 3) and
        closed["arrival_rate_times_mean_full_calls"] == F(7, 5) and
        closed["carry_in_call_ms"] == closed["arrival_right_tail_call_ms"] == 0)
    checks["cross_boundary_hand_seven_equals_eight_plus_three_minus_four"] = (
        crossing["clipped_residence_ms"] == {"A": 3, "B": 3, "C": 1} and
        crossing["area_call_ms"] == 7 and
        crossing["arrival_cohort_full_sum_call_ms"] == 8 and
        crossing["carry_in_call_ms"] == 3 and
        crossing["arrival_right_tail_call_ms"] == 4 and
        crossing["mean_concurrency_calls"] == F(7, 5) and
        crossing["arrival_rate_times_mean_full_calls"] == F(8, 5))
    no_arrivals = account_window((("A", -2, 9),), (0, 5))
    checks["positive_carry_in_without_arrivals_has_undefined_cohort_mean"] = (
        no_arrivals["mean_concurrency_calls"] == 1 and
        no_arrivals["arrival_rate_calls_per_ms"] == 0 and
        no_arrivals["arrival_cohort_mean_full_ms"] is None and
        no_arrivals["arrival_rate_times_mean_full_calls"] is None and
        no_arrivals["carry_in_call_ms"] == 5)
    empty = account_window((), (0, 5))
    outside = account_window((("A", -2, 0), ("B", 5, 9)), (0, 5))
    checks["empty_or_nonoverlapping_histories_have_zero_area_and_idle_span"] = (
        empty["area_call_ms"] == outside["area_call_ms"] == 0 and
        empty["segments"] == outside["segments"] ==
        [{"start_ms": 0, "end_ms": 5, "active": 0}] and
        outside["arrival_cohort_IDs"] == ())
    edge = account_window((("A", 0, 2), ("B", 2, 4), ("C", 4, 5)), (0, 4))
    checks["half_open_window_cohort_and_equal_departure_arrival_boundary"] = (
        edge["area_call_ms"] == 4 and edge["arrival_cohort_IDs"] == ("A", "B")
        and edge["clipped_residence_ms"] == {"A": 2, "B": 2, "C": 0}
        and [s["active"] for s in edge["segments"]] == [1, 1])

    intervals = tuple(combinations(range(-1, 4), 2))
    profiles = [()] + [(("A", a, d),) for a, d in intervals]
    profiles += [(("A", *a), ("B", *b)) for a, b in product(intervals, repeat=2)]
    windows = tuple(combinations(range(4), 2))
    family_ok = True
    cases = cells = 0
    for history in profiles:
        for window in windows:
            actual = account_window(history, window)
            expected = cell_oracle(history, window)
            expanded = [s["active"] for s in actual["segments"]
                        for _ in range(s["start_ms"], s["end_ms"])]
            same = (expanded == expected["counts"] and
                    actual["clipped_residence_ms"] == expected["per_ID"] and
                    actual["area_call_ms"] == expected["area"] and
                    actual["arrival_cohort_IDs"] == expected["cohort"] and
                    actual["arrival_cohort_full_sum_call_ms"] == expected["full"] and
                    actual["carry_in_call_ms"] == expected["carry"] and
                    actual["arrival_right_tail_call_ms"] == expected["tail"] and
                    actual["mean_concurrency_calls"] == F(expected["area"], len(expected["counts"])))
            family_ok = family_ok and same
            cases += 1
            cells += len(expected["counts"])
    checks["all_tiny_history_window_cases_match_independent_cell_oracle_ONEgroup"] = (
        family_ok and len(profiles) == 111 and len(windows) == 6 and cases == 666)
    checks["adjacent_observation_windows_add_areas_without_double_counting"] = (
        account_window(crossing_rows, (0, 2))["area_call_ms"] == 3 and
        account_window(crossing_rows, (2, 5))["area_call_ms"] == 4 and
        3 + 4 == crossing["area_call_ms"])
    translated = account_window(tuple((i, a + 7, d + 7) for i, a, d in crossing_rows), (7, 12))
    shifted_segments = [dict(s, start_ms=s["start_ms"] - 7,
                             end_ms=s["end_ms"] - 7) for s in translated["segments"]]
    checks["common_time_origin_translation_preserves_accounting"] = (
        shifted_segments == crossing["segments"] and
        {k: v for k, v in translated.items() if k not in ("window_ms", "segments")}
        == {k: v for k, v in crossing.items() if k not in ("window_ms", "segments")})
    scaled = account_window(tuple((i, 2 * a, 2 * d) for i, a, d in crossing_rows), (0, 10))
    checks["time_unit_rescale_changes_area_rate_duration_but_not_concurrency"] = (
        scaled["area_call_ms"] == 14 and
        scaled["arrival_rate_calls_per_ms"] == crossing["arrival_rate_calls_per_ms"] / 2 and
        scaled["arrival_cohort_mean_full_ms"] == 2 * crossing["arrival_cohort_mean_full_ms"] and
        scaled["carry_in_call_ms"] == 6 and scaled["arrival_right_tail_call_ms"] == 8 and
        scaled["mean_concurrency_calls"] == crossing["mean_concurrency_calls"])
    checks["row_order_does_not_change_ID_canonical_results"] = all(
        account_window(tuple(order), (0, 5)) == crossing for order in permutations(crossing_rows))

    class IntegerChild(int):
        pass

    class StringChild(str):
        pass

    bad_histories = [None, [], {}, "A", (("A", 0),), (["A", 0, 1],),
                     (("", 0, 1),), ((" A", 0, 1),), (("A" * 9, 0, 1),),
                     (("1A", 0, 1),), (("A-", 0, 1),), ((StringChild("A"), 0, 1),),
                     (("A", 0, 1), ("A", 1, 2)), (("A", 0, 1),) * 9,
                     (("A", True, 1),), (("A", 0, False),), (("A", 0.0, 1),),
                     (("A", IntegerChild(0), 1),), (("A", -17, 1),),
                     (("A", 0, 33),), (("A", 1, 1),), (("A", 2, 1),),
                     (("A", 0, 1), ("B", 3, None))]
    bad_windows = [None, [], (0,), (0, 1, 2), (0, 0), (2, 1), (-17, 1),
                   (0, 33), (False, 1), (0, 1.0), (IntegerChild(0), 1)]
    touched = []

    def lazy_source():
        touched.append(True)
        yield ("A", 0, 1)

    generator = lazy_source()
    strict_ok = (all(rejected(h, (0, 5)) for h in bad_histories) and
                 all(rejected((), w) for w in bad_windows) and
                 rejected(generator, (0, 5)) and not touched)
    checks["strict_types_shapes_bounds_IDs_late_invalids_and_unconsumed_generator"] = strict_ok
    bounds = account_window(tuple(("A" + str(i), -16, 32) for i in range(8)), (-16, 32))
    checks["eight_records_and_closed_timestamp_bounds_are_accepted_exactly"] = (
        bounds["area_call_ms"] == 384 and bounds["mean_concurrency_calls"] == 8 and
        bounds["arrival_cohort_mean_full_ms"] == 48 and
        bounds["arrival_rate_calls_per_ms"] == F(1, 6))
    mutable = account_window(crossing_rows, (0, 5))
    mutable["segments"][0]["active"] = 999
    mutable["clipped_residence_ms"]["A"] = 999
    checks["fresh_result_mappings_do_not_mutate_inputs_or_later_results"] = (
        crossing_rows == (("A", -2, 3), ("B", 1, 4), ("C", 4, 9)) and
        account_window(crossing_rows, (0, 5)) == crossing)
    sample_mean = F(sum(s["active"] for s in crossing["segments"]), len(crossing["segments"]))
    checks["time_weighted_mean_is_not_unweighted_mean_of_event_interval_counts"] = (
        sample_mean == F(5, 4) and sample_mean != crossing["mean_concurrency_calls"])
    assert len(checks) == 14 and all(type(v) is bool and v for v in checks.values()), checks
    return {"python_version": platform.python_version(), "dependencies": "Python standard library only",
            "scope": "Supplied complete synthetic residence intervals; no admission, queue, real calls, stationary inference, capacity sizing or benchmark",
            "units": {"timestamps": "relative integer milliseconds", "area": "call milliseconds",
                      "rate": "calls per millisecond", "mean_duration": "milliseconds",
                      "mean_concurrency": "calls; a dimensionless count"},
            "rational_JSON_policy": "Exact Fraction values are strings; undefined cohort means/products are null, not zero or NaN",
            "closed_cohort_hand": closed, "cross_boundary_hand": crossing,
            "positive_occupancy_without_arrivals": no_arrivals,
            "unweighted_event_interval_sample_mean_calls": sample_mean,
            "independent_family": {"profiles": len(profiles), "windows": len(windows),
                                   "cases_inside_ONEgroup": cases, "unit_cell_observations": cells},
            "invalid_fixtures_inside_ONEgroup": len(bad_histories) + len(bad_windows) + 1,
            "checks": checks, "unique_executed_checks": len(checks), "all_passed": all(checks.values())}


if __name__ == "__main__":
    encoded = json.dumps(self_check(), ensure_ascii=True, indent=2,
                         allow_nan=False, default=json_exact).encode("utf-8") + b"\n"
    sys.stdout.buffer.write(encoded)
{
  "python_version": "3.14.5",
  "dependencies": "Python standard library only",
  "scope": "Supplied complete synthetic residence intervals; no admission, queue, real calls, stationary inference, capacity sizing or benchmark",
  "units": {
    "timestamps": "relative integer milliseconds",
    "area": "call milliseconds",
    "rate": "calls per millisecond",
    "mean_duration": "milliseconds",
    "mean_concurrency": "calls; a dimensionless count"
  },
  "rational_JSON_policy": "Exact Fraction values are strings; undefined cohort means/products are null, not zero or NaN",
  "closed_cohort_hand": {
    "window_ms": [
      0,
      10
    ],
    "window_length_ms": 10,
    "segments": [
      {
        "start_ms": 0,
        "end_ms": 2,
        "active": 1
      },
      {
        "start_ms": 2,
        "end_ms": 4,
        "active": 2
      },
      {
        "start_ms": 4,
        "end_ms": 6,
        "active": 1
      },
      {
        "start_ms": 6,
        "end_ms": 8,
        "active": 2
      },
      {
        "start_ms": 8,
        "end_ms": 10,
        "active": 1
      }
    ],
    "clipped_residence_ms": {
      "A": 4,
      "B": 6,
      "C": 4
    },
    "area_call_ms": 14,
    "mean_concurrency_calls": "7/5",
    "arrival_cohort_IDs": [
      "A",
      "B",
      "C"
    ],
    "arrival_rate_calls_per_ms": "3/10",
    "arrival_cohort_full_sum_call_ms": 14,
    "arrival_cohort_mean_full_ms": "14/3",
    "arrival_rate_times_mean_full_calls": "7/5",
    "carry_in_call_ms": 0,
    "arrival_right_tail_call_ms": 0,
    "boundary_correction_call_ms": 0
  },
  "cross_boundary_hand": {
    "window_ms": [
      0,
      5
    ],
    "window_length_ms": 5,
    "segments": [
      {
        "start_ms": 0,
        "end_ms": 1,
        "active": 1
      },
      {
        "start_ms": 1,
        "end_ms": 3,
        "active": 2
      },
      {
        "start_ms": 3,
        "end_ms": 4,
        "active": 1
      },
      {
        "start_ms": 4,
        "end_ms": 5,
        "active": 1
      }
    ],
    "clipped_residence_ms": {
      "A": 3,
      "B": 3,
      "C": 1
    },
    "area_call_ms": 7,
    "mean_concurrency_calls": "7/5",
    "arrival_cohort_IDs": [
      "B",
      "C"
    ],
    "arrival_rate_calls_per_ms": "2/5",
    "arrival_cohort_full_sum_call_ms": 8,
    "arrival_cohort_mean_full_ms": "4",
    "arrival_rate_times_mean_full_calls": "8/5",
    "carry_in_call_ms": 3,
    "arrival_right_tail_call_ms": 4,
    "boundary_correction_call_ms": -1
  },
  "positive_occupancy_without_arrivals": {
    "window_ms": [
      0,
      5
    ],
    "window_length_ms": 5,
    "segments": [
      {
        "start_ms": 0,
        "end_ms": 5,
        "active": 1
      }
    ],
    "clipped_residence_ms": {
      "A": 5
    },
    "area_call_ms": 5,
    "mean_concurrency_calls": "1",
    "arrival_cohort_IDs": [],
    "arrival_rate_calls_per_ms": "0",
    "arrival_cohort_full_sum_call_ms": 0,
    "arrival_cohort_mean_full_ms": null,
    "arrival_rate_times_mean_full_calls": null,
    "carry_in_call_ms": 5,
    "arrival_right_tail_call_ms": 0,
    "boundary_correction_call_ms": 5
  },
  "unweighted_event_interval_sample_mean_calls": "5/4",
  "independent_family": {
    "profiles": 111,
    "windows": 6,
    "cases_inside_ONEgroup": 666,
    "unit_cell_observations": 1110
  },
  "invalid_fixtures_inside_ONEgroup": 35,
  "checks": {
    "closed_cohort_hand_area_fourteen_and_matching_product": true,
    "cross_boundary_hand_seven_equals_eight_plus_three_minus_four": true,
    "positive_carry_in_without_arrivals_has_undefined_cohort_mean": true,
    "empty_or_nonoverlapping_histories_have_zero_area_and_idle_span": true,
    "half_open_window_cohort_and_equal_departure_arrival_boundary": true,
    "all_tiny_history_window_cases_match_independent_cell_oracle_ONEgroup": true,
    "adjacent_observation_windows_add_areas_without_double_counting": true,
    "common_time_origin_translation_preserves_accounting": true,
    "time_unit_rescale_changes_area_rate_duration_but_not_concurrency": true,
    "row_order_does_not_change_ID_canonical_results": true,
    "strict_types_shapes_bounds_IDs_late_invalids_and_unconsumed_generator": true,
    "eight_records_and_closed_timestamp_bounds_are_accepted_exactly": true,
    "fresh_result_mappings_do_not_mutate_inputs_or_later_results": true,
    "time_weighted_mean_is_not_unweighted_mean_of_event_interval_counts": true
  },
  "unique_executed_checks": 14,
  "all_passed": true
}

۵. از هویتِ محدود، ظرفیتِ واقعی نتیجه نگیریم

مدلِ رومیزیِ محدود در پیش‌زمینه و شبکهٔ واقعیِ خارج از قاب در دوردست جدا دیده می‌شوند
تصویر مفهومی: مدلِ رومیزیِ محدود در پیش‌زمینه و شبکهٔ واقعیِ خارج از قاب در دوردست جدا دیده می‌شوند؛ بدون مقیاس عددی و مستقل از نتایج اجرای کد.

تمرینِ یک و پاسخ: برای مثالِ عبوری، میانگینِ درست و علتِ اختلاف چیست؟ سهم‌های ۳، ۳ و ۱، مساحتِ ۷ را می‌دهند؛ تقسیم بر پنج، ۷/۵ است. نرخِ ۲/۵ مربوط به B و C است و مدتِ کاملِ آن‌ها میانگینِ چهار دارد. حاصلِ ۸/۵ باید با سهمِ مرزیِ خالصِ منفیِ یک، تقسیم بر پنج، تصحیح شود.

تمرینِ دو و پاسخ: اگر فقط A از منفیِ دو تا نه حاضر باشد، در پنجرهٔ صفر تا پنج چه می‌شود؟ مساحت پنج و میانگین یک است، اما ورودِ داخلِ پنجره نداریم. نرخ صفر است؛ میانگینِ مدتِ گروهِ خالی و حاصل‌ضربِ وابسته به آن تعریف نشده‌اند و null می‌مانند. جایگزینیِ دلخواهِ صفر، حضورِ واقعیِ پنجره را پنهان می‌کند.

تمرینِ سه و پاسخ: چه وقت مثالِ بسته برابریِ محدود را می‌دهد؟ وقتی همهٔ حضورهای مؤثر از داخلِ پنجره وارد و تا لبهٔ راست خارج شده باشند، هر دو سهمِ مرزی صفر است. برای سه حضورِ مثال، ۳/۱۰ ضرب‌در ۱۴/۳ همان ۷/۵ می‌شود. این برابریِ حسابی، جایگزینِ فرض‌های قضیهٔ بلندمدت نیست؛ با مرزهای غیرصفر نیز ممکن است تصحیحِ خالص اتفاقاً صفر شود.

تمرینِ چهار و پاسخ: اگر همهٔ زمان‌ها دو برابر شوند، چه چیز ثابت می‌ماند؟ مساحت و مدت‌ها دو برابر، نرخِ ورود نصف و میانگینِ هم‌زمانی ثابت می‌شود؛ حاصل‌ضرب از نظرِ واحد همچنان تعدادِ تماس است. هیچ‌یک از این نسبت‌ها به‌تنهایی تعدادِ کانالِ لازم، احتمالِ ازدحام یا زمانِ پاسخ را تعیین نمی‌کند؛ برای آن سؤال‌ها تعریفِ خدمت، توزیعِ بار و شواهدِ سامانه لازم است.

منابع در ۲۹ مهر ۱۴۰۵ خوانده شده‌اند؛ یادداشتِ MIT متعلق به درسِ بهارِ ۲۰۱۱ است و تاریخِ نخستین انتشارِ دقیقِ این دو صفحه معلوم ثبت نشده است. این متن آموزشِ مبتنی بر منابعِ پایه است. نتیجهٔ قابل‌استفاده‌اش، یک حسابِ مرزیِ روشن است: پیش از مقایسهٔ نرخ، مدت و هم‌زمانی، مشخص کنیم هر عدد کدام گروه و کدام پنجره را توصیف می‌کند.

منابع و مطالعهٔ بیشتر

بررسی منابع: ۲۹ مهر ۱۴۰۵. تحلیل‌ها و پیشنهادهای اجرایی، جمع‌بندی نویسنده‌اند.