5D Library › Polypharmacy Supplement Interactions, Chronotherapy Dosing Windows and Cytochrome Enzyme Competition · 中文
Chapter 6. The Schedule, Solved Exactly
Three things at once
Everything needed for a schedule is now in hand. An item placed in a slot is affected by three things: what else is in that slot and competes with it, what the gut is like at that hour, and whether that hour is a good one for what the item is supposed to do. Those are the three factors of Chapters 1 to 4, and the only remaining question is combinatorial: with eleven items and three slots there are many ways to arrange them, and some are much better than others.
One pair resists separation. Piperine raises curcumin’s surviving fraction only if the two are swallowed together, so the optimiser has to weigh that gain against whatever moving piperine costs elsewhere. Including it is what makes the problem a genuine optimisation rather than a sorting exercise.
Evidence
Published. Smolensky and Peppas review the clinical basis for choosing a time of administration rather than treating doses as interchangeable through the day (Smolensky and Peppas 2007). Claxton, Cramer and Pierce’s systematic review relates dose regimens to measured compliance, which is the constraint any schedule has to live inside (Claxton et al. 2001).
Calculation
# 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.5952All 177147 labelled assignments are scored, so the answer is the exact optimum. It reaches 0.8605, against 0.5394 for putting everything in the breakfast pile, a gain of 0.5952. The schedule it finds is recognisable: iron, vitamin D3, the nicotinamide precursor, curcumin, piperine and caffeine at breakfast; zinc alone in the afternoon; magnesium, calcium, vitamin K2 and theanine in the evening.
The per-item table shows why each item is where it is. Iron is at breakfast because that is where it escapes calcium and magnesium, and it pays for that with a gut factor of 0.6820, since breakfast is not an empty acid stomach. Calcium scores worst at 0.4547, because it is still competing with magnesium in the evening slot and nothing can be done about that without a fourth slot. Curcumin scores 1.5560, above one, because piperine stayed with it.
What a guessed schedule is worth
The optimum is only interesting if guessing is hard. p12 scores every schedule rather than only the best one.
Calculation
# 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 achievesThe distribution is the strongest result in the book. The median schedule scores 0.4384, which gives up 0.4906 of the best. Only one schedule comes within 0.01 of the optimum, three within 0.02 and nineteen within 0.05, out of 177147. And 0.8355 of all schedules score below 0.5394, the figure for simply putting everything in one pile at breakfast.
That last number deserves to be stated plainly. Splitting a supplement pile across the day at random is worse than not splitting it at all, five times out of six. The intuition that any separation is better than none is false, because a random split breaks up the groups that belong together, such as piperine and curcumin, and leaves together the groups that do not, such as calcium and iron. A reader who is going to improvise should not improvise.
The move table gives the alternative. The single best change to the breakfast pile is to move magnesium to the evening, worth 0.1047, which is 0.3260 of the whole gain the full schedule achieves. Moving calcium to the evening is worth 0.0975 and theanine 0.0850. One move captures a third of the available benefit, and the three moves listed capture most of it.
Hypothesis · not established
The author’s interpretation (not yet tested): because a random split is worse than no split in most cases, published advice to “spread supplements through the day” without naming which items go where makes outcomes worse on average than advice to take them all together. What would show it wrong: if, in a trial comparing unstructured spreading against a single daily pile with nutrient status as the endpoint, unstructured spreading came out ahead, the distribution computed here would not transfer to real behaviour.
Summary
The exact optimum over 177147 three-slot schedules scores 0.8605 against 0.5394 for a single breakfast pile, a gain of 0.5952, with iron and the fat-soluble items in the morning and the bulk minerals at night. But the median schedule scores 0.4384, only nineteen schedules come within 0.05 of the best, and 0.8355 of all schedules are worse than the single pile. The best single move, magnesium to the evening, captures 0.3260 of the whole gain. Chapter 7 asks what the classical pharmacopoeias had already written down about this.
References
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).