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

classoptionpoints/taskH unitsF units
routineH0.97004.0000
routineF0.95000.0001
routineC0.98590.5401
standardH1.90006.0000
standardF1.60000.0002
standardC1.89601.4402
complexH4.500010.0000
complexF2.25000.0003
complexC4.20754.8503
criticalH8.500016.0000
criticalF1.50000.0004
criticalC7.257511.1204
columns HFoptimum893.00y_H 0.2250
F0:300.00 F1:150.00 F2:32.00 H2:28.00 H3:20.00
columns HFC optimum944.65y_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