chasing Chandrupatla found a property of the BENCHMARK: on all five fun7 problems f vanishes identically near the declared root (f(0+t)=0 up to 3.2e-2), every method stops at a point where f(x)=0 exactly and is scored a failure by the |x-root|<=1e-6 rule — so 1000 evaluations of EVERY wide-bracket total are an artefact and the universal '40 of 45' is a scoring statement. Re-scored: 45/45 for everyone but Brent, ranking unchanged, gap to Chandrupatla 253 (17%) and diffuse across 8 families. Written into the paper with its reproducing scripts; pdflatex clean, verifier green
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"""Is fun7 a method failure or a SCORING failure?
|
||||
|
||||
Every method stops on fun7 within 8-22 evaluations and every one is scored unsolved. This
|
||||
checks the only thing that matters: is f actually zero at the point each method returned?
|
||||
If it is, the methods found a root and the benchmark's |x - declared_root| <= 1e-6 check is
|
||||
what fails — 5 of the 45 problems then contribute 200 dead evaluations each to EVERY
|
||||
method's total, which is a fact about the scoring, not about the methods.
|
||||
|
||||
python -u diag_fun7_root.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import math
|
||||
|
||||
from scipy.optimize._tstutils import _CHANDRUPATLA_TESTS_DICTS
|
||||
|
||||
from simroot.baselines import best_of, chandrupatla, chandrupatla_scipy
|
||||
from simroot.pure import pure_root
|
||||
from sweep_full import MAXFEV, XTOL
|
||||
|
||||
CHA = best_of(chandrupatla, chandrupatla_scipy)
|
||||
|
||||
|
||||
def main():
|
||||
for d in _CHANDRUPATLA_TESTS_DICTS:
|
||||
if not str(d["ID"]).startswith("fun7"):
|
||||
continue
|
||||
f, root = d["f"], float(d["root"])
|
||||
a, b = (float(v) for v in d["bracket"])
|
||||
x_o, n_o, _ok = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio",
|
||||
scale="derived3", guard="safe", prestep="slope",
|
||||
direction="dissimilar")
|
||||
x_c, n_c, _okc = CHA(f, a, b, XTOL, MAXFEV)
|
||||
print(f"{d['ID']:<8} declared root {root:+.3g}")
|
||||
for nm, x, n in (("ours", x_o, n_o), ("chandrupatla", float(x_c), n_c)):
|
||||
fx = f(x)
|
||||
print(f" {nm:<13} returned x={x:+.10g} after {n:3d} evals "
|
||||
f"f(x)={fx:+.3e} |x-root|={abs(x - root):.3g} "
|
||||
f"{'f IS ZERO THERE' if fx == 0.0 else 'f is not zero'}")
|
||||
# how wide is the flat zero region around the declared root?
|
||||
w = 0.0
|
||||
for k in range(0, 40):
|
||||
t = 10.0 ** (-12 + k * 0.5)
|
||||
if f(root + t) == 0.0:
|
||||
w = t
|
||||
else:
|
||||
break
|
||||
print(f" f is identically zero at least up to root + {w:.3g}")
|
||||
src = inspect.getsource(_CHANDRUPATLA_TESTS_DICTS[0]["f"]) if False else None
|
||||
if src:
|
||||
print(src)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user