What does Routing Periodic Quotas conclude, in numbers, about “Routing across Models: Complexity Classes, Label Errors and Cascades”?
Answer: Chapter 4 treats changing quotas, misjudged complexity and cascades; a cascade raises the optimum from 893.00 to 944.65 points.
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 onlyprinted values that match the answer: 893.00, 944.65
| class | option | points/task | H units | F units |
|---|---|---|---|---|
| routine | H | 0.9700 | 4.000 | 0 |
| routine | F | 0.9500 | 0.000 | 1 |
| routine | C | 0.9859 | 0.540 | 1 |
| standard | H | 1.9000 | 6.000 | 0 |
| standard | F | 1.6000 | 0.000 | 2 |
| standard | C | 1.8960 | 1.440 | 2 |
| complex | H | 4.5000 | 10.000 | 0 |
| complex | F | 2.2500 | 0.000 | 3 |
| complex | C | 4.2075 | 4.850 | 3 |
| critical | H | 8.5000 | 16.000 | 0 |
| critical | F | 1.5000 | 0.000 | 4 |
| critical | C | 7.2575 | 11.120 | 4 |
| columns HF | optimum | 893.00 | y_H 0.2250 | |
| F0:300.00 F1:150.00 F2:32.00 H2:28.00 H3:20.00 | ||||
| columns HFC optimum | 944.65 | y_H 0.2546 | ||
| C2:60.00 C3:2.25 F0:300.00 F1:150.00 H3:17.75 |
Show the full program
# Chapter 4. p43: a cascade as a third column of the routing programme.
# Model: besides "H" and "F", a task may take the cascade "C": run F,
# let a checker judge the answer, and escalate to H only when flagged.
# The checker flags a wrong F answer with probability d = 0.8 and a
# right one with probability f = 0.1 (illustrative). Per task of
# class k: P(flag) = (1 - qF) d + qF f,
# success = qF (1 - f) + P(flag) qH,
# F units = cost_F, H units = P(flag) cost_H.
# The LP chooses H, F or C per class under quotas H 600, F 900, on the
# demand (300, 150, 60, 20) of p21. Units illustrative.
from fractions import Fraction as Fr
def simplex(c, A, b, rule="bland", cap=500):
m, n = len(A), len(c)
T = [[Fr(v) for v in A[i]] + [Fr(int(i == j)) for j in range(m)]
+ [Fr(b[i])] for i in range(m)]
z = [-Fr(v) for v in c] + [Fr(0)] * (m + 1)
basis = [n + i for i in range(m)]
steps = 0
while steps < cap:
cols = [j for j in range(n + m) if z[j] < 0]
if not cols:
break
if rule == "bland":
e = cols[0]
else:
e = min(cols, key=lambda j: (z[j], j))
rows = [i for i in range(m) if T[i][e] > 0]
if not rows:
return None
r = min(rows, key=lambda i: (T[i][-1] / T[i][e], basis[i]))
p = T[r][e]
T[r] = [v / p for v in T[r]]
for i in range(m):
if i != r and T[i][e] != 0:
f = T[i][e]
T[i] = [a - f * w for a, w in zip(T[i], T[r])]
f = z[e]
z = [a - f * w for a, w in zip(z, T[r])]
basis[r] = e
steps += 1
x = [Fr(0)] * (n + m)
for i, j in enumerate(basis):
x[j] = T[i][-1]
return x[:n], z[-1], z[n:n + m], steps
VALUE = (1, 2, 5, 10)
COST = {"H": (4, 6, 10, 16), "F": (1, 2, 3, 4)}
SUCC = {"H": ("0.97", "0.95", "0.90", "0.85"),
"F": ("0.95", "0.80", "0.45", "0.15")}
DEM = (300, 150, 60, 20)
NAMES = ("routine", "standard", "complex", "critical")
D_HIT, F_ALARM = Fr("0.8"), Fr("0.1")
def options(k):
qh, qf = Fr(SUCC["H"][k]), Fr(SUCC["F"][k])
flag = (1 - qf) * D_HIT + qf * F_ALARM
succ = qf * (1 - F_ALARM) + flag * qh
return {"H": (VALUE[k] * qh, COST["H"][k], 0),
"F": (VALUE[k] * qf, 0, COST["F"][k]),
"C": (VALUE[k] * succ, flag * COST["H"][k], COST["F"][k])}
def solve(cols, qh=600, qf=900):
var = [(t, k) for t in cols for k in range(4)]
c = [options(k)[t][0] for t, k in var]
A = [[options(k)[t][1] for t, k in var],
[options(k)[t][2] for t, k in var]]
b = [qh, qf]
for j in range(4):
A.append([int(k == j) for t, k in var])
b.append(DEM[j])
x, val, y, _ = simplex(c, A, b)
return val, dict(zip(var, x)), y[0]
print("class option points/task H units F units")
for k in range(4):
for t in "HFC":
v, h, f = options(k)[t]
print("%-8s %6s %11.4f %7.3f %7d" % (NAMES[k], t, float(v),
float(h), f))
for cols in ("HF", "HFC"):
val, x, yh = solve(cols)
alloc = " ".join("%s:%.2f" % (t + str(k), float(x[(t, k)]))
for t, k in sorted(x) if x[(t, k)] > 0)
print("columns %-3s optimum %7.2f y_H %6.4f" % (cols, float(val),
float(yh)))
print(" " + alloc)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 4: Routing across Models: Complexity Classes, Label Errors and Cascades. 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 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 7 · Eastern and Western Classics: Gathering and Releasing in the Guanzi, and Kantorovich's Resolving Multipliers
- Chapter 8 · A Daily Task Routing Table: the Empirical Loop, the Distilled Tool and a Pre-registered Test