What does Revenue Management and Slot Packing for Space Rentals conclude, in numbers, about “Slot Packing: First-Fit Decreasing and Fragmented Idle Time”?

Answer: Chapter 4 packs short bookings with flexible dates into the fewest days by first-fit decreasing, adding 3401.1 yuan a week of full-day revenue.

Scope of the numbers: Chapter 1 computes exact expectations for an illustrative month of 20 studio-days: protecting 10 days lifts monthly revenue from 47323.9 yuan to 57432.1 yuan, 21.36 % more, though simulation shows that protection earns less in 0.1900 of months. Marked boxes separate published evidence, runnable Python calculations (18 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 3401.1

weeks simulated 1997 (skipped, not placeable: 3)
rulefree daysorphan daysfull-day yuangain vs preferred
preferred1.3160.3362213.70.0 +/- 0.0
first-fit3.3290.8325511.53297.7 +/- 188.8
FFD3.3920.5735614.83401.1 +/- 189.5
FFD reached the lower bound ceil(hours/12) in 0.9765 of weeks
Show the full program
# Chapter 4. p42: what packing is worth over 2000 simulated weeks.
# Each week: short flexible requests ~ Poisson(11), lengths drawn from
# {2, 2, 3, 3, 4, 4, 6} hours, each with a named preferred day; then
# full-day shoots ~ Poisson(3), each naming one specific day and paying
# 4800 yuan if that day is still wholly free (one shoot per day). Short
# revenue is the same under every rule, so only full-day revenue and
# idle hours differ. Rules as in p41. Seeded; parameters are 示意.
import math
import random
import statistics

H, DAYS, MIN_LEN, F_DAY = 12, 7, 2, 4800
LENS = (2, 2, 3, 3, 4, 4, 6)


def draw(rng, mean):
    lim, k, p = math.exp(-mean), 0, 1.0
    while True:
        p *= rng.random()
        if p < lim:
            return k
        k += 1


def place(items, start_pref):
    load = [0] * DAYS
    for h, pref in items:
        first = pref if start_pref else 0
        for k in range(DAYS):
            d = (first + k) % DAYS
            if load[d] + h <= H:
                load[d] += h  # step: integer hours
                break
        else:
            return None
    return load


rng = random.Random(20261113)
keys = ("preferred", "first-fit", "FFD")
rev = {k: [] for k in keys}
free = {k: [] for k in keys}
orph = {k: [] for k in keys}
at_bound = skipped = 0
for _ in range(2000):
    req = [(rng.choice(LENS), rng.randrange(DAYS))
           for _ in range(draw(rng, 11.0))]
    want = {rng.randrange(DAYS) for _ in range(draw(rng, 3.0))}
    loads = {"preferred": place(req, True), "first-fit": place(req, False),
             "FFD": place(sorted(req, key=lambda r: -r[0]), False)}
    if None in loads.values():
        skipped += 1
        continue
    hours = int(math.fsum(h for h, _ in req))
    used = len([x for x in loads["FFD"] if x])
    at_bound += used == math.ceil(hours / H)  # step: count
    for k in keys:
        ld = loads[k]
        free[k].append(len([x for x in ld if x == 0]))
        rev[k].append(F_DAY * len([d for d in want if ld[d] == 0]))
        orph[k].append(len([x for x in ld if 0 < H - x < MIN_LEN]))
n = 2000 - skipped
print("weeks simulated %d (skipped, not placeable: %d)" % (n, skipped))
print("rule        free days  orphan days  full-day yuan  gain vs preferred")
for k in keys:
    d = [a - b for a, b in zip(rev[k], rev["preferred"])]
    m = statistics.fmean(d)
    h = 1.96 * statistics.stdev(d) / math.sqrt(n) if any(d) else 0.0
    print("%-10s  %9.3f  %11.3f  %13.1f  %7.1f +/- %.1f"
          % (k, statistics.fmean(free[k]), statistics.fmean(orph[k]),
             statistics.fmean(rev[k]), m, h))
print("FFD reached the lower bound ceil(hours/12) in %.4f of weeks"
      % (at_bound / n))

Single source and citation

Fan, Y. (2026). Dynamic Revenue Management and Slot Packing for Space Rentals: Nested Protection Levels and the Elimination of Fragmented Idle Time (Version 1.0.0), Chapter 4: Slot Packing: First-Fit Decreasing and Fragmented Idle Time. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book