openevolve icon indicating copy to clipboard operation
openevolve copied to clipboard

Several evaluators accept non-finite or invalid inputs (second_autocorr_ineq, third_autocorr_ineq, hexagon_packing, circle_packing_with_artifacts)

Open maximusrufus opened this issue 1 month ago • 1 comments

These evaluators accept invalid inputs; details and a minimal reproducer for each are below.

second_autocorr_ineq evaluator accepts NaN/+inf in f_values

(Observed at commit 8c65f74.)

Affected: examples/alphaevolve_math_problems/second_autocorr_ineq/evaluator.py:30 (np.any(f_values < -1e-6)), :33, :55, :77. Reproducer:

printf 'import numpy as np\ndef run():\n    return np.full(10, np.nan), 0.9, 0.0, 10\n' > /tmp/p.py
cd examples/alphaevolve_math_problems/second_autocorr_ineq && python -c "import evaluator;print(evaluator.evaluate('/tmp/p.py'))"

Result: {'c2': nan, 'combined_score': nan, ...} with no error. np.inf behaves the same; -inf is rejected. Why invalid: f < -1e-6 is False for NaN, so the non-negativity check passes and a NaN c2 is returned as a successful evaluation. Fix:

+    if not np.isfinite(f_values).all():
+        raise ValueError("Function values must be finite")

third_autocorr_ineq evaluator accepts NaN/inf and ignores the check

(Observed at commit 8c65f74.)

Affected: examples/alphaevolve_math_problems/third_autocorr_ineq/evaluator.py:36, :46-47. Reproducer: same as Issue 1 with np.full(10, np.nan), 1.5, 0.0, 10, in third_autocorr_ineq. Result: {'c3': 1.5, 'combined_score': 0.970...}; np.inf and -np.inf give the same. Why invalid: computed_c3 is NaN, so delta > 1e-3 is False and the claimed c3 is scored unchecked. Fix: same np.isfinite guard before integral_f_sq.

hexagon_packing (11 and 12) evaluators accept NaN hexagons

(Observed at commit 8c65f74.)

Affected: examples/alphaevolve_math_problems/hexagon_packing/{11,12}/evaluator.py:79 (project_polygon), :86 (overlap_1d), :101, :130. Reproducer: a program returning np.full((11,3), np.nan), np.array([0.,0.,0.]), 0.1 from hexagon_packing_11(); evaluate(path) returns {'inv_outer_hex_side_length': 10.0, 'combined_score': 39.30...} (12: 39.42). A NaN or ±inf outer side is accepted too; ±inf inner coordinates are rejected. Why invalid: min/max skip NaN projections and overlap_1d, cross_product < -tol are False for NaN, so eleven NaN hexagons are neither overlapping nor outside a side-0.1 hexagon. Fix: reject non-finite inner_hex_data, centre, side and angle at the start of verify_construction, and require outer_hex_side_length > 0.

circle_packing_with_artifacts validate_packing accepts NaN centres and non-positive radii

(Observed at commit 8c65f74.)

Affected: examples/circle_packing_with_artifacts/evaluator.py:41-79 (boundary :55, overlap :66), used at :225 and :409. Reproducer: a program whose run_packing() returns np.full((26,2), np.nan), np.ones(26), 26.0; both evaluate and evaluate_stage1 report validity: 1.0, sum_radii: 26.0, combined_score: 9.87. A -inf radius, a NaN radius or a negative radius is also accepted (sum_radii: -inf); ±inf centres are rejected. Why invalid: every comparison involving NaN is False, so the circle is never constrained; negative radii pass both tests. Fix:

+    if not (np.isfinite(centers).all() and np.isfinite(radii).all() and (radii > 0).all()):
+        return False, validation_details

maximusrufus avatar Oct 26 '26 14:10 maximusrufus

Fixed on main by #553 (second and third autocorrelation), #555 (circle packing with artifacts) and #564 (hexagon packing). I re-ran the reproducers from this issue and each case is now rejected: the evaluators score 0, most with an explicit error. Thanks for the detailed report. Please reopen if you find another case.

codelion avatar Nov 02 '26 05:11 codelion