Files
sim-numerics/apply_article_table10_split.py
T

51 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Split Table 10 of article/sim_numerics.md in two - totals (with bound violations) and the
per-problem counts - so that it fits a printed page. The numbers are unchanged.
python -u apply_article_table10_split.py
"""
from __future__ import annotations
PATH = "article/sim_numerics.md"
OLD_START = "**Table 10.** A′ against the library rivals on all six corpora (uniform criterion)."
OLD_END = "| all 855 | **13032** | 16481 | 16657 | 24565 | 23649 | | |"
NEW = """**Table 10.** A′ against the library rivals on all six corpora (uniform criterion): total evaluations; in brackets the runs that break the $2\\times$-bisection bound.
| corpus | A′ | Chandrupatla | ModAB | Brent | TOMS 748 |
|----------------------|------------|--------------|------------|------------|------------|
| APS (154) | **2259** (0) | 2595 (0) | 2726 (0) | 2707 (0) | 2636 (0) |
| Chandrupatla (45) | **1074** (0) | 1505 (0) | 1681 (0) | 3238 (18) | 3088 (15) |
| new corpus 1 (206) | **3290** (0) | 3716 (0) | 3809 (1) | 6395 (38) | 5746 (22) |
| Roots.jl (78) | **1371** (0) | 1566 (0) | 1446 (0) | 2455 (11) | 2339 (9) |
| applied + GSL (132) | 1382 (0) | 1382 (0) | 1460 (0) | 1503 (1) | 1756 (1) |
| **corpus 4 (240), the one test** | **3656** (0) | 5717 (0) | 5535 (8) | 8267 (50) | 8084 (37) |
| all 855 | **13032** | 16481 | 16657 | 24565 | 23649 |
**Table 10b.** The same runs problem by problem: A′'s wins/ties/losses against Chandrupatla and against ModAB (exact two-sided sign test).
| corpus | A′ vs Chandrupatla | A′ vs ModAB |
|----------------------|------------------------------|--------------|
| APS (154) | 103/20/31, $p=3\\cdot10^{-10}$ | 118/10/26 |
| Chandrupatla (45) | 31/4/10, $p=0.001$ | 34/4/7 |
| new corpus 1 (206) | 108/33/65, $p=0.001$ | 125/26/55 |
| Roots.jl (78) | 44/14/20, $p=0.004$ | 47/11/20 |
| applied + GSL (132) | 48/52/32, $p=0.09$ | 76/35/21 |
| **corpus 4 (240), the one test** | **177/35/28, $p=10^{-27}$** | **183/23/34** |"""
def main():
with open(PATH, encoding="utf8") as fh:
text = fh.read()
if text.count(OLD_START) != 1 or text.count(OLD_END) != 1:
raise SystemExit("Table 10 anchors not found exactly once")
i, j = text.index(OLD_START), text.index(OLD_END) + len(OLD_END)
text = text[:i] + NEW + text[j:]
with open(PATH, "w", encoding="utf8") as fh:
fh.write(text)
print("Table 10 split")
if __name__ == "__main__":
main()