| """ |
| Reverse-engineer the alphaevolve benchmark value. |
| |
| The value 1.5052939684401607 must come from a specific step function |
| evaluated at a specific N. Let's try to find what N and function |
| give exactly this C1. |
| |
| If it's from a step function with K steps on N points, |
| then C1 = max(autoconv) / (sum(f)*dx)^2. |
| |
| Key: the value might be EXACTLY representable as a ratio of integers |
| (for a step function on a specific grid). |
| """ |
| import numpy as np |
| from scipy.optimize import minimize |
|
|
| target = 1.5052939684401607 |
|
|
| |
| |
| |
| |
|
|
| |
| |
|
|
| |
| print("Searching for exact representation 2*P*N/S^2 = target") |
| for N in range(50, 5001): |
| for S in range(1, 2*N): |
| P_exact = target * S**2 / (2 * N) |
| P_int = round(P_exact) |
| if abs(P_int - P_exact) < 1e-6 and P_int > 0: |
| c1 = 2 * P_int * N / S**2 |
| if abs(c1 - target) < 1e-10: |
| print(f" N={N}, S={S}, P={P_int}: C1 = {c1:.16f}, error = {c1-target:.2e}") |
|
|
| |
| |
| |
| |
| |
| |
|
|
| print("\n\nSearching for binary function: 2*N*r_max/k^2 = target") |
| for N in [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1500, 2000, 3000, 5000]: |
| for k in range(max(1, N//5), 4*N//5): |
| r_max = target * k**2 / (2*N) |
| r_int = round(r_max) |
| if abs(r_int - r_max) < 0.001 and r_int > 0: |
| c1 = 2 * N * r_int / k**2 |
| if abs(c1 - target) < 1e-8: |
| print(f" N={N}, k={k}, r_max={r_int}: C1 = {c1:.16f}") |
|
|
| |
| |
| |
| |
| |
| |
| print("\n\nChecking if target * M is close to integer:") |
| for M in range(1, 100000): |
| val = target * M |
| frac = val - round(val) |
| if abs(frac) < 1e-8: |
| print(f" target * {M} = {round(val)} (frac = {frac:.2e})") |
| if abs(frac) < 1e-12: |
| break |
|
|