Valeri's decisions (1) competitors from the library, (2) variant a. (1) Chandrupatla is scipy.optimize.elementwise.find_root, Brent is brentq, no more per-problem best_of. Our Chandrupatla stopped on a bracket twice as wide as every other method (the factor the protocol corrects for ITP); fixed (+0.5*xtol) in baselines.py and in the two copies found by grep (stage16_blend, stage19_modern) and the traced mirror, and pinned: ours == library on every problem. Regenerating sweep_full.json changed exactly three rows - chandrupatla APS 2785->2787, CHA 2423->2441, brent CHA 4099->4115 - and nothing else (diff_sweeps.py: 0 unexpected).
(2) The proposed method is again the scheduled projection (2806/3220/6026), its budget multiplier DECLARED as the one free constant: the canonical total is the same for every multiplier 1.25-4, the wide-bracket one is not. The earned projection is the constant-free variant (3568/3020/6588). What the old tables hid: problem by problem the proposed rule beats Chandrupatla on the canonical set 87/24/42, exact sign test p = 9e-5, while trailing him by 0.7% in total; on the wide-bracket set he is genuinely stronger (26 to 9, p = 0.006). Gap decomposition recomputed with the library: 244 (was 262), 160 of it on the flat families (two thirds), fun1 58 (a quarter, not a third as the abstract said). Also corrected on the way: the 'subsumed by Chandrupatla' pin claimed he is better on the worst single problem - true only with the looser tolerance (84 against the credit rule's 83 once fixed); §8.3 still called zero slack degenerate, which Table 1a refutes; §5.2's Brent figure is our pure-Python implementation and now says so. verify_article.py 286/286, 802 tests pass twice. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+62
-48
@@ -4,9 +4,11 @@ A paper is a claim about data; transcribing its tables by hand is how a claim
|
||||
stops matching its data. A failure here means the paper is wrong, not the
|
||||
test.
|
||||
|
||||
The proposed method is now the CREDIT safeguard - the only configuration with
|
||||
no free constant. The projection variant is kept in the paper as the other
|
||||
end of a stated trade (better average, one constant), so both are checked.
|
||||
The proposed method is the scheduled projection with its multiplier DECLARED as
|
||||
the one free constant (Valeri, 2026-09-21, variant a); the earned projection
|
||||
(credit) is the constant-free variant. Both are checked. Baselines are the
|
||||
library alone since 2026-09-21: Chandrupatla = scipy elementwise.find_root,
|
||||
Brent = brentq.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -14,10 +16,11 @@ import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from report_sweep import PROPOSED, head_to_head, place, rank
|
||||
from report_sweep import CREDIT, PROPOSED, head_to_head, place, rank
|
||||
|
||||
FAILS = []
|
||||
PROJ = "pure.ratio.derived3.project"
|
||||
assert PROPOSED == PROJ, "the paper proposes the projection (variant a)"
|
||||
|
||||
|
||||
def check(label, got, want):
|
||||
@@ -49,47 +52,58 @@ def main():
|
||||
|
||||
check("number of configurations", len(rows), 264)
|
||||
|
||||
# ---- the proposed method: credit safeguard, no free constant ----------
|
||||
print("\nThe proposed method (credit safeguard):")
|
||||
check("its label", PROPOSED, "pure.ratio.derived3.credit")
|
||||
for setname, pl, tot, sol in (("APS", 29, 3568, 153),
|
||||
("CHA", 10, 3020, 40)):
|
||||
# ---- the proposed method: projection, one declared constant ----------
|
||||
print("\nThe proposed method (projection, multiplier declared):")
|
||||
for setname, pl, tot, sol in (("APS", 3, 2806, 153),
|
||||
("CHA", 47, 3220, 40)):
|
||||
d = row(rows, setname, PROPOSED)
|
||||
check(f"{setname} place", place(rows, setname, PROPOSED), pl)
|
||||
check(f"{setname} total", d["total"], tot)
|
||||
check(f"{setname} solved", d["solved"], sol)
|
||||
check("both sets", row(rows, "APS", PROPOSED)["total"]
|
||||
+ row(rows, "CHA", PROPOSED)["total"], 6588)
|
||||
+ row(rows, "CHA", PROPOSED)["total"], 6026)
|
||||
|
||||
print("\nHead to head of the proposed method:")
|
||||
for setname, opp, want in [
|
||||
("APS", "chandrupatla", (79, 3, 71)),
|
||||
("APS", "toms748", (77, 9, 67)),
|
||||
("APS", "brent", (78, 5, 70)),
|
||||
("APS", "itp", (103, 10, 40)),
|
||||
("APS", "bisection", (122, 1, 30)),
|
||||
("CHA", "chandrupatla", (5, 0, 35)),
|
||||
("CHA", "toms748", (24, 0, 16)),
|
||||
("CHA", "brent", (18, 0, 20)),
|
||||
("CHA", "itp", (12, 20, 8))]:
|
||||
("APS", "chandrupatla", (87, 24, 42)),
|
||||
("APS", "toms748", (86, 16, 51)),
|
||||
("APS", "brent", (102, 11, 40)),
|
||||
("APS", "itp", (132, 3, 18)),
|
||||
("APS", "itp_oracle", (121, 4, 28)),
|
||||
("APS", "bisection", (152, 1, 0)),
|
||||
("CHA", "chandrupatla", (9, 5, 26)),
|
||||
("CHA", "toms748", (31, 1, 8)),
|
||||
("CHA", "brent", (30, 4, 4)),
|
||||
("CHA", "itp", (17, 0, 23)),
|
||||
("CHA", "itp_oracle", (16, 0, 24))]:
|
||||
w, t, l, _ = head_to_head(rows, PROPOSED, opp, setname)
|
||||
check(f"{setname} vs {opp}", (w, t, l), want)
|
||||
|
||||
# ---- the trade against the projection variant -------------------------
|
||||
print("\nThe stated trade: credit against the projection variant:")
|
||||
check("projection APS", row(rows, "APS", PROJ)["total"], 2806)
|
||||
check("projection CHA", row(rows, "CHA", PROJ)["total"], 3220)
|
||||
check("projection both", row(rows, "APS", PROJ)["total"]
|
||||
+ row(rows, "CHA", PROJ)["total"], 6026)
|
||||
check("credit costs more in total",
|
||||
(row(rows, "APS", PROPOSED)["total"]
|
||||
+ row(rows, "CHA", PROPOSED)["total"])
|
||||
> (row(rows, "APS", PROJ)["total"] + row(rows, "CHA", PROJ)["total"]),
|
||||
True)
|
||||
for setname, opp, want in [("APS", "brent", (102, 11, 40)),
|
||||
("APS", "toms748", (86, 16, 51))]:
|
||||
w, t, l, _ = head_to_head(rows, PROJ, opp, setname)
|
||||
check(f"projection {setname} vs {opp}", (w, t, l), want)
|
||||
def sign_p(w, l):
|
||||
import math as _m
|
||||
k, n = min(w, l), w + l
|
||||
return min(1.0, 2.0 * sum(_m.comb(n, i) for i in range(k + 1)) / 2.0 ** n)
|
||||
w, _t, l, _ = head_to_head(rows, PROPOSED, "chandrupatla", "APS")
|
||||
check("APS vs Chandrupatla sign test p < 1e-4", sign_p(w, l) < 1e-4, True)
|
||||
w, _t, l, _ = head_to_head(rows, PROPOSED, "chandrupatla", "CHA")
|
||||
check("CHA vs Chandrupatla sign test p (rounded)", round(sign_p(w, l), 3), 0.006)
|
||||
|
||||
# ---- the constant-free variant ---------------------------------------
|
||||
print("\nThe constant-free variant (earned projection):")
|
||||
for setname, pl, tot in (("APS", 29, 3568), ("CHA", 10, 3020)):
|
||||
check(f"credit {setname} place", place(rows, setname, CREDIT), pl)
|
||||
check(f"credit {setname} total", row(rows, setname, CREDIT)["total"], tot)
|
||||
check("credit both sets", row(rows, "APS", CREDIT)["total"]
|
||||
+ row(rows, "CHA", CREDIT)["total"], 6588)
|
||||
check("credit costs 762 more on the canonical set",
|
||||
row(rows, "APS", CREDIT)["total"] - row(rows, "APS", PROPOSED)["total"], 762)
|
||||
for setname, opp, want in [("APS", "chandrupatla", (79, 3, 71)),
|
||||
("APS", "toms748", (77, 9, 67)),
|
||||
("APS", "brent", (78, 5, 70))]:
|
||||
w, t, l, _ = head_to_head(rows, CREDIT, opp, setname)
|
||||
check(f"credit {setname} vs {opp}", (w, t, l), want)
|
||||
w, _t, l, _ = head_to_head(rows, CREDIT, "chandrupatla", "APS")
|
||||
check("credit APS vs Chandrupatla sign test p (rounded)", round(sign_p(w, l), 2), 0.57)
|
||||
|
||||
# ---- what the earlier, order-destroying guards cost --------------------
|
||||
print("\nThe guards that replace the step instead of projecting it:")
|
||||
@@ -107,7 +121,7 @@ def main():
|
||||
# ---- the field --------------------------------------------------------
|
||||
print("\nAlefeld-Potra-Shi:")
|
||||
check("APS winner", rank(rows, "APS")[0]["label"], "chandrupatla")
|
||||
for lbl, pl, tot in [("chandrupatla", 1, 2785), ("toms748", 4, 2820),
|
||||
for lbl, pl, tot in [("chandrupatla", 1, 2787), ("toms748", 4, 2820),
|
||||
("brent", 5, 2889), ("dekker", 12, 3158),
|
||||
("itp_oracle", 13, 3260), ("ridders", 20, 3313),
|
||||
("itp", 34, 3957), ("illinois", 73, 7045),
|
||||
@@ -121,9 +135,9 @@ def main():
|
||||
top = rank(rows, "CHA")[0]
|
||||
check("CHA rank 1 label", top["label"], "pure.sqrt.bracket.project")
|
||||
check("CHA rank 1 solves one more than anyone else", top["CHA"]["solved"], 41)
|
||||
for lbl, pl, tot in [("chandrupatla", 2, 2423), ("itp_oracle", 3, 2611),
|
||||
for lbl, pl, tot in [("chandrupatla", 2, 2441), ("itp_oracle", 3, 2611),
|
||||
("itp", 6, 2857), ("bisection", 16, 3090),
|
||||
("toms748", 164, 4000), ("brent", 226, 4099)]:
|
||||
("toms748", 164, 4000), ("brent", 226, 4115)]:
|
||||
check(f"CHA {lbl} place", place(rows, "CHA", lbl), pl)
|
||||
check(f"CHA {lbl} total", row(rows, "CHA", lbl)["total"], tot)
|
||||
check("CHA brent solved", row(rows, "CHA", "brent")["solved"], 38)
|
||||
@@ -132,7 +146,7 @@ def main():
|
||||
+ row(rows, "CHA", PROPOSED)["total"])
|
||||
cha_both = (row(rows, "APS", "chandrupatla")["total"]
|
||||
+ row(rows, "CHA", "chandrupatla")["total"])
|
||||
check("chandrupatla, both sets", cha_both, 5208)
|
||||
check("chandrupatla, both sets", cha_both, 5228)
|
||||
check("Chandrupatla beats us on both sets", cha_both < ours_both, True)
|
||||
|
||||
# ---- the regime findings ---------------------------------------------
|
||||
@@ -387,13 +401,13 @@ def verify_gap_decomposition():
|
||||
all(any(w == 0.0 for w in ws) for _p, _f, ws in ck["exceptions"]), True)
|
||||
fam = ck["fam"]
|
||||
gap = {k: v[2] - v[3] for k, v in fam.items()}
|
||||
check("total gap on the losing problems", sum(gap.values()), 262)
|
||||
check("flat families' gap", sum(gap[k] for k in ("fun3", "fun4", "fun5", "fun6")), 178)
|
||||
check("total gap on the losing problems", sum(gap.values()), 244)
|
||||
check("flat families' gap", sum(gap[k] for k in ("fun3", "fun4", "fun5", "fun6")), 160)
|
||||
check("fun1 gap", gap["fun1"], 58)
|
||||
for k, want in (("fun3", 93), ("fun4", 96), ("fun5", 100), ("fun6", 100)):
|
||||
for k, want in (("fun3", 92), ("fun4", 96), ("fun5", 100), ("fun6", 100)):
|
||||
b, q = fam[k][0], fam[k][1]
|
||||
check(f"Chandrupatla bisect share {k} %", round(100.0 * b / (b + q)), want)
|
||||
for k, want in (("fun4", 293), ("fun5", 228), ("fun6", 228)):
|
||||
for k, want in (("fun4", 297), ("fun5", 233), ("fun6", 233)):
|
||||
check(f"Chandrupatla total {k}", fam[k][3], want)
|
||||
check("m>=2 on canonical states %", round(fl["APS (canonical)"][2], 1), 0.2)
|
||||
check("m>=2 on flat states %", round(fl["CHA flat fun3-6"][2], 1), 5.8)
|
||||
@@ -462,10 +476,10 @@ def verify_safeguard_and_tables():
|
||||
check("CHA TOMS 748 over the 2x bound", by["toms748"]["CHA"]["over"], 15)
|
||||
check("CHA Brent over the 2x bound", by["brent"]["CHA"]["over"], 18)
|
||||
for lbl, setname, opp, want in (
|
||||
(PROPOSED, "APS", "itp_oracle", (86, 6, 61)),
|
||||
(PROPOSED, "CHA", "itp_oracle", (2, 3, 35)),
|
||||
(PROPOSED, "CHA", "bisection", (5, 0, 35)),
|
||||
(PROJ, "APS", "chandrupatla", (86, 25, 42)),
|
||||
(CREDIT, "APS", "itp_oracle", (86, 6, 61)),
|
||||
(CREDIT, "CHA", "itp_oracle", (2, 3, 35)),
|
||||
(CREDIT, "CHA", "bisection", (5, 0, 35)),
|
||||
(PROJ, "APS", "chandrupatla", (87, 24, 42)),
|
||||
(PROJ, "APS", "itp", (132, 3, 18)),
|
||||
(PROJ, "APS", "itp_oracle", (121, 4, 28)),
|
||||
(PROJ, "APS", "bisection", (152, 1, 0)),
|
||||
@@ -475,8 +489,8 @@ def verify_safeguard_and_tables():
|
||||
(PROJ, "CHA", "itp_oracle", (16, 0, 24))):
|
||||
w, t, l, _ = head_to_head(rows, lbl, opp, setname)
|
||||
check(f"{lbl.split('.')[-1]} {setname} vs {opp}", (w, t, l), want)
|
||||
for lbl, want in ((PROPOSED, 6588), (PROJ, 6026), ("chandrupatla", 5208),
|
||||
("itp_oracle", 5871), ("toms748", 6820), ("brent", 6988)):
|
||||
for lbl, want in ((CREDIT, 6588), (PROJ, 6026), ("chandrupatla", 5228),
|
||||
("itp_oracle", 5871), ("toms748", 6820), ("brent", 7004)):
|
||||
check(f"both sets {lbl}", by[lbl]["APS"]["total"] + by[lbl]["CHA"]["total"], want)
|
||||
|
||||
print("\n§7 under the earned projection:")
|
||||
|
||||
Reference in New Issue
Block a user