关于「影子价格与重置倒计时:配额的边际价值怎样随时间下跌」,《周期配额的路由与倒计时》给出的定量结论是什么?

结论:强对偶在第一章的问题上精确成立,H 的影子价格 9/40 只在 400 到 900 个单位之间有效,配额更少时升到 0.4375,更多时降到 0.0500。在线到达的任务把规划变成动态规划:离重置越近、余额越宽裕,一个 H 单位越不值钱,还剩十来个任务时可以跌到零;余额紧张时它仍然昂贵。倒计时重算能逼近最优,但要留出应付波动的余量。下一章把目光从时间转到任务本身:任务的复杂度要靠判别,判别会出错,出错以后路由还剩多少好处?

数据口径:示意参数下,线性规划相对先到先用多出 0.1668 到 0.2217,相对按复杂度分档的固定规则只多出 0.41 % 到 5.05 %,大头来自分档本身。 书中参数为示意,不含任何厂商的价格或配额;全部计算由书中程序生成。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0500, 0.4375, 40, 400, 900

primal optimum 893, dual b.y 893, equal: True
duals: H 9/40F 0demand rows 19/20 8/5 9/4 49/10
H quotaoptimumy_Hmarginal class on H
0690.000.4375-
100733.750.4375critical
200777.500.4375critical
300821.250.4375critical
400848.000.2250complex
500870.500.2250complex
600893.000.2250complex
700915.500.2250complex
800938.000.2250complex
900960.500.2250complex
1000969.000.0500standard
1100974.000.0500standard
1200979.000.0500standard
1300984.000.0500standard
1400989.000.0500standard
查看完整验算程序
# Chapter 3. p31: the shadow price of quota, and how it steps down.
# Model: the routing programme of p21 (two tiers, four classes). The
# dual value y_H of the H quota row is the extra expected output from
# one more H unit; strong duality says b.y equals the primal optimum,
# checked here in exact Fractions. Then the H quota is scanned from 0
# to 1,400 units: the optimum is concave and piecewise linear, and its
# slope is y_H. All parameters are illustrative units.
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")}
DEMAND = (300, 150, 60, 20)


def solve(qh, qf):
    c = [VALUE[k] * Fr(SUCC[t][k]) for t in "HF" for k in range(4)]
    A = [[COST["H"][k] if t == "H" else 0 for t in "HF" for k in range(4)],
         [COST["F"][k] if t == "F" else 0 for t in "HF" for k in range(4)]]
    b = [qh, qf]
    for k in range(4):
        A.append([1 if j == k else 0 for t in "HF" for j in range(4)])
        b.append(DEMAND[k])
    return simplex(c, A, b), b


(x, val, y, _), b = solve(600, 900)
dual = Fr(0)
for bi, yi in zip(b, y):
    dual += bi * yi
print("primal optimum %s, dual b.y %s, equal: %s" % (val, dual,
                                                    val == dual))
print("duals: H %s  F %s  demand rows %s" % (
    y[0], y[1], " ".join(str(v) for v in y[2:])))
print("H quota  optimum   y_H     marginal class on H")
names = ("routine", "standard", "complex", "critical")
prev = None
for qh in range(0, 1401, 100):
    (x, val, y, _), _b = solve(qh, 900)
    marg = "-"
    for k in range(4):
        if 0 < x[k] < DEMAND[k]:
            marg = names[k]
    print("%7d  %7.2f  %6.4f  %s" % (qh, float(val), float(y[0]), marg))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《周期配额削峰填谷与跨模型路由、重置倒计时线性规划与重推理轻量模型算力分配母典》第 3 章「影子价格与重置倒计时:配额的边际价值怎样随时间下跌」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}

本书其他章节结论