What does Routing Periodic Quotas conclude, in numbers, about “Eastern and Western Classics: Gathering and Releasing in the Guanzi, and Kantorovich's Resolving Multipliers”?
Answer: Chapter 7 examines "years bring dearth and plenty, so grain is dear or cheap" from the Guanzi and Kantorovich's resolving multipliers of 1939.
Scope of the numbers: Under illustrative parameters the linear programme gains 0.1668 to 0.2217 over arrival order, but only 0.41 % to 5.05 % over a fixed rule that sorts by complexity; most of the gain comes from sorting itself. Parameters are illustrative and contain no vendor's prices or quotas; all calculations are generated by the book's programs.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python only
| draws: lean 11, normal 21, rich 8 | |||
| case | sd(use) | short/lost | wasted/idle |
| grain, granary cap 0.0 | 0.1786 | 0.1100 | 0.0800 |
| grain, granary cap 0.4 | 0.1520 | 0.0700 | 0.0400 |
| grain, granary cap 1.2 | 0.1428 | 0.0600 | 0.0100 |
| quota, backlog 0.0 s 0.0 | 0.1786 | 0.0825 | 0.1100 |
| quota, backlog 0.4 s 0.4 | 0.1520 | 0.0412 | 0.0700 |
| quota, backlog 1.2 s 0.4 | 0.1428 | 0.0103 | 0.0600 |
Show the full program
# Chapter 7. p71: the Guanzi granary next to a quota that cannot keep.
# Model, part 1 (grain): need 1.0 a year; harvests 0.6, 1.0 or 1.4
# (lean, normal, rich) with chances 1/4, 1/2, 1/4, seeded, 40 years. A
# public granary buys the surplus of rich years and sells in lean years
# ("gather when cheap, release when dear"), store capped at C.
# Part 2 (quota): capacity 1.0 a cycle that vanishes at the reset;
# demand 0.6, 1.0 or 1.4 with the same chances. The supply cannot be
# stored, but a share s of the demand can wait: a backlog capped at C
# plays the granary's part with time running the other way. Shares
# are of total need or demand. Parameters illustrative.
import math
import random
import statistics
YEARS = 40
rng = random.Random(20261113)
draws = [rng.choices((0.6, 1.0, 1.4), weights=(1, 2, 1))[0]
for _ in range(YEARS)]
def grain(cap):
stock, short, waste, eat = 0.0, [], [], []
for y in draws:
if y >= 1.0:
put = min(y - 1.0, cap - stock)
stock += put
waste.append(y - 1.0 - put)
eat.append(1.0)
short.append(0.0)
else:
out = min(1.0 - y, stock)
stock -= out
eat.append(y + out)
short.append(1.0 - y - out)
waste.append(0.0)
return eat, math.fsum(short) / YEARS, math.fsum(waste) / YEARS
def quota(cap, s):
back, lost, idle, done = 0.0, [], [], []
for d in draws:
urgent, flex = (1 - s) * d, s * d
u = min(1.0, urgent)
room = 1.0 - u
b = min(room, back)
back -= b
room -= b
f = min(room, flex)
room -= f
keep = min(flex - f, cap - back)
back += keep
lost.append(urgent - u + flex - f - keep)
idle.append(room)
done.append(u + b + f)
tot = math.fsum(draws)
return done, math.fsum(lost) / tot, math.fsum(idle) / YEARS
print("draws: lean %d, normal %d, rich %d" % (
draws.count(0.6), draws.count(1.0), draws.count(1.4)))
print("case sd(use) short/lost wasted/idle")
for cap in (0.0, 0.4, 1.2):
eat, sh, wa = grain(cap)
print("grain, granary cap %.1f %7.4f %10.4f %11.4f" % (
cap, statistics.pstdev(eat), sh, wa))
for cap, s in ((0.0, 0.0), (0.4, 0.4), (1.2, 0.4)):
done, lo, idl = quota(cap, s)
print("quota, backlog %.1f s %.1f %7.4f %10.4f %11.4f" % (
cap, s, statistics.pstdev(done), lo, idl))Single source and citation
Fan, Y. (2026). Peak-Shaving Periodic Quotas and Cross-Model Routing: Linear Programming against Reset Countdowns to Split Work between Heavy-Reasoning and Fast Models (Version 1.0.0), Chapter 7: Eastern and Western Classics: Gathering and Releasing in the Guanzi, and Kantorovich's Resolving Multipliers. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-270 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026270,
author = {Fan, Yafu},
title = {Peak-Shaving Periodic Quotas and Cross-Model Routing: Linear Programming against Reset Countdowns to Split Work between Heavy-Reasoning and Fast Models},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Price of First Come, First Served: Exhaustion before the Reset and Waste at It
- Chapter 2 · A Standard-Library Simplex: Exact Fractions, Bland's Rule and the Worst Case
- Chapter 3 · Shadow Prices and the Reset Countdown: How the Marginal Value of Quota Falls with Time
- Chapter 4 · Routing across Models: Complexity Classes, Label Errors and Cascades
- Chapter 5 · Peak Shaving and Valley Filling: Deferral, Pulling Forward and a Backlog under Short Reset Windows
- Chapter 6 · Greedy against Linear Programming: Random Arrival, Prices Learned from a Sample, and Drift
- Chapter 8 · A Daily Task Routing Table: the Empirical Loop, the Distilled Tool and a Pre-registered Test