Files
sim-numerics/diag_solved41.py

47 lines
1.8 KiB
Python

"""Who solves 41 of the 45 wide-bracket problems, and at what cost?
The ranking rule counts unsolved problems FIRST, so one extra solved problem outranks any
saving in evaluations. Chandrupatla solves 40; one of our own configurations already solves
41 (pure.sqrt.bracket.project, at 4516). This asks, over every sweep already computed
(no new runs), which configurations reach 41+ and what they cost — and which problems are
the ones nobody solves.
python -u diag_solved41.py
"""
from __future__ import annotations
import glob
import json
def main():
best = []
per_problem_solved = {}
for path in sorted(glob.glob("sweep_*.json")):
if "smoke" in path:
continue
with open(path, encoding="utf8") as fh:
rows = json.load(fh)
for r in rows:
cha = r["CHA"]
for pid, (n, ok) in cha["per"].items():
per_problem_solved.setdefault(pid, 0)
per_problem_solved[pid] += int(ok)
if cha["solved"] >= 41:
best.append((cha["solved"], cha["total"], r["APS"]["total"], r["label"], path,
r["APS"]["over"] + cha["over"]))
best.sort(key=lambda t: (-t[0], t[1]))
print(f"configurations solving 41+ of the 45 wide-bracket problems ({len(best)} found):")
print(f"{'solved':>7} {'CHA':>7} {'APS':>7} {'over':>5} configuration / file")
for solved, cha_tot, aps_tot, lbl, path, over in best[:15]:
print(f"{solved:7d} {cha_tot:7d} {aps_tot:7d} {over:5d} {lbl} [{path}]")
print("\nproblems nobody solves (or almost nobody), by how many configurations solved them:")
for pid, cnt in sorted(per_problem_solved.items(), key=lambda kv: kv[1])[:12]:
print(f" {pid:<10} solved by {cnt} configurations")
if __name__ == "__main__":
main()