From cc82156cded03bf9cf8c9dfb8432dbef52a6937d Mon Sep 17 00:00:00 2001 From: Valeri Sitnikov Date: Mon, 21 Sep 2026 18:49:19 +0100 Subject: [PATCH] Why the translation limit fired late on the fun9.5 flank (diagnostics only). The limit itself reads correctly: at x = 10.89 the pair has lx 1.09, lf 1.5e-3 -> m = inf, and the regime is entered at the next flag (10.39), after which the flank is halved (5.19, 2.60, 1.30). It fires late because the flank configurations do NOT recur from 20.25 to 10.89: (1) the near-zero step 20.2502 -> 20.2501 (overconfident S ~ 1 from a slope dominated by f(81) = 1.5e35) makes the next triples degenerate (xi ~ 0, then -1.7e7) and pollutes the memory; (2) our three-point step on exp is not a translation - it alternates long/short (xi -1.43, -0.46, -4.10, -0.03, -13.9) and first repeats at lag 5 (state 10 ~ state 5). 9 evaluations from 20.25 to 10.39 where one halving would do: ~8 of the +10 gap on fun9.5. Co-Authored-By: Claude Opus 5 --- diag_fun9_flank.py | 55 +++++++++++++++++++++++++++++++++++++ results_diag_fun9_flank.txt | 23 ++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 diag_fun9_flank.py create mode 100644 results_diag_fun9_flank.txt diff --git a/diag_fun9_flank.py b/diag_fun9_flank.py new file mode 100644 index 0000000..f7e8861 --- /dev/null +++ b/diag_fun9_flank.py @@ -0,0 +1,55 @@ +"""Why the translation limit did not fire on the exp(x) flank of fun9.5 ([2e-4, 81]). + +Every state the gate sees (trace hook) under a prestep, in order, with what the analogy +reads there: + flag r = f/f_prev >= 1/4 (sign kept) - the entry also needs the last step to be the model's + xi, phi the configuration + ratio d_past / d_line (< 1: analogous to the nearest past configuration) + lx, lf the pair's x-scale and f-scale ratios (translation: lf < 1 <= lx) + m the order read with translation=True +Nothing in the method changes. + + python -u diag_fun9_flank.py [problem] [prestep] +""" +from __future__ import annotations + +import math +import sys + +from simroot.pure import _analogy_order, _config3, pure_root +from sweep_full import MAXFEV, XTOL, load_problems + + +def main(pid_want="fun9.5", pre="defect+flatanalogmempt+exp"): + for s, pid, f, a, b, _root in load_problems(): + if pid != pid_want: + continue + st = {"trace": []} + pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3", + guard="project", prestep=pre, stats=st) + print(f"== {pid} {pre} entries {st.get('stick_entries', 0)}") + past = [] + for k, t in enumerate(st["trace"]): + cur = _config3(t["x"], t["fx"], t["xp"], t["fp"], t["xp2"], t["fp2"]) + flag = t["fp"] != 0.0 and t["fx"] / t["fp"] >= 0.25 + head = f" {k:3d} x {t['x']:9.4f} f {t['fx']:+9.2e} {'F' if flag else '.'}" + if cur is None: + print(head + " (no configuration)") + continue + line = abs(cur[1] - cur[0]) / math.sqrt(2.0) + if past: + q = min(past, key=lambda p: math.hypot(cur[0] - p[0], cur[1] - p[1])) + ratio = math.hypot(cur[0] - q[0], cur[1] - q[1]) / line if line > 0 else math.inf + lx = cur[2] / q[2] if q[2] > 0 else math.nan + lf = cur[3] / q[3] if q[3] > 0 else math.nan + m = _analogy_order(cur, past, translation=True) + ms = "none" if m is None else ("inf" if math.isinf(m) else f"{m:.2f}") + print(head + f" xi {cur[0]:+8.3f} phi {cur[1]:+8.3f} ratio {ratio:7.3f}" + f" lx {lx:7.3f} lf {lf:9.3e} m {ms}") + else: + print(head + f" xi {cur[0]:+8.3f} phi {cur[1]:+8.3f} (no memory)") + past.append(cur) + + +if __name__ == "__main__": + main(*sys.argv[1:3]) diff --git a/results_diag_fun9_flank.txt b/results_diag_fun9_flank.txt new file mode 100644 index 0000000..d6ba6d6 --- /dev/null +++ b/results_diag_fun9_flank.txt @@ -0,0 +1,23 @@ +== fun9.5 defect+flatanalogmempt+exp entries 1 + 0 x 0.0002 f -1.00e+00 . (no configuration) + 1 x 40.5001 f +3.88e+17 . xi +0.500 phi +0.000 (no memory) + 2 x 20.2502 f +6.23e+08 . xi +0.500 phi +1.000 ratio 2.828 lx 0.500 lf 1.000e+00 m none + 3 x 20.2501 f +6.23e+08 F xi -0.000 phi -0.000 ratio 220240183.906 lx 0.000 lf 1.044e-16 m none + 4 x 19.1406 f +2.05e+08 F xi -17066711.549 phi -10310042.635 ratio 4.173 lx 17066711.549 lf 1.031e+07 m none + 5 x 17.5571 f +4.22e+07 . xi -1.427 phi -0.391 ratio 2.019 lx 24356112.465 lf 4.030e+06 m none + 6 x 16.8250 f +2.03e+07 F xi -0.462 phi -0.134 ratio 2.074 lx 11259747.544 lf 5.403e+05 m none + 7 x 13.8231 f +1.01e+06 . xi -4.101 phi -0.880 ratio 1.194 lx 1.896 lf 1.180e-01 m none + 8 x 13.7422 f +9.29e+05 F xi -0.027 phi -0.004 ratio 1.684 lx 1244198.603 lf 1.933e+03 m none + 9 x 12.6156 f +3.01e+05 F xi -13.927 phi -8.022 ratio 2.909 lx 0.375 lf 3.259e-02 m none + 10 x 10.8903 f +5.36e+04 . xi -1.531 phi -0.394 ratio 0.130 lx 1.090 lf 1.516e-03 m inf + 11 x 10.3887 f +3.25e+04 F xi -0.291 phi -0.085 ratio 1.229 lx 0.685 lf 9.668e-04 m none + 12 x 5.1945 f +1.78e+02 . xi -10.357 phi -1.527 ratio 1.007 lx 1.730 lf 1.677e-03 m none + 13 x 2.5973 f +1.14e+01 . xi -0.500 phi -0.005 ratio 0.384 lx 3.548 lf 7.623e-06 m inf + 14 x 1.2988 f +1.66e+00 . xi -0.500 phi -0.059 ratio 0.171 lx 0.500 lf 5.854e-02 m 4.09 + 15 x 0.6094 f -1.88e-01 . xi -0.531 phi -0.189 ratio 0.364 lx 0.942 lf 8.437e-08 m 271.20 + 16 x 0.9527 f +5.82e-01 . xi +0.498 phi +0.417 ratio 7.241 lx 0.008 lf 1.982e-18 m none + 17 x 0.7352 f +6.75e-02 . xi +0.633 phi +0.668 ratio 11.558 lx 0.633 lf 6.684e-01 m none + 18 x 0.7039 f +1.36e-03 . xi -0.144 phi -0.129 ratio 13.745 lx 0.063 lf 3.125e-06 m none + 19 x 0.7032 f -2.25e-06 . xi -0.021 phi -0.021 ratio 86.525 lx 0.008 lf 1.744e-08 m none + 20 x 0.7032 f +1.38e-11 . xi +0.002 phi +0.002 ratio 7135.750 lx 16.646 lf 5.551e-08 m none + 21 x 0.7032 f +1.74e-16 . xi +0.000 phi +0.000 ratio 165597.494 lx 0.000 lf 3.401e-13 m none