关于「最低价的全年总账:单一远源、单一近源与双源」,《跨境双源与断供期权》给出的定量结论是什么?
结论:报价单只记到岸价,总账要记七行。在本章的示意参数下,单一远源的到岸价优势被在途库存、安全库存、断供缓冲与断供损失一行行吃掉:双源一年 1560877,比最好的单一远源方案少 8323,单一近源最贵;只算到岸价与只含需求项安全库存的天真总账,会得出相反的结论。参数地图说明,这个结论的分寸由断供长度与近源溢价决定:断供短时单一远源最省,断供平均 40 天以上时双源开始占优;固定每年的停工天数,断供越罕见越长,越应该用货源而不是库存去挡。交期方差在成本上是二阶项,在服务水平上是一阶项。
数据口径:书中的价格、交期、断供频率、毛利与产能均为示意;全部计算由书中程序生成;本书是非个人化法律、税务或理财建议;书中每一个到岸价都假定已包含如实申报后应缴的税费,不讨论任何低报、拆单规避或灰色清关手法,海关与关税规则只述大意,以上架前人工复核为准。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 1560877, 8323
| per year | far passive | far buffer | near only | dual a=0.55 |
| purchase | 1460000 | 1460000 | 1576800 | 1515440 |
| orders | 7821 | 7821 | 10429 | 18250 |
| cycle | 7000 | 7000 | 3780 | 5551 |
| transit | 16000 | 16000 | 2160 | 9772 |
| safety | 24702 | 35019 | 4093 | 9703 |
| recurrent | 3360 | 3360 | 483 | 1146 |
| outage | 51770 | 40000 | 0 | 1016 |
| TOTAL | 1570653 | 1569200 | 1597745 | 1560877 |
| stock | 988.1 | 1400.7 | 151.6 | 359.4 |
| naive far-only estimate (no sd_L, no outages): 1494448 | ||||
| dual saving against best far-only plan: 8323 per year | ||||
| saving the naive sheet shows for far-only: 66430 per year |
查看完整验算程序
# Chapter 2. p21: annual total cost, cheapest single source against dual.
# Model (per year, illustrative): purchase, fixed cost per order, cycle
# stock, in-transit capital, safety stock at the cost-optimal service
# level (lost-sales critical ratio), recurrent shortage via the normal
# loss function, and far-source outages (Poisson rate lam per year,
# exponential length mean tau days) met by an optimal buffer. The dual
# policy is tailored base-surge: the far source ships a constant share
# alpha; the near source tops up and, during outages, can raise its
# volume by the factor (1 + flex) up to cap. Dual safety stock covers
# near-loop demand noise plus far delays capped at the near protection
# interval. All parameters illustrative.
import math
from statistics import NormalDist
N01 = NormalDist()
YEAR = 365.0
# 基准参数(示意):日需求均值与标准差、年持有率、在途资金率、缺一件毛利;
# 远源到岸价、交期均值与标准差、补货周期、每票固定费;近源同;
# 远源断供年发生率与平均天数、近源产能上限与量弹性
BASE = dict(d=40.0, sd=12.0, h=0.25, i=0.10, p=120.0,
cF=100.0, LF=40.0, sLF=10.0, TF=14.0, KF=300.0,
cN=108.0, LN=5.0, sLN=1.0, TN=7.0, KN=200.0,
lam=0.5, tau=40.0, cap=60.0, flex=1.0)
def loss(z):
return N01.pdf(z) - z * (1.0 - N01.cdf(z))
def capped_m2(s_l, cap, n=400):
# E[min(delta+, cap)^2], delta ~ N(0, s_l)
if s_l <= 0.0:
return 0.0
hs = cap / n
w = [1.0 if k in (0, n) else (4.0 if k % 2 else 2.0)
for k in range(n + 1)]
f = [(k * hs) ** 2 * N01.pdf(k * hs / s_l) / s_l for k in range(n + 1)]
body = math.fsum(a * b for a, b in zip(w, f)) * hs / 3.0
return body + cap ** 2 * (1.0 - N01.cdf(cap / s_l))
def buffer(q, sp, c, t):
z = max(0.0, N01.inv_cdf(q["p"] / (q["p"] + q["h"] * c * t / YEAR)))
return z * sp, q["h"] * c * z * sp, YEAR / t * sp * loss(z) * q["p"]
def outage(q, u, ss, mitigate=True):
# 断供期缺口速率 u;缓冲 b 按 h*c = lam*p*exp(-(ss+b)/(u*tau)) 取最优
ut = u * q["tau"]
if ut <= 0.0 or q["lam"] <= 0.0:
return 0.0, 0.0
b = 0.0
if mitigate and q["lam"] * q["p"] > q["h"] * q["cF"]:
b = max(0.0, ut * math.log(q["lam"] * q["p"]
/ (q["h"] * q["cF"])) - ss)
return b, q["lam"] * q["p"] * ut * math.exp(-(ss + b) / ut)
def far_only(q, mitigate=True):
sp = math.sqrt((q["LF"] + q["TF"]) * q["sd"] ** 2
+ (q["d"] * q["sLF"]) ** 2)
ss, c_ss, c_rec = buffer(q, sp, q["cF"], q["TF"])
b, c_out = outage(q, q["d"], ss, mitigate)
return {"purchase": q["d"] * YEAR * q["cF"],
"orders": YEAR / q["TF"] * q["KF"],
"cycle": q["h"] * q["cF"] * q["d"] * q["TF"] / 2.0,
"transit": q["i"] * q["cF"] * q["d"] * q["LF"],
"safety": c_ss + q["h"] * q["cF"] * b, "recurrent": c_rec,
"outage": c_out, "stock": ss + b}
def dual(q, a):
pn = q["LN"] + q["TN"]
sp = math.sqrt(pn * q["sd"] ** 2 + (q["d"] * q["sLN"]) ** 2
+ (a * q["d"]) ** 2 * capped_m2(q["sLF"], pn))
ss, c_ss, c_rec = buffer(q, sp, q["cN"], q["TN"])
base_n = (1.0 - a) * q["d"]
# 近源断供期可供量:基量乘 (1 + 弹性),且不超过产能上限与日需求
up = min(q["cap"], base_n * (1.0 + q["flex"]), q["d"])
b, c_out = outage(q, q["d"] - up, ss)
days = q["lam"] * q["tau"]
return {"purchase": q["d"] * YEAR * (a * q["cF"] + (1 - a) * q["cN"])
+ days * (up - base_n) * (q["cN"] - q["cF"]),
"orders": (YEAR / q["TF"] * q["KF"] if a > 0 else 0.0)
+ YEAR / q["TN"] * q["KN"],
"cycle": q["h"] * q["d"] / 2.0
* (a * q["cF"] * q["TF"] + (1 - a) * q["cN"] * q["TN"]),
"transit": q["i"] * q["d"]
* (a * q["cF"] * q["LF"] + (1 - a) * q["cN"] * q["LN"]),
"safety": c_ss + q["h"] * q["cF"] * b, "recurrent": c_rec,
"outage": c_out, "stock": ss + b}
def total(r):
return math.fsum(v for k, v in sorted(r.items()) if k != "stock")
def best_dual(q, step=0.05):
grid = [k * step for k in range(int(round(1 / step)) + 1)]
return min((total(dual(q, a)), a) for a in grid)
def best_far(q):
return min(total(far_only(q, False)), total(far_only(q, True)))
# ---- end of shared model ----
q = dict(BASE)
cost_d, a_star = best_dual(q)
cases = [("far passive", far_only(q, False)),
("far buffer", far_only(q, True)),
("near only", dual(q, 0.0)),
("dual a=%.2f" % a_star, dual(q, a_star))]
keys = ["purchase", "orders", "cycle", "transit", "safety",
"recurrent", "outage"]
print("%-10s" % "per year" + "".join("%14s" % n for n, _ in cases))
for k in keys:
print("%-10s" % k + "".join("%14.0f" % r[k] for _, r in cases))
print("%-10s" % "TOTAL" + "".join("%14.0f" % total(r) for _, r in cases))
print("%-10s" % "stock" + "".join("%14.1f" % r["stock"] for _, r in cases))
z95 = N01.inv_cdf(0.95)
naive = math.fsum([q["d"] * YEAR * q["cF"], YEAR / q["TF"] * q["KF"],
q["h"] * q["cF"] * q["d"] * q["TF"] / 2.0,
q["i"] * q["cF"] * q["d"] * q["LF"],
q["h"] * q["cF"] * z95 * q["sd"]
* math.sqrt(q["LF"] + q["TF"])])
print("naive far-only estimate (no sd_L, no outages): %.0f" % naive)
print("dual saving against best far-only plan: %.0f per year"
% (best_far(q) - cost_d))
print("saving the naive sheet shows for far-only: %.0f per year"
% (cost_d - naive))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《跨境供应链双源冗余与断供实物期权、物流延误清关波动下的最优安全库存配比母典》第 2 章「最低价的全年总账:单一远源、单一近源与双源」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-291 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026291,
author = {Fan, Yafu},
title = {Dual-Source Redundancy and Supply-Disruption Real Options in Cross-Border Chains: Optimal Safety Stock and Source Splits under Shipping Delays and Customs Variability},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}