关于「从选一条线到分一份预算:批量反馈下的五种周度配额规则」,《业务线周度配额》给出的定量结论是什么?
结论:第四章比较五种周度配额规则,「领先线拿大头、指数高过领先线均值者各拿一个试投单位」的配额规则拿到理想值的 0.9042,上周规则只有 0.8370。
数据口径:核对吉廷斯 1979 年的论文与后续文献以后,本书修正了立项蓝图:吉廷斯指数的最优性只在单线经营、闲置线不变、换线无成本、几何贴现时成立,周度拆分预算、换线成本与会变的市场都在定理之外;锁死是一个概率说法,两条示意线上按累计回报全押有 0.2133 的重复在下半年完全押错,但在每单位贴现 0.9 的短视界里贪心相对指数只损失 0.0050 到 0.0166。 书中参数为示意,毛利与成本用记账点数而非价格;全部计算由书中程序生成。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.8370, 0.9042
| 4 lines ~ Beta(2, 6), 10 units/week, 26 weeks, 1000 runs | |||
| rule | disc-succ | vs-oracle | end-on-best |
| lastweek | 69.638 | 0.8370 | 0.5400 |
| greedy | 74.809 | 0.8992 | 0.7210 |
| index | 74.698 | 0.8979 | 0.7820 |
| quota | 75.222 | 0.9042 | 0.7850 |
| thompson | 72.155 | 0.8673 | 0.8280 |
| oracle | 83.196 |
查看完整验算程序
# Chapter 4. p41: five weekly quota rules for one budget split by line.
# Model: 4 lines with true unit conversion rates drawn from Beta(2, 6)
# (illustrative, mean 0.25); K = 10 budget units a week; results known
# only at week end; 26 weeks; weekly discount 0.98. Week 1 probes all
# lines (3, 3, 2, 2 units). Every rule starts from a Beta(1, 1) prior.
# lastweek : all units to the best rate of each line's latest week
# greedy : all units to the highest posterior mean
# index : all units to the highest Gittins index (beta 0.9)
# quota : one unit to each line whose index beats the leader's
# posterior mean, the rest to the highest index
# thompson : each unit goes to the argmax of a fresh posterior draw
# Gittins index by calibration (p21), depth 20 (error < 1e-4, p23).
import functools
import math
import random
N, K, W, RUNS, DISC = 4, 10, 26, 1000, 0.98
@functools.lru_cache(maxsize=None)
def gittins(a, b, beta=0.9, depth=20, tol=1e-6):
lo, hi = a / (a + b), 1.0
while hi - lo > tol:
lam = 0.5 * (lo + hi)
r = lam / (1.0 - beta)
n = a + b + depth
v = [max(r, (a + k) / n / (1.0 - beta)) for k in range(depth + 1)]
for d in range(depth - 1, -1, -1):
n = a + b + d
nv = []
for k in range(d + 1):
p = (a + k) / n
c = math.fsum((p * (1.0 + beta * v[k + 1]),
(1.0 - p) * beta * v[k]))
nv.append(c if c > r else r)
v = nv
if v[0] > r + 1e-12:
lo = lam
else:
hi = lam
return 0.5 * (lo + hi)
def top(score):
return max(range(len(score)), key=lambda j: (score[j], -j))
def quota(rule, s, f, last, rng):
q = [0] * N
mean = [(1 + s[i]) / (2 + s[i] + f[i]) for i in range(N)]
if rule == "lastweek":
q[top(last)] = K
elif rule == "greedy":
q[top(mean)] = K
elif rule in ("index", "quota"):
nu = [gittins(1 + s[i], 1 + f[i]) for i in range(N)]
lead = top(nu)
if rule == "quota":
bar = mean[top(mean)]
for i in range(N):
if i != lead and nu[i] > bar:
q[i] = 1
q[lead] = K - (q[0] + q[1] + q[2] + q[3])
else:
for _ in range(K):
d = [rng.betavariate(1 + s[i], 1 + f[i]) for i in range(N)]
q[top(d)] += 1
return q
def run(rule, p, u, rng):
s, f, last = [0] * N, [0] * N, [0.0] * N
terms = []
for w in range(W):
q = [3, 3, 2, 2] if w == 0 else quota(rule, s, f, last, rng)
got = 0
for i in range(N):
k = 0
for _ in range(q[i]):
if u[i][s[i] + f[i]] < p[i]:
s[i] += 1
k += 1
else:
f[i] += 1
if q[i]:
last[i] = k / q[i]
got += k
terms.append(got * DISC ** w)
return math.fsum(terms), q[top(p)] == max(q)
world = random.Random(20261113)
cases = []
for _ in range(RUNS):
p = [world.betavariate(2, 6) for _ in range(N)]
u = [[world.random() for _ in range(K * W)] for _ in range(N)]
cases.append((p, u))
orc = [K * max(p) * math.fsum(DISC ** w for w in range(W))
for p, _ in cases]
print("%d lines ~ Beta(2, 6), %d units/week, %d weeks, %d runs"
% (N, K, W, RUNS))
print("%-9s %10s %10s %12s" % ("rule", "disc-succ", "vs-oracle",
"end-on-best"))
for rule in ("lastweek", "greedy", "index", "quota", "thompson"):
rng = random.Random(99)
res = [run(rule, p, u, rng) for p, u in cases]
m = math.fsum(r for r, _ in res) / RUNS
ok = 0
for _, b in res:
ok += b
print("%-9s %10.3f %10.4f %12.4f" % (
rule, m, m / (math.fsum(orc) / RUNS), ok / RUNS))
print("oracle %10.3f" % (math.fsum(orc) / RUNS))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《多业务线算力与预算动态裁决、吉廷斯指数探索与收费站代购出版线周度配额母典》第 4 章「从选一条线到分一份预算:批量反馈下的五种周度配额规则」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-264 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026264,
author = {Fan, Yafu},
title = {Dynamic Allocation of Compute and Budget across Business Lines: Gittins-Index Exploration and Weekly Quotas for Tollbooth, Buying and Publishing Lines},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}