Skip to content

Commit 430925a

Browse files
committed
make it simpler
1 parent 4e70a1b commit 430925a

File tree

4 files changed

+167
-162
lines changed

4 files changed

+167
-162
lines changed

examples/circle_packing/README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
# Circle Packing Example
1+
# Circle Packing Example (n=26)
22

3-
This example attempts to replicate one of the results from the AlphaEvolve paper (Section B.12): packing circles inside a unit square to maximize the sum of their radii.
3+
This example attempts to replicate one of the specific results from the AlphaEvolve paper (Section B.12): packing 26 circles inside a unit square to maximize the sum of their radii.
44

55
## Problem Description
66

7-
Given a positive integer n, the problem is to pack n disjoint circles inside a unit square so as to maximize the sum of their radii. The circles must:
7+
The problem is to pack 26 disjoint circles inside a unit square so as to maximize the sum of their radii. The circles must:
88
- Lie entirely within the unit square [0,1] × [0,1]
99
- Not overlap with each other
1010

1111
This is a well-studied problem in computational geometry with applications in various fields including material science, facility location, and computer graphics.
1212

13-
## AlphaEvolve Results
13+
## AlphaEvolve Result
1414

15-
According to the paper, AlphaEvolve found new constructions improving the state of the art:
16-
- For n = 26, improved from 2.634 to 2.635
17-
- For n = 32, improved from 2.936 to 2.937
15+
According to the paper, AlphaEvolve improved the state of the art for n=26 from 2.634 to 2.635.
1816

1917
## Running the Example
2018

@@ -25,16 +23,25 @@ python openevolve-run.py examples/circle_packing/initial_program.py examples/cir
2523
## Evaluation Metrics
2624

2725
The evaluator calculates several metrics:
28-
- `sum_radii_26`: Sum of radii for n=26
29-
- `sum_radii_32`: Sum of radii for n=32
30-
- `target_ratio_26`: Ratio of achieved sum to target (2.635) for n=26
31-
- `target_ratio_32`: Ratio of achieved sum to target (2.937) for n=32
32-
- `validity`: 1.0 if solutions for both n=26 and n=32 are valid, 0.0 otherwise
33-
- `avg_target_ratio`: Average of target ratios
34-
- `combined_score`: avg_target_ratio * validity (main fitness metric)
26+
- `sum_radii`: The best sum of radii achieved across all trials
27+
- `avg_sum_radii`: Average sum of radii across successful trials
28+
- `target_ratio`: Ratio of achieved sum to target (2.635)
29+
- `reliability`: Fraction of trials that produced valid solutions
30+
- `avg_time`: Average execution time
31+
- `combined_score`: A weighted combination of the above metrics (main fitness metric)
3532

3633
## Expected Results
3734

38-
A successful run should find packing arrangements with sums approaching or exceeding the values reported in the AlphaEvolve paper:
39-
- n=26: 2.635
40-
- n=32: 2.937
35+
A successful run should find a packing arrangement with sum of radii approaching or exceeding the value reported in the AlphaEvolve paper: 2.635 for n=26.
36+
37+
## Visualization
38+
39+
The initial program includes a visualization function that you can use to see the packing arrangement:
40+
41+
```python
42+
# Add this to the end of the best program
43+
if __name__ == "__main__":
44+
centers, radii, sum_radii = run_packing()
45+
print(f"Sum of radii: {sum_radii}")
46+
visualize(centers, radii)
47+
```

examples/circle_packing/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ llm:
2121

2222
# Prompt configuration
2323
prompt:
24-
system_message: "You are an expert programmer specializing in optimization algorithms and computational geometry. Your task is to improve a circle packing algorithm to maximize the sum of radii when packing n circles in a unit square without overlaps. The AlphaEvolve paper achieved a sum of 2.635 for n=26 and 2.937 for n=32. Focus on finding better optimization strategies to reach or exceed these values."
24+
system_message: "You are an expert programmer specializing in optimization algorithms and computational geometry. Your task is to improve a circle packing algorithm to maximize the sum of radii when packing 26 circles in a unit square without overlaps. The AlphaEvolve paper achieved a sum of 2.635 for n=26, which is the target value to reach or exceed. Focus on finding better optimization strategies, leveraging geometric insights about optimal packing arrangements, and developing more effective search techniques."
2525
num_top_programs: 3
2626
use_template_stochasticity: true
2727

0 commit comments

Comments
 (0)