关于「定时订单:区间划分与加权区间调度」,《空间租赁收益管理与档期装箱》给出的定量结论是什么?
结论:第五章用区间划分与加权区间调度处理定时订单:先到先得每天比事后最优少收 999.95 元。
数据口径:书中的棚日、价格、需求与到达概率均为示意;全部计算由书中程序生成;本书是非个人化经营建议,所有价格明码标价,稀缺提示只来自真实档期,小工具给出的价格表须经营者人工复核后发布。 第一章在一个 20 个棚日的示意月份里,用精确期望算出保护 10 个棚日可使月收入从 47323.9 元升到 57432.1 元,多 21.36 %,但模拟显示保护在 0.1900 的月份里少收钱。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 999.95
| worked day, arrival order | 9-12 15-19 13-16 9-21 11-13 14-16 15-19 |
| FCFS | 9-12 15-19 = 3150 yuan |
| optimum 9-21 | 4800 yuan |
| 3000 days: mean FCFS shortfall 999.95 yuan a day (sd 970.6) | |
| days where FCFS turned the full-day shoot away | 0.4110 |
| orphan hours a day: FCFS 0.693, optimum 0.435 |
查看完整验算程序
# Chapter 5. p52: one studio day, fixed-time requests, FCFS vs optimum.
# Short requests (2 to 6 hours, 450 yuan an hour) and, on half of the
# days, one full-day shoot 9-21 at 4800 yuan arrive in random order.
# FCFS takes each request that fits. The hindsight optimum is weighted
# interval scheduling: sort by end, p(i) = last request ending by the
# start of i, OPT(i) = max(OPT(i-1), w_i + OPT(p(i))). Idle gaps shorter
# than the 2-hour minimum are counted as orphan hours. Parameters 示意.
import bisect
import math
import random
import statistics
RATE, F_DAY, OPEN, CLOSE, MIN_LEN = 450, 4800, 9, 21, 2
rng = random.Random(20261113)
def draw_day():
reqs = []
for _ in range(rng.randrange(3, 8)):
ln = rng.choice((2, 2, 3, 4, 4, 6))
st = rng.randrange(OPEN, CLOSE - ln + 1)
reqs.append((st, st + ln, RATE * ln))
if rng.random() < 0.5:
reqs.insert(rng.randrange(len(reqs) + 1), (OPEN, CLOSE, F_DAY))
return reqs
def fcfs(reqs):
got = []
for s, e, w in reqs:
if all(e <= a or s >= b for a, b, _ in got):
got.append((s, e, w))
return got
def best(reqs):
r = sorted(reqs, key=lambda t: t[1])
ends = [t[1] for t in r]
opt, pick = [0], [[]]
for i, (s, e, w) in enumerate(r):
k = bisect.bisect_right(ends, s, 0, i)
if w + opt[k] > opt[i]:
opt.append(w + opt[k])
pick.append(pick[k] + [(s, e, w)])
else:
opt.append(opt[i])
pick.append(pick[i])
return pick[-1]
def orphan_hours(got):
cuts = sorted([(OPEN, OPEN)] + [(s, e) for s, e, _ in got]
+ [(CLOSE, CLOSE)])
gaps = [b[0] - a[1] for a, b in zip(cuts, cuts[1:])]
return math.fsum(g for g in gaps if 0 < g < MIN_LEN)
def show(tag, got):
total = int(math.fsum(w for _, _, w in got))
print(" %-7s %s = %d yuan" % (tag, " ".join(
"%d-%d" % (s, e) for s, e, _ in sorted(got)), total))
ex = draw_day()
while len(ex) < 6 or F_DAY not in [w for _, _, w in ex] or \
math.fsum(w for *_, w in fcfs(ex)) >= F_DAY:
ex = draw_day()
print("worked day, arrival order: " + " ".join(
"%d-%d" % (s, e) for s, e, _ in ex))
show("FCFS", fcfs(ex))
show("optimum", best(ex))
gap, orf, orb, lost = [], [], [], 0
for _ in range(3000):
d = draw_day()
a, b = fcfs(d), best(d)
va = math.fsum(w for *_, w in a)
vb = math.fsum(w for *_, w in b)
gap.append(vb - va)
orf.append(orphan_hours(a))
orb.append(orphan_hours(b))
had = F_DAY in [w for *_, w in d]
lost += had and F_DAY not in [w for *_, w in a] # step: count
print("3000 days: mean FCFS shortfall %.2f yuan a day (sd %.1f)"
% (statistics.fmean(gap), statistics.stdev(gap)))
print("days where FCFS turned the full-day shoot away: %.4f" % (lost / 3000))
print("orphan hours a day: FCFS %.3f, optimum %.3f"
% (statistics.fmean(orf), statistics.fmean(orb)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《空间租赁动态收益管理与档期装箱、舱位控制嵌套保护水平与碎片空置消除母典》第 5 章「定时订单:区间划分与加权区间调度」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-282 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026282,
author = {Fan, Yafu},
title = {Dynamic Revenue Management and Slot Packing for Space Rentals: Nested Protection Levels and the Elimination of Fragmented Idle Time},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}