关于「新品备货的报童模型:最大熵分位数订货与最坏后悔」,《最大熵需求重建》给出的定量结论是什么?

结论:第六章把最大熵分位数放进新品报童模型,薄利品类中正态捷径的最坏后悔比例可达 1.018。

数据口径:本书推翻这一常识:正态捷径私加了对称形状与标准差,示意参数下均值 80、下限 30 时它把 0.133 的概率放在不可能的区间,均值 40 时升到 0.412;均匀捷径隐含均值在区间中点,直接违背已知均值。 只承认上下限与均值时,杰恩斯 1957 年提出的最大熵原则给出截断指数分布,示意甜品店的第 90 百分位客单为 146.0 元。

English version

对照数据表

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

cost ratio | worst regret share: max-ent normal uniform
140.882 |0.0660.1360.223
200.765 |0.0080.0100.509
250.667 |0.1400.1840.834
330.510 |0.2530.6332.294
410.353 |0.1241.0184.003
470.235 |0.2410.8554.808
查看完整验算程序
# Chapter 6. p62: worst-case regret across margins.
# Model: the newsvendor of p61 (demand in [0, 600], mean 150, price 59,
# clearance value 8, illustrative) with the unit cost varied, which
# moves the critical ratio. For each ratio and each assumed shape we
# take the regret under each of the four true shapes of p61 as a share
# of the best profit attainable under that truth, and report the
# largest share. Integrals by Simpson rule with math.fsum.
import math
from statistics import NormalDist

A, B, M = 0.0, 600.0, 150.0
L = B - A
FR = (M - A) / L
F2 = (FR - 0.75 * 0.1) / 0.25
MIX = ((0.75, 4.0, 36.0), (0.25, 8.0, 8.0 * (1 - F2) / F2))


def simpson(f, lo, hi, n=2000):
    h = (hi - lo) / n
    terms = [f(lo), f(hi)]
    terms += [4.0 * f(lo + i * h) for i in range(1, n, 2)]
    terms += [2.0 * f(lo + i * h) for i in range(2, n, 2)]
    return math.fsum(terms) * h / 3.0


def integ(f, n=2000, hi=B):
    # x = A + v * v removes the kink of densities that start at A
    g = lambda v: f(A + v * v) * 2.0 * v
    return simpson(g, 0.0, math.sqrt(hi - A), n)


def te_mean(lam):
    u = lam * L
    if abs(u) < 1e-8:
        return A + L / 2.0
    return A + 1.0 / lam - L / math.expm1(u)


def solve(m):
    lo, hi = -2.0, 2.0
    for _ in range(80):
        mid = (lo + hi) / 2.0
        if te_mean(mid) > m:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2.0


def te_pdf(lam):
    return lambda x: lam * math.exp(-lam * (x - A)) / -math.expm1(-lam * L)


def te_q(lam, p):
    return A - math.log1p(p * math.expm1(-lam * L)) / lam


def beta_pdf(u, al, be):
    if u <= 0.0 or u >= 1.0:
        return 0.0
    lg = math.lgamma(al + be) - math.lgamma(al) - math.lgamma(be)
    return math.exp(lg + (al - 1) * math.log(u) + (be - 1) * math.log1p(-u))


def beta_x(al, be):
    return lambda x: beta_pdf((x - A) / L, al, be) / L


def mix_pdf(x):
    return math.fsum(w * beta_x(a, b)(x) for w, a, b in MIX)


def truths():
    lam = solve(M)
    return [("max-ent", te_pdf(lam)),
            ("b(2,6)", beta_x(2.0, 6.0)),
            ("b(1.2,3.6)", beta_x(1.2, 3.6)),
            ("hit-or-flop", mix_pdf)]


def quantile(f, p):
    lo, hi = A, B
    for _ in range(40):
        mid = (lo + hi) / 2.0
        if integ(f, 400, mid) < p:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2.0


def profit(f, q, price, cost, salvage):
    # expected profit of ordering q units when demand has density f
    sold = integ(lambda x: x * f(x), 800, q) + q * (1.0 - integ(f, 800, q))
    return (price - salvage) * sold - (cost - salvage) * q


if __name__ == "__main__":
    price, salv = 59.0, 8.0
    lam = solve(M)
    nd = NormalDist(M, L / 6.0)
    ts = truths()
    print("  cost  ratio |  worst regret share:  max-ent  normal  uniform")
    for cost in (14.0, 20.0, 25.0, 33.0, 41.0, 47.0):
        cr = (price - cost) / (price - salv)
        best = [quantile(t, cr) for _, t in ts]
        bestp = [profit(t, q, price, cost, salv)
                 for (_, t), q in zip(ts, best)]
        out = []
        for q in (te_q(lam, cr), max(0.0, nd.inv_cdf(cr)), A + cr * L):
            shares = [(bp - profit(t, q, price, cost, salv)) / bp
                      for bp, (_, t) in zip(bestp, ts)]
            out.append(max(shares))
        print("  {:>4.0f}  {:>5.3f} | {:>29.3f}  {:>6.3f}  {:>7.3f}".format(
            cost, cr, *out))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《最大熵原理与缺数据需求重建、仅知均价与上下限时最不偏的客单分布推断母典》第 6 章「新品备货的报童模型:最大熵分位数订货与最坏后悔」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026301,
  author    = {Fan, Yafu},
  title     = {The Maximum-Entropy Principle and Demand Reconstruction from Missing Data: the Least-Biased Order-Value Distribution Given Only a Mean and Bounds},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论