Skip to content

fix(examples): reject non-finite circles in circle_packing_rect evaluator - #551

Open
fixfon wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
fixfon:fix/548-circle-packing-rect-nan
Open

fixfon wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
fixfon:fix/548-circle-packing-rect-nan

Conversation

@fixfon

@fixfon fixfon commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

examples/alphaevolve_math_problems/circle_packing_rect/evaluator.py only checked radii for negative/NaN values, so a candidate with NaN circle centres passed every constraint: dist < r1 + r2 - tol and width + height > 2 + tol are both False for NaN. 21 circles of radius 1 at NaN centres scored radii_sum = 21.0 although a rectangle of perimeter 4 cannot hold them. Centres at infinity pass the same way (inf - inf is NaN), and a NaN centre next to an infinite radius scored inf.

This rejects any non-finite entry in circles right after the existing radius check, so the existing negative/NaN radius messages are unchanged.

Tests

New tests/test_circle_packing_rect_evaluator.py (same layout as tests/test_example_evaluator_integrity.py): NaN centres (the repro from the issue), infinite centres, infinite radius next to a NaN centre, an unchanged "nan radius" message, and a valid finite packing that still scores.

Fixes #548

…ator

The evaluator only checked radii for NaN. With NaN centres every overlap
and containment comparison is False, so 21 circles of radius 1 at NaN
centres scored radii_sum 21 although a rectangle of perimeter 4 cannot
hold them. Centres at infinity pass the same way (inf - inf is NaN), and
a NaN centre next to an infinite radius scored inf.

Reject any non-finite entry right after the radius check, so the existing
negative and nan radius messages are unchanged.

Fixes algorithmicsuperintelligence#548
@CLAassistant

CLAassistant commented Oct 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

circle_packing_rect evaluator accepts NaN circle centres

2 participants