What does Attention Residue and Sprint Scheduling conclude, in numbers, about “The Two-Process Alertness Curve: Sleep Pressure, Circadian Rhythm and the High-Alertness Window”?
Answer: Chapter 5 draws an alertness curve from the two-process model, marks a personal high-alertness window and makes "sleep length is never compressed" a precondition of scheduling; greedily filling the window with hard matters loses at worst 2.56 % against dynamic programming.
Scope of the numbers: Parameters are illustrative and all calculations are generated by the book's programs. This is not medical, sleep, nutritional or mental-health advice, and it claims no health effect.
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: 2.56
greedy D6@09 D2@10 D1@11 D4@13 D3@15 D5@17 D7@19 dp D3@09 D1@11 D2@13 D4@15 D5@16 D6@18 D7@19 value greedy 7.5710 dp 7.7700 gap 2.56 % decisions placed: greedy 7 dp 7 all 66 blocked pairs: greedy loses in 27, mean gap 0.20 %, worst gap 2.56 %
Show the full program
# Chapter 5. p52: putting hard decisions into high windows, greedy vs DP
# Slots 08:00-19:00, one hour each; alertness index copied from the p51
# output (8 h sleep). Weight w = alertness + 0.45 so every slot is > 0.
# Slots 08 and 14 are blocked by fixed commitments (illustrative); then
# every pair of blocked slots is scanned to see how often greedy loses.
# Decision j has difficulty d_j and length len_j hours; placing it in a
# contiguous free run earns d_j * sum(w over its slots).
# Greedy: hardest first, each into its best free run.
# Exact: dynamic programming over (slot, set of decisions already placed).
import functools
import itertools
import math
ALERT = {8: -0.305, 9: -0.232, 10: -0.192, 11: -0.176, 12: -0.182,
13: -0.204, 14: -0.234, 15: -0.265, 16: -0.290, 17: -0.309,
18: -0.324, 19: -0.342}
HOURS = sorted(ALERT)
W = [ALERT[h] + 0.45 for h in HOURS]
BLOCKED = {8, 14}
DEC = [("D1 arena pricing", 5, 2), ("D2 contract", 5, 1),
("D3 partner brief", 4, 2), ("D4 site layout", 3, 1),
("D5 book scope", 3, 2), ("D6 supplier", 2, 1),
("D7 ad copy", 2, 1), ("D8 roster", 1, 1)]
def run_value(start, length):
idx = range(start, start + length)
if start + length > len(HOURS):
return None
if any(HOURS[i] in BLOCKED for i in idx):
return None
return math.fsum(W[i] for i in idx)
def greedy():
used, plan, total = set(), [], []
for j in sorted(range(len(DEC)), key=lambda j: (-DEC[j][1], -DEC[j][2])):
_, d, ln = DEC[j]
best = None
for s in range(len(HOURS)):
v = run_value(s, ln)
if v is None or any(i in used for i in range(s, s + ln)):
continue
if best is None or v > best[0]:
best = (v, s)
if best is not None:
used.update(range(best[1], best[1] + ln))
plan.append((j, best[1]))
total.append(d * best[0])
return math.fsum(total), plan
@functools.lru_cache(maxsize=None)
def dp(s, mask):
if s >= len(HOURS):
return 0.0, ()
best = dp(s + 1, mask)
for j, (_, d, ln) in enumerate(DEC):
if mask >> j & 1:
continue
v = run_value(s, ln)
if v is None:
continue
sub = dp(s + ln, mask | 1 << j)
cand = (d * v + sub[0], ((j, s),) + sub[1])
if cand[0] > best[0] + 1e-12:
best = cand
return best
g_val, g_plan = greedy()
d_val, d_plan = dp(0, 0)
for label, plan in (("greedy", g_plan), ("dp", d_plan)):
cells = ["{}@{:02d}".format(DEC[j][0][:2], HOURS[s])
for j, s in sorted(plan, key=lambda x: x[1])]
print("{:<6} ".format(label) + " ".join(cells))
print("value greedy {:.4f} dp {:.4f} gap {:.2f} %".format(
g_val, d_val, 100.0 * (d_val - g_val) / d_val))
print("decisions placed: greedy {} dp {}".format(len(g_plan), len(d_plan)))
gaps = []
for pair in itertools.combinations(HOURS, 2):
BLOCKED = set(pair)
dp.cache_clear()
gv = greedy()[0]
dv = dp(0, 0)[0]
gaps.append(100.0 * (dv - gv) / dv)
worse = len([g for g in gaps if g > 1e-9])
print("all {} blocked pairs: greedy loses in {}, mean gap {:.2f} %,"
.format(len(gaps), worse, math.fsum(gaps) / len(gaps)))
print(" worst gap {:.2f} %".format(max(gaps)))Single source and citation
Fan, Y. (2026). Eliminating Attention Residue in Multi-Arena Command, Ultradian Energy Pacing and Rapid Context-Switching Protocols (Version 1.0.0), Chapter 5: The Two-Process Alertness Curve: Sleep Pressure, Circadian Rhythm and the High-Alertness Window. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-362 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026362,
author = {Fan, Yafu},
title = {Eliminating Attention Residue in Multi-Arena Command, Ultradian Energy Pacing and Rapid Context-Switching Protocols},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Two Ledgers: the Millisecond Switch and the Minute-Scale Residue
- Chapter 2 · The Residue Decay Equation: Goal Memory, Closing Moves and the Time Constant τ
- Chapter 3 · Sprint Length: Alertness Decay, Switching Cost and Where Ninety Minutes Came From
- Chapter 4 · The Three-Minute Reset: Taking Apart Standing Up, the Sound-and-Light Anchor and the Written Close
- Chapter 6 · A Load Budget for the Decision Day: Reversibility Weights, a Switch Cap and Batching the Arenas
- Chapter 7 · Classical Sources: the Xunzi on Dispelling Obsession, the Zhuangzi on Mastering Life, Seneca's Second Letter and James on Attention
- Chapter 8 · Closing the Loop: Standard Operating Templates and Checker Specification