关于「协同层:只做转交的中转层越高效,所有请求越慢」,《入口加法与协同层的均衡代价》给出的定量结论是什么?

结论:第五章显示只做转交的协同层把请求周期从 8.623 天拉长到 10.957 天,而且越高效越糟,自带处理能力的协同层却最好。

数据口径:书中参数为示意;全部计算由书中程序生成;本书是非个人化经营建议,任何删入口、撤协同层的生产变更须由主事者人工复核放行。 书中以标注框区分已发表的证据、可运行的 Python 计算(21 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 10.957, 8.623

20 requests a week: days on each route at equilibrium
route before after
review -> build8.623 10.957
build -> sign-off8.623 10.957
review -> layer -> sign-off -10.957
average8.623 10.957 (+27.1%)
load on the two single-person steps (tens of requests a week)
owner review1.200 -> 1.772
sign-off0.800 -> 1.692
best possible routing with the layer8.437 days
查看完整验算程序
# Chapter 5. p51: a coordination layer between the owner's review and
# the quality sign-off. Each request picks the route that is quickest
# for itself (Wardrop). Before: review -> build, or build -> sign-off.
# After: a shared layer lets a reviewed request go straight to sign-off,
# so it now queues at both single-person steps. Frank-Wolfe, BPR waits,
# 20 requests a week (demand 2.0 in tens). All values illustrative.
import heapq
import math

# (from, to, free days, capacity in tens of requests a week)
ORG = [("R", "A", 2.0, 1.0),     # owner review, one person
       ("A", "T", 6.0, 9.0),     # build and self-check, team A
       ("R", "E", 6.0, 9.0),     # build first, team E
       ("E", "B", 0.5, 9.0),     # hand to quality lead
       ("B", "T", 2.0, 1.0)]     # quality sign-off, one person
LAYER = [("A", "H", 0.5, 9.0),   # owner posts to the shared layer
         ("H", "B", 1.0, 2.0)]   # layer routes to quality sign-off


def cost(link, x):
    # BPR wait: free time * (1 + 0.15 (load / capacity)^4)
    return link[2] * (1.0 + 0.15 * (x / link[3]) ** 4)


def mcost(link, x):
    # marginal social cost: wait + load * d(wait)/d(load)
    return link[2] * (1.0 + 0.75 * (x / link[3]) ** 4)


def shortest(links, times, s, t):
    adj = {}
    for k, link in enumerate(links):
        adj.setdefault(link[0], []).append((link[1], k))
    dist, back, heap = {s: 0.0}, {}, [(0.0, s)]
    while heap:
        du, u = heapq.heappop(heap)
        if du > dist.get(u, math.inf):
            continue
        for v, k in adj.get(u, []):
            nd = du + times[k]
            if nd < dist.get(v, math.inf) - 1e-12:
                dist[v], back[v] = nd, k
                heapq.heappush(heap, (nd, v))
    path, node = [], t
    while node != s:
        k = back[node]
        path.append(k)
        node = links[k][0]
    return dist[t], path


def frank_wolfe(links, d, iters=300, f=cost, s="R", t="T"):
    def aon(x):
        times = [f(lk, xe) for lk, xe in zip(links, x)]
        c, path = shortest(links, times, s, t)
        y = [0.0] * len(links)
        for k in path:
            y[k] = d
        return y
    x = aon([0.0] * len(links))
    for _ in range(iters):
        y = aon(x)

        def slope(a):
            return math.fsum((ye - xe) * f(lk, xe + a * (ye - xe))
                             for lk, xe, ye in zip(links, x, y))
        if slope(1.0) <= 0:
            a = 1.0
        else:
            lo, hi = 0.0, 1.0
            for _ in range(60):
                mid = (lo + hi) / 2
                if slope(mid) > 0:
                    hi = mid
                else:
                    lo = mid
            a = (lo + hi) / 2
        x = [xe + a * (ye - xe) for xe, ye in zip(x, y)]
    return x


def average(links, x, d):
    return math.fsum(xe * cost(lk, xe) for lk, xe in zip(links, x)) / d


ROUTES = [("review -> build", [0, 1]),
          ("build -> sign-off", [2, 3, 4]),
          ("review -> layer -> sign-off", [0, 5, 6, 4])]
NET = ORG + LAYER
d = 2.0
x0 = frank_wolfe(ORG, d)
x1 = frank_wolfe(NET, d)
print("20 requests a week: days on each route at equilibrium")
print("  route                         before    after")
for name, ks in ROUTES:
    b = math.fsum(cost(NET[k], x1[k]) for k in ks)
    if max(ks) < len(ORG):
        a = "%7.3f" % math.fsum(cost(ORG[k], x0[k]) for k in ks)
    else:
        a = "      -"
    print("  %-28s  %s  %7.3f" % (name, a, b))
a0, a1 = average(ORG, x0, d), average(NET, x1, d)
print("  average                       %7.3f  %7.3f  (%+.1f%%)"
      % (a0, a1, 100 * (a1 / a0 - 1)))
print()
print("load on the two single-person steps (tens of requests a week)")
print("  owner review   %.3f -> %.3f" % (x0[0], x1[0]))
print("  sign-off       %.3f -> %.3f" % (x0[4], x1[4]))
s1 = average(NET, frank_wolfe(NET, d, f=mcost), d)
print("best possible routing with the layer: %.3f days" % s1)

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《布雷斯悖论瓦德罗普均衡、购买入口加法反效与协同层级的无秩序代价母典》第 5 章「协同层:只做转交的中转层越高效,所有请求越慢」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-246 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026246,
  author    = {Fan, Yafu},
  title     = {Braess's Paradox and Wardrop Equilibrium: When One More Purchase Entry or One More Coordination Layer Slows Everyone Down},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论