5D Library › 复合补剂相互作用、时间疗法给药窗口与代谢酶竞争 · English

第六章 精确解出的排程

三件事同时发生

排程所需要的一切现在都在手上了。一项被放进某个时段,受三件事影响:那个时段里还有什么在与它竞争、那个时辰的肠道是什么样,以及那个时辰对这一项该做的事来说是否好。这就是第一到第四章的三个因子,而剩下的唯一问题是组合的:十一项、三个时段,排法很多,而有些比另一些好得多。

有一对抗拒分开。胡椒碱只有在与姜黄素同吞时才提高后者的存活分数,所以最优化必须把这份增益与挪动胡椒碱在别处的代价放在一起权衡。把它纳进来,才使这个问题成为一次真正的最优化,而不是一次排序练习。

证据

已发表。 Smolensky 与 Peppas 综述了「选择给药时辰」而非「把一天中各次给药视为可互换」的临床依据 (Smolensky and Peppas 2007)。Claxton、Cramer 与 Pierce 的系统综述把给药方案与实测依从性联系起来,而这是任何排程都必须在其中生存的约束 (Claxton et al. 2001)。

推导

# Chapter 6. p11: The schedule, solved. Three slots at fixed clock times
# are offered, each with the gut condition that slot naturally has: a
# fatty breakfast, a light acid-stomach gap in the afternoon, and a
# small evening meal. Every one of the 177,147 ways of putting eleven
# items into three labelled slots is scored, so the answer is the exact
# optimum and not the result of a search that might have stopped early.
# The score of an item is the product of three factors: competition
# inside its own slot, the suitability of that slot's gut condition, and
# the value of that clock time for what the item is supposed to do.
# One pair pulls the other way: piperine raises curcumin's surviving
# fraction, but only if the two are swallowed together, so the optimiser
# has to weigh that gain against whatever else moving piperine costs.
ITEMS = (
    # name, dose mg, molar mass, site, Km mmol, needs, phase
    ("magnesium",     400.00,  24.305, "divalent",  4.0000, "plain", "eve"),
    ("zinc",           25.00,  65.380, "divalent",  0.1500, "lowphy", "any"),
    ("calcium",       500.00,  40.080, "divalent",  5.0000, "plain", "eve"),
    ("iron",           18.00,  55.850, "divalent",  0.0800, "acid", "morn"),
    ("vitamin D3",      0.10, 384.600, "micelle",   0.0004, "fat", "morn"),
    ("vitamin K2",      0.18, 444.700, "micelle",   0.0005, "fat", "any"),
    ("NAD precursor", 300.00, 255.200, "nrk",       1.0000, "plain", "morn"),
    ("curcumin",      500.00, 368.400, "conjugate", 1.0000, "fat", "any"),
    ("piperine",       10.00, 285.300, "conjugate", 0.0500, "plain", "any"),
    ("theanine",      200.00, 174.200, "amino",     1.0000, "plain", "eve"),
    ("caffeine",      100.00, 194.200, "cyp1a2",    0.5000, "plain", "morn"),
)
# slot: label, clock hour, fat g, phytate mg, polyphenol mg, stomach pH
SLOTS = (
    ("breakfast 07:00", 7.0, 18.0, 120.0, 40.0, 2.0),
    ("afternoon 14:00", 14.0, 2.0, 0.0, 0.0, 1.6),
    ("evening 22:00", 22.0, 8.0, 60.0, 0.0, 1.9),
)
FAT_HALF, PHY_MASS, ZN_MASS = 9.0, 660.0, 65.38
PH_HALF, PH_HILL = 3.4, 2.4
PHASE_PEAK = {"morn": 6.0, "eve": 22.5, "any": None}
PHASE_WIDTH = 5.0
ENH_MAX, ENH_K = 1.60, 0.020      # piperine on curcumin, saturating

def mmol(dose_mg, molar_mass):
    return dose_mg / molar_mass

def site_factor(i, group):
    name, dose, mm, site, km, needs, phase = ITEMS[i]
    s = mmol(dose, mm)
    extra = sum(mmol(ITEMS[j][1], ITEMS[j][2]) / ITEMS[j][4]
                for j in group if j != i and ITEMS[j][3] == site)
    return (s / (km * (1.0 + extra) + s)) / (s / (km + s))

def condition_factor(needs, slot):
    _, _, fat_g, phytate, polyphenol, ph = slot
    f = 1.0
    if needs == "fat":
        f *= (fat_g / (FAT_HALF + fat_g)) / (18.0 / (FAT_HALF + 18.0))
    if needs == "acid":
        f *= 1.0 / (1.0 + polyphenol / 120.0)
        f *= (1.0 / (1.0 + (ph / PH_HALF) ** PH_HILL)) \
            / (1.0 / (1.0 + (1.6 / PH_HALF) ** PH_HILL))
    if needs == "lowphy":
        ratio = (phytate / PHY_MASS) / (25.0 / ZN_MASS)
        f *= 1.0 / (1.0 + 0.55 * ratio)
    return min(1.0, f)

def phase_factor(phase, slot):
    peak = PHASE_PEAK[phase]
    if peak is None:
        return 1.0
    d = abs((slot[1] - peak + 12.0) % 24.0 - 12.0)
    return 2.718281828459045 ** (-(d / PHASE_WIDTH) ** 2)

def enhance(i, group):
    # curcumin gains if piperine is in the same slot
    if ITEMS[i][0] != "curcumin":
        return 1.0
    for j in group:
        if ITEMS[j][0] == "piperine":
            s = mmol(ITEMS[j][1], ITEMS[j][2])
            return 1.0 + ENH_MAX * s / (ENH_K + s)
    return 1.0

def item_score(i, group, s):
    return (site_factor(i, group)
            * condition_factor(ITEMS[i][5], SLOTS[s])
            * phase_factor(ITEMS[i][6], SLOTS[s])
            * enhance(i, group))

def total(assign):
    groups = [[i for i, a in enumerate(assign) if a == s]
              for s in range(len(SLOTS))]
    out = 0.0
    for s, group in enumerate(groups):
        for i in group:
            out += item_score(i, group, s)
    return out / len(ITEMS)

if __name__ == "__main__":
    n, k = len(ITEMS), len(SLOTS)
    best, arg, tried = -1.0, None, 0
    assign = [0] * n
    while True:
        tried += 1
        v = total(assign)
        if v > best:
            best, arg = v, tuple(assign)
        i = 0
        while i < n:
            assign[i] += 1
            if assign[i] < k:
                break
            assign[i] = 0
            i += 1
        if i == n:
            break
    print("   assignments tried: {}".format(tried))
    print("   best mean delivered fraction: {:.4f}".format(best))
    for s, (label, hour, _, _, _, _) in enumerate(SLOTS):
        names = [ITEMS[i][0] for i, a in enumerate(arg) if a == s]
        print("   {}:".format(label))
        line = "   "
        for nm in names:
            if len(line) + len(nm) + 2 > 72:
                print(line)
                line = "   "
            line += "  " + nm
        print(line if line.strip() else "     nothing")
    print("   per item, in the best schedule:")
    print("   item           slot  site    gut     clock   boost   score")
    groups = [[i for i, a in enumerate(arg) if a == s] for s in range(k)]
    for i, it in enumerate(ITEMS):
        s = arg[i]
        print("   {:<15}{:<6d}{:<8.4f}{:<8.4f}{:<8.4f}{:<8.4f}{:.4f}"
              .format(it[0], s + 1, site_factor(i, groups[s]),
                      condition_factor(it[5], SLOTS[s]),
                      phase_factor(it[6], SLOTS[s]),
                      enhance(i, groups[s]), item_score(i, groups[s], s)))
    print("   curcumin's score may exceed one because piperine raises it")
    print("   above what it would deliver alone")
    allone = total([0] * n)
    print("   everything at breakfast instead: {:.4f}".format(allone))
    print("   the schedule recovers {:+.4f}, a gain of {:.4f}"
          .format(best - allone, best / allone - 1.0))
#    assignments tried: 177147
#    best mean delivered fraction: 0.8605
#    breakfast 07:00:
#      iron  vitamin D3  NAD precursor  curcumin  piperine  caffeine
#    afternoon 14:00:
#      zinc
#    evening 22:00:
#      magnesium  calcium  vitamin K2  theanine
#    per item, in the best schedule:
#    item           slot  site    gut     clock   boost   score
#    magnesium      3     0.6721  1.0000  0.9900  1.0000  0.6654
#    zinc           2     1.0000  1.0000  1.0000  1.0000  1.0000
#    calcium        3     0.4593  1.0000  0.9900  1.0000  0.4547
#    iron           1     1.0000  0.6820  0.9608  1.0000  0.6553
#    vitamin D3     1     1.0000  1.0000  0.9608  1.0000  0.9608
#    vitamin K2     3     1.0000  0.7059  1.0000  1.0000  0.7059
#    NAD precursor  1     1.0000  1.0000  0.9608  1.0000  0.9608
#    curcumin       1     0.7708  1.0000  1.0000  2.0187  1.5560
#    piperine       1     0.5562  1.0000  1.0000  1.0000  0.5562
#    theanine       3     1.0000  1.0000  0.9900  1.0000  0.9900
#    caffeine       1     1.0000  1.0000  0.9608  1.0000  0.9608
#    curcumin's score may exceed one because piperine raises it
#    above what it would deliver alone
#    everything at breakfast instead: 0.5394
#    the schedule recovers +0.3211, a gain of 0.5952

全部 177147 种带标签的分配都被评了分,所以答案是精确最优。它达到 0.8605,而把一切放进早餐那一堆是 0.5394,增益 0.5952。它找到的排程是可辨认的:铁、维生素 D3、烟酰胺前体、姜黄素、胡椒碱与咖啡因在早餐;锌单独在午后;镁、钙、维生素 K2 与茶氨酸在傍晚。

逐项的那张表显示每一项为什么在它所在之处。铁在早餐,是因为那里它躲开了钙与镁,而它为此付出 0.6820 的肠道因子,因为早餐并不是空腹且酸的胃。钙得分最低,为 0.4547,因为它在傍晚那一槽里仍然在与镁竞争,而不开出第四个时段就无法可施。姜黄素得分 1.5560,高于一,因为胡椒碱留在了它身边。

一个靠猜的排程值多少

只有在猜很难的时候,最优解才有意思。p12 给每一种排程评分,而不只给最好的那一种。

推导

# Chapter 6. p12: How lucky a guessed schedule is. The previous program
# found the best of the 177,147 labelled schedules. This one scores all
# of them and looks at the distribution, which answers a question the
# optimum does not: if someone splits the pile by instinct rather than
# by arithmetic, how well are they likely to do? It also ranks the
# single moves out of the morning pile by what each one is worth on its
# own, because a reader who will change exactly one thing should know
# which one. The model is identical to p11, repeated here so that this
# program runs on its own.
ITEMS = (
    # name, dose mg, molar mass, site, Km mmol, needs, phase
    ("magnesium",     400.00,  24.305, "divalent",  4.0000, "plain", "eve"),
    ("zinc",           25.00,  65.380, "divalent",  0.1500, "lowphy", "any"),
    ("calcium",       500.00,  40.080, "divalent",  5.0000, "plain", "eve"),
    ("iron",           18.00,  55.850, "divalent",  0.0800, "acid", "morn"),
    ("vitamin D3",      0.10, 384.600, "micelle",   0.0004, "fat", "morn"),
    ("vitamin K2",      0.18, 444.700, "micelle",   0.0005, "fat", "any"),
    ("NAD precursor", 300.00, 255.200, "nrk",       1.0000, "plain", "morn"),
    ("curcumin",      500.00, 368.400, "conjugate", 1.0000, "fat", "any"),
    ("piperine",       10.00, 285.300, "conjugate", 0.0500, "plain", "any"),
    ("theanine",      200.00, 174.200, "amino",     1.0000, "plain", "eve"),
    ("caffeine",      100.00, 194.200, "cyp1a2",    0.5000, "plain", "morn"),
)
# slot: label, clock hour, fat g, phytate mg, polyphenol mg, stomach pH
SLOTS = (
    ("breakfast 07:00", 7.0, 18.0, 120.0, 40.0, 2.0),
    ("afternoon 14:00", 14.0, 2.0, 0.0, 0.0, 1.6),
    ("evening 22:00", 22.0, 8.0, 60.0, 0.0, 1.9),
)
FAT_HALF, PHY_MASS, ZN_MASS = 9.0, 660.0, 65.38
PH_HALF, PH_HILL = 3.4, 2.4
PHASE_PEAK = {"morn": 6.0, "eve": 22.5, "any": None}
PHASE_WIDTH = 5.0
ENH_MAX, ENH_K = 1.60, 0.020      # piperine on curcumin, saturating

def mmol(dose_mg, molar_mass):
    return dose_mg / molar_mass

def site_factor(i, group):
    name, dose, mm, site, km, needs, phase = ITEMS[i]
    s = mmol(dose, mm)
    extra = sum(mmol(ITEMS[j][1], ITEMS[j][2]) / ITEMS[j][4]
                for j in group if j != i and ITEMS[j][3] == site)
    return (s / (km * (1.0 + extra) + s)) / (s / (km + s))

def condition_factor(needs, slot):
    _, _, fat_g, phytate, polyphenol, ph = slot
    f = 1.0
    if needs == "fat":
        f *= (fat_g / (FAT_HALF + fat_g)) / (18.0 / (FAT_HALF + 18.0))
    if needs == "acid":
        f *= 1.0 / (1.0 + polyphenol / 120.0)
        f *= (1.0 / (1.0 + (ph / PH_HALF) ** PH_HILL)) \
            / (1.0 / (1.0 + (1.6 / PH_HALF) ** PH_HILL))
    if needs == "lowphy":
        ratio = (phytate / PHY_MASS) / (25.0 / ZN_MASS)
        f *= 1.0 / (1.0 + 0.55 * ratio)
    return min(1.0, f)

def phase_factor(phase, slot):
    peak = PHASE_PEAK[phase]
    if peak is None:
        return 1.0
    d = abs((slot[1] - peak + 12.0) % 24.0 - 12.0)
    return 2.718281828459045 ** (-(d / PHASE_WIDTH) ** 2)

def enhance(i, group):
    # curcumin gains if piperine is in the same slot
    if ITEMS[i][0] != "curcumin":
        return 1.0
    for j in group:
        if ITEMS[j][0] == "piperine":
            s = mmol(ITEMS[j][1], ITEMS[j][2])
            return 1.0 + ENH_MAX * s / (ENH_K + s)
    return 1.0

def item_score(i, group, s):
    return (site_factor(i, group)
            * condition_factor(ITEMS[i][5], SLOTS[s])
            * phase_factor(ITEMS[i][6], SLOTS[s])
            * enhance(i, group))

def total(assign):
    groups = [[i for i, a in enumerate(assign) if a == s]
              for s in range(len(SLOTS))]
    out = 0.0
    for s, group in enumerate(groups):
        for i in group:
            out += item_score(i, group, s)
    return out / len(ITEMS)

if __name__ == "__main__":
    n, k = len(ITEMS), len(SLOTS)
    scores = []
    assign = [0] * n
    best, arg = -1.0, None
    while True:
        v = total(assign)
        scores.append(v)
        if v > best:
            best, arg = v, tuple(assign)
        i = 0
        while i < n:
            assign[i] += 1
            if assign[i] < k:
                break
            assign[i] = 0
            i += 1
        if i == n:
            break
    scores.sort()
    m = len(scores)
    allone = total([0] * n)
    def q(a):
        return scores[int(a * (m - 1))]
    print("   schedules scored: {}".format(m))
    print("   best {:.4f}, worst {:.4f}, median {:.4f}"
          .format(scores[-1], scores[0], q(0.5)))
    print("   10th to 90th percentile: {:.4f} to {:.4f}"
          .format(q(0.1), q(0.9)))
    print("   everything at breakfast scores {:.4f}".format(allone))
    worse = sum(1 for v in scores if v < allone)
    print("   share of schedules worse than that: {:.4f}".format(worse / m))
    for tol in (0.01, 0.02, 0.05):
        near = sum(1 for v in scores if v >= scores[-1] - tol)
        print("   schedules within {:.2f} of the best: {} ({:.5f})"
              .format(tol, near, near / m))
    print("   so a guessed split lands near the optimum rarely, and the")
    print("   median guess gives up {:.4f} of the best"
          .format(1.0 - q(0.5) / scores[-1]))
    print("   value of moving one item out of the all-at-breakfast pile:")
    print("   item           to slot   score    gain")
    moves = []
    for i in range(n):
        for s in (1, 2):
            a = [0] * n
            a[i] = s
            moves.append((total(a) - allone, ITEMS[i][0], s + 1, total(a)))
    moves.sort(reverse=True)
    for gain, name, slot, v in moves[:6]:
        print("   {:<15}{:<10d}{:<9.4f}{:+.4f}".format(name, slot, v, gain))
    print("   the best single move is worth {:+.4f}, which is {:.4f} of"
          .format(moves[0][0], moves[0][0] / (scores[-1] - allone)))
    print("   the whole gain the full schedule achieves")
#    schedules scored: 177147
#    best 0.8605, worst 0.1561, median 0.4384
#    10th to 90th percentile: 0.3145 to 0.5716
#    everything at breakfast scores 0.5394
#    share of schedules worse than that: 0.8355
#    schedules within 0.01 of the best: 1 (0.00001)
#    schedules within 0.02 of the best: 3 (0.00002)
#    schedules within 0.05 of the best: 19 (0.00011)
#    so a guessed split lands near the optimum rarely, and the
#    median guess gives up 0.4906 of the best
#    value of moving one item out of the all-at-breakfast pile:
#    item           to slot   score    gain
#    magnesium      3         0.6441   +0.1047
#    calcium        3         0.6369   +0.0975
#    theanine       3         0.6244   +0.0850
#    zinc           2         0.6176   +0.0782
#    zinc           3         0.6071   +0.0677
#    vitamin K2     3         0.5655   +0.0260
#    the best single move is worth +0.1047, which is 0.3260 of
#    the whole gain the full schedule achieves

这个分布是全书最强的结果。中位排程得分 0.4384,比最优少 0.4906。在 177147 种之中,只有一种落在最优的 0.01 之内,三种在 0.02 之内,十九种在 0.05 之内。而有 0.8355 的排程得分低于 0.5394,也就是干脆把一切放成早餐一堆的那个数字。

最后那个数字值得明说。把一堆补剂随意分散到一天里,有六次中的五次比根本不分散更差。「任何分开都比不分开好」这个直觉是错的,因为随机的分开会拆散本该在一起的组合,例如胡椒碱与姜黄素,又把本不该在一起的留在一起,例如钙与铁。打算临场发挥的读者不应临场发挥。

那张移动表给出了替代方案。对早餐那一堆最好的单一改动是把镁挪到傍晚,值 0.1047,是完整排程所达成的全部增益的 0.3260。把钙挪到傍晚值 0.0975,茶氨酸值 0.0850。一次移动就捕获了可得好处的三分之一,而所列的三次移动捕获了其中大部分。

假说 · 尚未验证

作者的诠释(尚未验证): 因为随机的分开在多数情况下比不分开更差,那些只说「把补剂分散到一天里」而不指明哪一项放在哪里的已发表建议,平均而言使结果比「全部一起吃」的建议更糟。什么会证明它错: 如果在一项以营养状态为终点、比较无结构分散与每日单堆的试验里,无结构分散胜出,那么这里算出的分布就不能迁移到真实行为上。

小结

在 177147 种三槽排程上的精确最优得 0.8605,而单一早餐堆得 0.5394,增益 0.5952,其中铁与脂溶性各项在清晨、常量矿物质在夜间。但中位排程只得 0.4384,只有十九种落在最优的 0.05 之内,而有 0.8355 的排程比那单一堆更差。最好的单一移动,把镁挪到傍晚,捕获全部增益的 0.3260。第七章问:关于这件事,古典本草早已写下了什么。

参考文献

Claxton, Ami J., Joyce Cramer, and Charles Pierce. 2001. “A Systematic Review of the Associations between Dose Regimens and Medication Compliance.” Clinical Therapeutics 23 (8): 1296 to 1310.
Smolensky, Michael H., and Nicholas A. Peppas. 2007. “Chronobiology, Drug Delivery, and Chronotherapeutics.” Advanced Drug Delivery Reviews 59 (9 to 10): 828 to 851.

Fan, Y. (2026). Polypharmacy Supplement Interactions, Chronotherapy Dosing Windows and Cytochrome Enzyme Competition: Michaelis-Menten Inhibition Matrices, Chelation Absorption Losses and Circadian Receptor Sensitivity [复合补剂相互作用、时间疗法给药窗口与代谢酶竞争] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090250 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).