Skip to content

Make circle packing TARGET_VALUE configurable via environment variable - #501

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
akushonkamen:fix/117-configurable-target-value
Oct 10, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
akushonkamen:fix/117-configurable-target-value

Conversation

@akushonkamen

Copy link
Copy Markdown
Contributor

Fixes #117

Problem

examples/circle_packing/evaluator.py hardcodes TARGET_VALUE = 2.635 (the AlphaEvolve result) in two places: locally inside evaluate() and again as target = 2.635 inside evaluate_stage1(). Since the repo's own docs treat 2.635 as "the goal", readers interpreted this as feeding the answer to the model ("cheating"), which is what issue #117 reports.

What

  • examples/circle_packing/evaluator.py: hoisted the target to a single module-level constant, read once from the environment with the historical default preserved:

    TARGET_VALUE = float(os.environ.get("CIRCLE_PACKING_TARGET_VALUE", "2.635"))

    Both evaluate() and evaluate_stage1() now reference the shared constant, so the double-hardcoding drift risk is gone. Keeping 2.635 as the default preserves comparability with existing runs' target_ratio/combined_score values. This is the natural config entry point because openevolve loads custom evaluators via importlib and calls evaluate(program_path) without passing config (openevolve/evaluator.py), so only module-level/environment configuration can reach it.

  • examples/circle_packing/README.md: new "Reproducibility & the target value" section explaining that the target only scales target_ratio/combined_score to create evolutionary pressure and does not leak a solution (quoting codelion: "You can put any other value for the target like 3.0 and it will still work..."), how to override it (export CIRCLE_PACKING_TARGET_VALUE=3.0), the empirical no-prior reference points (default config reached 2.634 in ~800 generations per Reproducing circle packing without providing TARGET_VALUE = 2.635 from AlphaEvolve paper #117; issue Seems a new circle packing result (2.635977) when reproducing your example 🎉 #156 reports 2.635977394746595 at iteration 206), and pointing out where the config_phase_*.yaml system messages mention 2.635 (with line numbers) for users who want a fully prior-free run.

  • tests/test_circle_packing_target_value.py: new unittest module (no LLM, no scipy needed; runs in ~0.5s). It evaluates a tiny deterministic program (26 fixed grid circles, run_packing() returns directly) through the evaluator loaded by path:

    • default: TARGET_VALUE == 2.635 and target_ratio == sum_radii / 2.635;
    • with patch.dict(os.environ, {"CIRCLE_PACKING_TARGET_VALUE": "3.0"}) and a fresh module load: TARGET_VALUE == 3.0, target_ratio == sum_radii / 3.0, and validity unchanged at 1.0 — proving the target only rescales fitness and does not affect validity;
    • evaluate() and evaluate_stage1() report the same target_ratio under the override (guards against the two call sites drifting apart again).

Red -> green evidence

  • Before the fix: test_default_target_value and test_target_value_from_environment fail with AttributeError: module 'circle_packing_evaluator' has no attribute 'TARGET_VALUE' (Ran 3 tests ... FAILED (errors=2)).
  • After the fix: Ran 3 tests in 0.437s ... OK, with the evaluator logging target=2.635, ratio=0.740038 vs target=3.0, ratio=0.650000 (validity 1.0 in both cases).

Full suite: OPENAI_API_KEY=test-key-for-unit-tests python -m unittest discover tests -> Ran 577 tests in 33.729s ... OK.

Notes

…lgorithmicsuperintelligence#117

- Hoist the evaluator's target from two hardcoded 2.635 literals to a single
  module-level TARGET_VALUE = float(os.environ.get("CIRCLE_PACKING_TARGET_VALUE", "2.635")),
  shared by evaluate() and evaluate_stage1()
- The target only scales target_ratio/combined_score (evolutionary pressure);
  the default keeps results comparable with existing runs
- Add "Reproducibility & the target value" section to the example README
- Add regression tests: default target, env override (ratio rescaled, validity
  unchanged), and evaluate()/evaluate_stage1() target consistency
@CLAassistant

CLAassistant commented Oct 8, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion merged commit 6bd32e1 into algorithmicsuperintelligence:main Oct 10, 2026
4 checks passed
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.

Reproducing circle packing without providing TARGET_VALUE = 2.635 from AlphaEvolve paper

3 participants