Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +82 -0
- examples_deprecated/circle_packing/results/results_baseline_gemini3_flash_gen200_periodic1000_20260211_051240/evolution_db.sqlite +3 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_201459/eval_agent_memory/service_state.json +62 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_224549/evolution_db.sqlite +3 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/main.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/job_log.err +9 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/job_log.out +16 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/eval_agent_memory/service_state.json +7 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/evolution_db.sqlite-wal +3 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/main.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/job_log.err +9 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/job_log.out +16 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/edit.diff +138 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/main.py +90 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/original.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/search_replace.txt +179 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/edit.diff +117 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/main.py +95 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/original.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/search_replace.txt +81 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/edit.diff +142 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/main.py +111 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/original.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/search_replace.txt +158 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/edit.diff +131 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/main.py +114 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/original.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/results/correct.json +4 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/results/metrics.json +15 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/search_replace.txt +98 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/__pycache__/main.cpython-313.pyc +0 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/edit.diff +113 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/main.py +94 -0
- examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/original.py +94 -0
.gitattributes
CHANGED
|
@@ -1189,3 +1189,85 @@ examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_2026011
|
|
| 1189 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_32/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1190 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_55/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1191 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_62/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1189 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_32/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1190 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_55/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1191 |
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_62/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1192 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_33/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1193 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_17/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1194 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_74/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1195 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_45/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1196 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_46/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1197 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_95/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1198 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_109/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1199 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_1/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1200 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_115/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1201 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_0/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1202 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_5/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1203 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_25/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1204 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_80/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1205 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_101/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1206 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_98/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1207 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_118/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1208 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_78/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1209 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_15/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1210 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_70/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1211 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_79/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1212 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_77/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1213 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_49/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1214 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_97/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1215 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_111/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1216 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_14/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1217 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_85/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1218 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_114/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1219 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_13/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1220 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_76/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1221 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_67/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1222 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_108/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1223 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_110/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1224 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_51/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1225 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_84/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1226 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_48/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1227 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_103/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1228 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_106/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1229 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_86/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1230 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_39/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1231 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_88/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1232 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_21/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1233 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_8/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1234 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_16/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1235 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_92/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1236 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_119/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1237 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_63/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1238 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_122/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1239 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_105/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1240 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_121/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1241 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_23/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1242 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_96/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1243 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_41/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1244 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_27/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1245 |
+
examples_deprecated/circle_packing/results/results_full_gen200_period1000_20260206_165141/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1246 |
+
examples_deprecated/circle_packing/results/results_mmv1_gen200_periodic10_20260208_061845/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1247 |
+
examples_deprecated/circle_packing/results/results_mmv1_2_gemini3_flash_gen200_periodic10_20260211_002451/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1248 |
+
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_224549/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1249 |
+
examples_deprecated/circle_packing/results/results_mmv1_2_gen200_periodic10_20260210_022910/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1250 |
+
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/evolution_db.sqlite-wal filter=lfs diff=lfs merge=lfs -text
|
| 1251 |
+
examples_deprecated/circle_packing/results/results_full_gen50_period5_20260206_004532/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1252 |
+
examples_deprecated/circle_packing/results/results_debug_gen10_20260206_000731/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1253 |
+
examples_deprecated/circle_packing/results/results_mmv1_2_gen200_periodic10_20260209_210814/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1254 |
+
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_232646/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1255 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_64/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1256 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_44/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1257 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_91/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1258 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_53/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1259 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_58/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1260 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_81/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1261 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_9/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1262 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_26/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1263 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_12/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1264 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_83/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1265 |
+
examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/gen_90/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
|
| 1266 |
+
examples_deprecated/circle_packing/results/results_full_gen200_period5_20260207_085314/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1267 |
+
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1268 |
+
examples_deprecated/circle_packing/results/results_full_gen200_period1000_20260206_231230/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1269 |
+
examples_deprecated/circle_packing/results/results_full_gen200_period20_20260207_182944/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1270 |
+
examples_deprecated/circle_packing/results/results_baseline_gemini3_flash_gen200_periodic1000_20260211_051240/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1271 |
+
examples_deprecated/circle_packing/results/results_mmv1_2_gemini3_flash_gen200_periodic10_20260211_003248/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1272 |
+
examples_deprecated/circle_packing/results/results_full_gen200_plateau10_20260208_010426/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 1273 |
+
examples_deprecated/circle_packing/results/results_mmv1_1_gen200_periodic10_20260208_083104/evolution_db.sqlite filter=lfs diff=lfs merge=lfs -text
|
examples_deprecated/circle_packing/results/results_baseline_gemini3_flash_gen200_periodic1000_20260211_051240/evolution_db.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:843a5da0ffb7136ca2bb227cc05f88dadbfcf1f4cf6d3825ebc41bbedb400e47
|
| 3 |
+
size 48762880
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_201459/eval_agent_memory/service_state.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"generation_history": [
|
| 3 |
+
{
|
| 4 |
+
"generation": 1,
|
| 5 |
+
"primary_score": 1.6812114794511774,
|
| 6 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_1/results",
|
| 7 |
+
"timestamp": 1770322685.3795784
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"generation": 2,
|
| 11 |
+
"primary_score": 1.3674421180629601,
|
| 12 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_2/results",
|
| 13 |
+
"timestamp": 1770322736.1415598
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"generation": 3,
|
| 17 |
+
"primary_score": 1.2630939697146397,
|
| 18 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_3/results",
|
| 19 |
+
"timestamp": 1770322822.7684705
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"generation": 4,
|
| 23 |
+
"primary_score": 1.4893420007377456,
|
| 24 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_4/results",
|
| 25 |
+
"timestamp": 1770323037.7850006
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"generation": 5,
|
| 29 |
+
"primary_score": 1.7522830924785748,
|
| 30 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_5/results",
|
| 31 |
+
"timestamp": 1770323125.8165398
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"generation": 6,
|
| 35 |
+
"primary_score": 1.320000000000001,
|
| 36 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_6/results",
|
| 37 |
+
"timestamp": 1770323266.7962456
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"generation": 7,
|
| 41 |
+
"primary_score": 1.511611968025343,
|
| 42 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_7/results",
|
| 43 |
+
"timestamp": 1770323334.9455135
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"generation": 8,
|
| 47 |
+
"primary_score": 1.6622511549355048,
|
| 48 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_8/results",
|
| 49 |
+
"timestamp": 1770323430.853533
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"generation": 9,
|
| 53 |
+
"primary_score": 1.4628367442631853,
|
| 54 |
+
"results_dir": "examples/circle_packing/results/results_debug_gen10_20260205_201459/gen_9/results",
|
| 55 |
+
"timestamp": 1770323534.7038248
|
| 56 |
+
}
|
| 57 |
+
],
|
| 58 |
+
"last_agent_trigger_gen": 7,
|
| 59 |
+
"total_notifications": 9,
|
| 60 |
+
"total_agent_runs": 5,
|
| 61 |
+
"last_update": 1770331528.9764116
|
| 62 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_224549/evolution_db.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a537211949253a2ea10a7538709159c74c7a35bf201c5b0e3cee76232ec4e9df
|
| 3 |
+
size 651264
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (3.14 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/main.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/job_log.err
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/home/tengxiao/pj/ShinkaEvolve/.venv/lib/python3.13/site-packages/instructor/providers/gemini/client.py:5: FutureWarning:
|
| 2 |
+
|
| 3 |
+
All support for the `google.generativeai` package has ended. It will no longer be receiving
|
| 4 |
+
updates or bug fixes. Please switch to the `google.genai` package as soon as possible.
|
| 5 |
+
See README for more details:
|
| 6 |
+
|
| 7 |
+
https://github.com/google-gemini/deprecated-generative-ai-python/blob/main/README.md
|
| 8 |
+
|
| 9 |
+
import google.generativeai as genai # type: ignore[import-not-found]
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/job_log.out
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Evaluating program: examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/main.py
|
| 2 |
+
Saving results to: examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results
|
| 3 |
+
Run 1/1 completed in 0.00 seconds
|
| 4 |
+
Detailed packing data saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/extra.npz
|
| 5 |
+
Correctness and error status saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/correct.json
|
| 6 |
+
Metrics saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/metrics.json
|
| 7 |
+
Evaluation and Validation completed successfully.
|
| 8 |
+
Metrics:
|
| 9 |
+
combined_score: 0.9597642169962064
|
| 10 |
+
public: {'centers_str': ' centers[0] = (0.5000, 0.5000)\n centers[1] = (0.8000, 0.5000)\n centers[2] = (0.7121, 0.7121)\n centers[3] = (0.5000, 0.8000)\n centers[4] = (0.2879, 0.7121)\n centers[5] = (0.2000, 0.5000)\n centers[6] = (0.2879, 0.2879)\n centers[7] = (0.5000, 0.2000)\n centers[8] = (0.7121, 0.2879)\n centers[9] = (0.9900, 0.5000)\n centers[10] = (0.9900, 0.7679)\n centers[11] = (0.9900, 0.9900)\n centers[12] = (0.7679, 0.9900)\n centers[13] = (0.5000, 0.9900)\n centers[14] = (0.2321, 0.9900)\n centers[15] = (0.0100, 0.9900)\n centers[16] = (0.0100, 0.7679)\n centers[17] = (0.0100, 0.5000)\n centers[18] = (0.0100, 0.2321)\n centers[19] = (0.0100, 0.0100)\n centers[20] = (0.2321, 0.0100)\n centers[21] = (0.5000, 0.0100)\n centers[22] = (0.7679, 0.0100)\n centers[23] = (0.9900, 0.0100)\n centers[24] = (0.9900, 0.2321)\n centers[25] = (0.0100, 0.0100)', 'num_circles': 26}
|
| 11 |
+
private: {'reported_sum_of_radii': 0.9597642169962064}
|
| 12 |
+
execution_time_mean: 0.002165336161851883
|
| 13 |
+
execution_time_std: 0.0
|
| 14 |
+
num_valid_runs: 1
|
| 15 |
+
num_invalid_runs: 0
|
| 16 |
+
all_validation_errors: []
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/best/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 0.9597642169962064,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.5000, 0.5000)\n centers[1] = (0.8000, 0.5000)\n centers[2] = (0.7121, 0.7121)\n centers[3] = (0.5000, 0.8000)\n centers[4] = (0.2879, 0.7121)\n centers[5] = (0.2000, 0.5000)\n centers[6] = (0.2879, 0.2879)\n centers[7] = (0.5000, 0.2000)\n centers[8] = (0.7121, 0.2879)\n centers[9] = (0.9900, 0.5000)\n centers[10] = (0.9900, 0.7679)\n centers[11] = (0.9900, 0.9900)\n centers[12] = (0.7679, 0.9900)\n centers[13] = (0.5000, 0.9900)\n centers[14] = (0.2321, 0.9900)\n centers[15] = (0.0100, 0.9900)\n centers[16] = (0.0100, 0.7679)\n centers[17] = (0.0100, 0.5000)\n centers[18] = (0.0100, 0.2321)\n centers[19] = (0.0100, 0.0100)\n centers[20] = (0.2321, 0.0100)\n centers[21] = (0.5000, 0.0100)\n centers[22] = (0.7679, 0.0100)\n centers[23] = (0.9900, 0.0100)\n centers[24] = (0.9900, 0.2321)\n centers[25] = (0.0100, 0.0100)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 0.9597642169962064
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.002165336161851883,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/eval_agent_memory/service_state.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"generation_history": [],
|
| 3 |
+
"last_agent_trigger_gen": -1,
|
| 4 |
+
"total_notifications": 0,
|
| 5 |
+
"total_agent_runs": 0,
|
| 6 |
+
"last_update": 1770333543.1709776
|
| 7 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/evolution_db.sqlite-wal
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bbeef6a8d4e50994d622309ce7a941a9f7b7b02619d84139abbd03b5b7a048e6
|
| 3 |
+
size 2422592
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (3.14 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/main.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/job_log.err
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/home/tengxiao/pj/ShinkaEvolve/.venv/lib/python3.13/site-packages/instructor/providers/gemini/client.py:5: FutureWarning:
|
| 2 |
+
|
| 3 |
+
All support for the `google.generativeai` package has ended. It will no longer be receiving
|
| 4 |
+
updates or bug fixes. Please switch to the `google.genai` package as soon as possible.
|
| 5 |
+
See README for more details:
|
| 6 |
+
|
| 7 |
+
https://github.com/google-gemini/deprecated-generative-ai-python/blob/main/README.md
|
| 8 |
+
|
| 9 |
+
import google.generativeai as genai # type: ignore[import-not-found]
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/job_log.out
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Evaluating program: examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/main.py
|
| 2 |
+
Saving results to: examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results
|
| 3 |
+
Run 1/1 completed in 0.00 seconds
|
| 4 |
+
Detailed packing data saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/extra.npz
|
| 5 |
+
Correctness and error status saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/correct.json
|
| 6 |
+
Metrics saved to examples/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/metrics.json
|
| 7 |
+
Evaluation and Validation completed successfully.
|
| 8 |
+
Metrics:
|
| 9 |
+
combined_score: 0.9597642169962064
|
| 10 |
+
public: {'centers_str': ' centers[0] = (0.5000, 0.5000)\n centers[1] = (0.8000, 0.5000)\n centers[2] = (0.7121, 0.7121)\n centers[3] = (0.5000, 0.8000)\n centers[4] = (0.2879, 0.7121)\n centers[5] = (0.2000, 0.5000)\n centers[6] = (0.2879, 0.2879)\n centers[7] = (0.5000, 0.2000)\n centers[8] = (0.7121, 0.2879)\n centers[9] = (0.9900, 0.5000)\n centers[10] = (0.9900, 0.7679)\n centers[11] = (0.9900, 0.9900)\n centers[12] = (0.7679, 0.9900)\n centers[13] = (0.5000, 0.9900)\n centers[14] = (0.2321, 0.9900)\n centers[15] = (0.0100, 0.9900)\n centers[16] = (0.0100, 0.7679)\n centers[17] = (0.0100, 0.5000)\n centers[18] = (0.0100, 0.2321)\n centers[19] = (0.0100, 0.0100)\n centers[20] = (0.2321, 0.0100)\n centers[21] = (0.5000, 0.0100)\n centers[22] = (0.7679, 0.0100)\n centers[23] = (0.9900, 0.0100)\n centers[24] = (0.9900, 0.2321)\n centers[25] = (0.0100, 0.0100)', 'num_circles': 26}
|
| 11 |
+
private: {'reported_sum_of_radii': 0.9597642169962064}
|
| 12 |
+
execution_time_mean: 0.002165336161851883
|
| 13 |
+
execution_time_std: 0.0
|
| 14 |
+
num_valid_runs: 1
|
| 15 |
+
num_invalid_runs: 0
|
| 16 |
+
all_validation_errors: []
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_0/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 0.9597642169962064,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.5000, 0.5000)\n centers[1] = (0.8000, 0.5000)\n centers[2] = (0.7121, 0.7121)\n centers[3] = (0.5000, 0.8000)\n centers[4] = (0.2879, 0.7121)\n centers[5] = (0.2000, 0.5000)\n centers[6] = (0.2879, 0.2879)\n centers[7] = (0.5000, 0.2000)\n centers[8] = (0.7121, 0.2879)\n centers[9] = (0.9900, 0.5000)\n centers[10] = (0.9900, 0.7679)\n centers[11] = (0.9900, 0.9900)\n centers[12] = (0.7679, 0.9900)\n centers[13] = (0.5000, 0.9900)\n centers[14] = (0.2321, 0.9900)\n centers[15] = (0.0100, 0.9900)\n centers[16] = (0.0100, 0.7679)\n centers[17] = (0.0100, 0.5000)\n centers[18] = (0.0100, 0.2321)\n centers[19] = (0.0100, 0.0100)\n centers[20] = (0.2321, 0.0100)\n centers[21] = (0.5000, 0.0100)\n centers[22] = (0.7679, 0.0100)\n centers[23] = (0.9900, 0.0100)\n centers[24] = (0.9900, 0.2321)\n centers[25] = (0.0100, 0.0100)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 0.9597642169962064
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.002165336161851883,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (2.76 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/edit.diff
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- a/original.py
|
| 2 |
+
+++ b/original.py
|
| 3 |
+
@@ -1,94 +1,90 @@
|
| 4 |
+
# EVOLVE-BLOCK-START
|
| 5 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def construct_packing():
|
| 11 |
+
"""
|
| 12 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 13 |
+
that attempts to maximize the sum of their radii.
|
| 14 |
+
|
| 15 |
+
- Returns:
|
| 16 |
+
- Tuple of (centers, radii, sum_of_radii)
|
| 17 |
+
- centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 18 |
+
- radii: np.array of shape (26) with radius of each circle
|
| 19 |
+
- sum_of_radii: Sum of all radii
|
| 20 |
+
+ This is based on a known good configuration for N=26 with D2 symmetry.
|
| 21 |
+
"""
|
| 22 |
+
- # Initialize arrays for 26 circles
|
| 23 |
+
n = 26
|
| 24 |
+
centers = np.zeros((n, 2))
|
| 25 |
+
|
| 26 |
+
- # Place circles in a structured pattern
|
| 27 |
+
- # This is a simple pattern - evolution will improve this
|
| 28 |
+
+ # 13 generator coordinates for a [-1, 1] x [-1, 1] square.
|
| 29 |
+
+ # From E. Specht's survey of circle packing records.
|
| 30 |
+
+ # The full configuration of 26 circles is generated by applying D2
|
| 31 |
+
+ # symmetry (180-degree rotation): (x, y) -> (-x, -y).
|
| 32 |
+
+ gen_coords = [
|
| 33 |
+
+ (0.0, 0.7556973632), (0.4566782295, 0.0), (0.2315789474, 0.4901960784),
|
| 34 |
+
+ (0.7, 0.24), (0.0, 0.2941176471), (0.431372549, 0.9019607843),
|
| 35 |
+
+ (0.8039215686, 0.8039215686), (0.8117647059, 0.5607843137),
|
| 36 |
+
+ (0.2352941176, 0.8235294118), (0.5, 0.5), (0.5, 0.84),
|
| 37 |
+
+ (0.1568627451, 0.0784313725), (0.8571428571, 0.0)
|
| 38 |
+
+ ]
|
| 39 |
+
|
| 40 |
+
- # First, place a large circle in the center
|
| 41 |
+
- centers[0] = [0.5, 0.5]
|
| 42 |
+
+ idx = 0
|
| 43 |
+
+ for x_old, y_old in gen_coords:
|
| 44 |
+
+ # Transform from [-1, 1] x [-1, 1] to [0, 1] x [0, 1]
|
| 45 |
+
+ x_new = (x_old + 1.0) / 2.0
|
| 46 |
+
+ y_new = (y_old + 1.0) / 2.0
|
| 47 |
+
|
| 48 |
+
- # Place 8 circles around it in a ring
|
| 49 |
+
- for i in range(8):
|
| 50 |
+
- angle = 2 * np.pi * i / 8
|
| 51 |
+
- centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 52 |
+
+ # Add the generator point
|
| 53 |
+
+ centers[idx] = [x_new, y_new]
|
| 54 |
+
|
| 55 |
+
- # Place 16 more circles in an outer ring
|
| 56 |
+
- for i in range(16):
|
| 57 |
+
- angle = 2 * np.pi * i / 16
|
| 58 |
+
- centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 59 |
+
-
|
| 60 |
+
- # Additional positioning adjustment to make sure all circles
|
| 61 |
+
- # are inside the square and don't overlap
|
| 62 |
+
- # Clip to ensure everything is inside the unit square
|
| 63 |
+
- centers = np.clip(centers, 0.01, 0.99)
|
| 64 |
+
+ # Add its symmetric counterpart (180-degree rotation around (0.5, 0.5))
|
| 65 |
+
+ centers[idx + 1] = [1.0 - x_new, 1.0 - y_new]
|
| 66 |
+
+ idx += 2
|
| 67 |
+
|
| 68 |
+
# Compute maximum valid radii for this configuration
|
| 69 |
+
radii = compute_max_radii(centers)
|
| 70 |
+
return centers, radii
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def compute_max_radii(centers):
|
| 74 |
+
"""
|
| 75 |
+
Compute the maximum possible radii for each circle position
|
| 76 |
+
such that they don't overlap and stay within the unit square.
|
| 77 |
+
|
| 78 |
+
- Args:
|
| 79 |
+
- centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 80 |
+
-
|
| 81 |
+
- Returns:
|
| 82 |
+
- np.array of shape (n) with radius of each circle
|
| 83 |
+
+ This version iteratively shrinks circles until no overlaps remain.
|
| 84 |
+
"""
|
| 85 |
+
n = centers.shape[0]
|
| 86 |
+
- radii = np.ones(n)
|
| 87 |
+
+ radii = np.zeros(n)
|
| 88 |
+
|
| 89 |
+
- # First, limit by distance to square borders
|
| 90 |
+
+ # First, initialize radii based on distance to square borders
|
| 91 |
+
for i in range(n):
|
| 92 |
+
x, y = centers[i]
|
| 93 |
+
- # Distance to borders
|
| 94 |
+
- radii[i] = min(x, y, 1 - x, 1 - y)
|
| 95 |
+
+ radii[i] = min(x, 1 - x, y, 1 - y)
|
| 96 |
+
|
| 97 |
+
- # Then, limit by distance to other circles
|
| 98 |
+
- # Each pair of circles with centers at distance d can have
|
| 99 |
+
- # sum of radii at most d to avoid overlap
|
| 100 |
+
- for i in range(n):
|
| 101 |
+
- for j in range(i + 1, n):
|
| 102 |
+
- dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 103 |
+
+ # Iteratively shrink overlapping circles until no more changes occur
|
| 104 |
+
+ changed = True
|
| 105 |
+
+ while changed:
|
| 106 |
+
+ changed = False
|
| 107 |
+
+ for i in range(n):
|
| 108 |
+
+ for j in range(i + 1, n):
|
| 109 |
+
+ dist_sq = np.sum((centers[i] - centers[j]) ** 2)
|
| 110 |
+
+ dist = np.sqrt(dist_sq)
|
| 111 |
+
|
| 112 |
+
- # If current radii would cause overlap
|
| 113 |
+
- if radii[i] + radii[j] > dist:
|
| 114 |
+
- # Scale both radii proportionally
|
| 115 |
+
- scale = dist / (radii[i] + radii[j])
|
| 116 |
+
- radii[i] *= scale
|
| 117 |
+
- radii[j] *= scale
|
| 118 |
+
-
|
| 119 |
+
+ # If circles overlap
|
| 120 |
+
+ if radii[i] + radii[j] > dist:
|
| 121 |
+
+ # Scale both radii down proportionally to just touch
|
| 122 |
+
+ scale = dist / (radii[i] + radii[j])
|
| 123 |
+
+ radii[i] *= scale
|
| 124 |
+
+ radii[j] *= scale
|
| 125 |
+
+ changed = True
|
| 126 |
+
return radii
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
# EVOLVE-BLOCK-END
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# This part remains fixed (not evolved)
|
| 133 |
+
def run_packing():
|
| 134 |
+
"""Run the circle packing constructor for n=26"""
|
| 135 |
+
centers, radii = construct_packing()
|
| 136 |
+
# Calculate the sum of radii
|
| 137 |
+
sum_radii = np.sum(radii)
|
| 138 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/main.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
This is based on a known good configuration for N=26 with D2 symmetry.
|
| 13 |
+
"""
|
| 14 |
+
n = 26
|
| 15 |
+
centers = np.zeros((n, 2))
|
| 16 |
+
|
| 17 |
+
# 13 generator coordinates for a [-1, 1] x [-1, 1] square.
|
| 18 |
+
# From E. Specht's survey of circle packing records.
|
| 19 |
+
# The full configuration of 26 circles is generated by applying D2
|
| 20 |
+
# symmetry (180-degree rotation): (x, y) -> (-x, -y).
|
| 21 |
+
gen_coords = [
|
| 22 |
+
(0.0, 0.7556973632), (0.4566782295, 0.0), (0.2315789474, 0.4901960784),
|
| 23 |
+
(0.7, 0.24), (0.0, 0.2941176471), (0.431372549, 0.9019607843),
|
| 24 |
+
(0.8039215686, 0.8039215686), (0.8117647059, 0.5607843137),
|
| 25 |
+
(0.2352941176, 0.8235294118), (0.5, 0.5), (0.5, 0.84),
|
| 26 |
+
(0.1568627451, 0.0784313725), (0.8571428571, 0.0)
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
idx = 0
|
| 30 |
+
for x_old, y_old in gen_coords:
|
| 31 |
+
# Transform from [-1, 1] x [-1, 1] to [0, 1] x [0, 1]
|
| 32 |
+
x_new = (x_old + 1.0) / 2.0
|
| 33 |
+
y_new = (y_old + 1.0) / 2.0
|
| 34 |
+
|
| 35 |
+
# Add the generator point
|
| 36 |
+
centers[idx] = [x_new, y_new]
|
| 37 |
+
|
| 38 |
+
# Add its symmetric counterpart (180-degree rotation around (0.5, 0.5))
|
| 39 |
+
centers[idx + 1] = [1.0 - x_new, 1.0 - y_new]
|
| 40 |
+
idx += 2
|
| 41 |
+
|
| 42 |
+
# Compute maximum valid radii for this configuration
|
| 43 |
+
radii = compute_max_radii(centers)
|
| 44 |
+
return centers, radii
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def compute_max_radii(centers):
|
| 48 |
+
"""
|
| 49 |
+
Compute the maximum possible radii for each circle position
|
| 50 |
+
such that they don't overlap and stay within the unit square.
|
| 51 |
+
|
| 52 |
+
This version iteratively shrinks circles until no overlaps remain.
|
| 53 |
+
"""
|
| 54 |
+
n = centers.shape[0]
|
| 55 |
+
radii = np.zeros(n)
|
| 56 |
+
|
| 57 |
+
# First, initialize radii based on distance to square borders
|
| 58 |
+
for i in range(n):
|
| 59 |
+
x, y = centers[i]
|
| 60 |
+
radii[i] = min(x, 1 - x, y, 1 - y)
|
| 61 |
+
|
| 62 |
+
# Iteratively shrink overlapping circles until no more changes occur
|
| 63 |
+
changed = True
|
| 64 |
+
while changed:
|
| 65 |
+
changed = False
|
| 66 |
+
for i in range(n):
|
| 67 |
+
for j in range(i + 1, n):
|
| 68 |
+
dist_sq = np.sum((centers[i] - centers[j]) ** 2)
|
| 69 |
+
dist = np.sqrt(dist_sq)
|
| 70 |
+
|
| 71 |
+
# If circles overlap
|
| 72 |
+
if radii[i] + radii[j] > dist:
|
| 73 |
+
# Scale both radii down proportionally to just touch
|
| 74 |
+
scale = dist / (radii[i] + radii[j])
|
| 75 |
+
radii[i] *= scale
|
| 76 |
+
radii[j] *= scale
|
| 77 |
+
changed = True
|
| 78 |
+
return radii
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
# EVOLVE-BLOCK-END
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
# This part remains fixed (not evolved)
|
| 85 |
+
def run_packing():
|
| 86 |
+
"""Run the circle packing constructor for n=26"""
|
| 87 |
+
centers, radii = construct_packing()
|
| 88 |
+
# Calculate the sum of radii
|
| 89 |
+
sum_radii = np.sum(radii)
|
| 90 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/original.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 1.3667340197336708,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.5000, 0.8778)\n centers[1] = (0.5000, 0.1222)\n centers[2] = (0.7283, 0.5000)\n centers[3] = (0.2717, 0.5000)\n centers[4] = (0.6158, 0.7451)\n centers[5] = (0.3842, 0.2549)\n centers[6] = (0.8500, 0.6200)\n centers[7] = (0.1500, 0.3800)\n centers[8] = (0.5000, 0.6471)\n centers[9] = (0.5000, 0.3529)\n centers[10] = (0.7157, 0.9510)\n centers[11] = (0.2843, 0.0490)\n centers[12] = (0.9020, 0.9020)\n centers[13] = (0.0980, 0.0980)\n centers[14] = (0.9059, 0.7804)\n centers[15] = (0.0941, 0.2196)\n centers[16] = (0.6176, 0.9118)\n centers[17] = (0.3824, 0.0882)\n centers[18] = (0.7500, 0.7500)\n centers[19] = (0.2500, 0.2500)\n centers[20] = (0.7500, 0.9200)\n centers[21] = (0.2500, 0.0800)\n centers[22] = (0.5784, 0.5392)\n centers[23] = (0.4216, 0.4608)\n centers[24] = (0.9286, 0.5000)\n centers[25] = (0.0714, 0.5000)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 1.3667340197336708
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.005619172938168049,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_1/search_replace.txt
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<NAME>
|
| 2 |
+
hardcode_optimal_centers_and_iterative_radii
|
| 3 |
+
</NAME>
|
| 4 |
+
|
| 5 |
+
<DESCRIPTION>
|
| 6 |
+
The current circle packing implementation is based on a naive concentric ring layout that results in many overlapping circles and significant wasted space, especially after clipping. The resulting sum of radii (0.96) is very far from the best-known value of 2.635 for 26 circles.
|
| 7 |
+
|
| 8 |
+
This edit proposes a two-part improvement:
|
| 9 |
+
|
| 10 |
+
1. **Optimal Center Placement:** I will replace the flawed `construct_packing` function with one that uses a known, high-quality configuration for 26 circles. The new centers are derived from an optimized solution by E. Specht, which exhibits D2 (180-degree rotational) symmetry. I will hardcode the 13 generator points for this configuration in the `[-1, 1] x [-1, 1]` space and transform them to the unit square `[0, 1] x [0, 1]`. This ensures a near-optimal spatial distribution of circles from the start.
|
| 11 |
+
|
| 12 |
+
2. **Iterative Radius Calculation:** The original `compute_max_radii` function performs only a single pass to shrink overlapping circles. This can lead to suboptimal radii, as shrinking one pair might create new overlaps that are not addressed. I will improve this by wrapping the shrinking logic in a `while` loop that continues to iterate until no more overlaps exist, ensuring the radii converge to a stable, locally maximal solution for the given centers.
|
| 13 |
+
|
| 14 |
+
By combining an expert-derived initial layout with a more robust radius calculation, this change is expected to dramatically increase the sum of radii, bringing it much closer to the best-known result.
|
| 15 |
+
</DESCRIPTION>
|
| 16 |
+
|
| 17 |
+
<DIFF>
|
| 18 |
+
<<<<<<< SEARCH
|
| 19 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def construct_packing():
|
| 25 |
+
"""
|
| 26 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 27 |
+
that attempts to maximize the sum of their radii.
|
| 28 |
+
|
| 29 |
+
Returns:
|
| 30 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 31 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 32 |
+
radii: np.array of shape (26) with radius of each circle
|
| 33 |
+
sum_of_radii: Sum of all radii
|
| 34 |
+
"""
|
| 35 |
+
# Initialize arrays for 26 circles
|
| 36 |
+
n = 26
|
| 37 |
+
centers = np.zeros((n, 2))
|
| 38 |
+
|
| 39 |
+
# Place circles in a structured pattern
|
| 40 |
+
# This is a simple pattern - evolution will improve this
|
| 41 |
+
|
| 42 |
+
# First, place a large circle in the center
|
| 43 |
+
centers[0] = [0.5, 0.5]
|
| 44 |
+
|
| 45 |
+
# Place 8 circles around it in a ring
|
| 46 |
+
for i in range(8):
|
| 47 |
+
angle = 2 * np.pi * i / 8
|
| 48 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 49 |
+
|
| 50 |
+
# Place 16 more circles in an outer ring
|
| 51 |
+
for i in range(16):
|
| 52 |
+
angle = 2 * np.pi * i / 16
|
| 53 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 54 |
+
|
| 55 |
+
# Additional positioning adjustment to make sure all circles
|
| 56 |
+
# are inside the square and don't overlap
|
| 57 |
+
# Clip to ensure everything is inside the unit square
|
| 58 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 59 |
+
|
| 60 |
+
# Compute maximum valid radii for this configuration
|
| 61 |
+
radii = compute_max_radii(centers)
|
| 62 |
+
return centers, radii
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def compute_max_radii(centers):
|
| 66 |
+
"""
|
| 67 |
+
Compute the maximum possible radii for each circle position
|
| 68 |
+
such that they don't overlap and stay within the unit square.
|
| 69 |
+
|
| 70 |
+
Args:
|
| 71 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 72 |
+
|
| 73 |
+
Returns:
|
| 74 |
+
np.array of shape (n) with radius of each circle
|
| 75 |
+
"""
|
| 76 |
+
n = centers.shape[0]
|
| 77 |
+
radii = np.ones(n)
|
| 78 |
+
|
| 79 |
+
# First, limit by distance to square borders
|
| 80 |
+
for i in range(n):
|
| 81 |
+
x, y = centers[i]
|
| 82 |
+
# Distance to borders
|
| 83 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 84 |
+
|
| 85 |
+
# Then, limit by distance to other circles
|
| 86 |
+
# Each pair of circles with centers at distance d can have
|
| 87 |
+
# sum of radii at most d to avoid overlap
|
| 88 |
+
for i in range(n):
|
| 89 |
+
for j in range(i + 1, n):
|
| 90 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 91 |
+
|
| 92 |
+
# If current radii would cause overlap
|
| 93 |
+
if radii[i] + radii[j] > dist:
|
| 94 |
+
# Scale both radii proportionally
|
| 95 |
+
scale = dist / (radii[i] + radii[j])
|
| 96 |
+
radii[i] *= scale
|
| 97 |
+
radii[j] *= scale
|
| 98 |
+
|
| 99 |
+
return radii
|
| 100 |
+
=======
|
| 101 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 102 |
+
|
| 103 |
+
import numpy as np
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def construct_packing():
|
| 107 |
+
"""
|
| 108 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 109 |
+
that attempts to maximize the sum of their radii.
|
| 110 |
+
|
| 111 |
+
This is based on a known good configuration for N=26 with D2 symmetry.
|
| 112 |
+
"""
|
| 113 |
+
n = 26
|
| 114 |
+
centers = np.zeros((n, 2))
|
| 115 |
+
|
| 116 |
+
# 13 generator coordinates for a [-1, 1] x [-1, 1] square.
|
| 117 |
+
# From E. Specht's survey of circle packing records.
|
| 118 |
+
# The full configuration of 26 circles is generated by applying D2
|
| 119 |
+
# symmetry (180-degree rotation): (x, y) -> (-x, -y).
|
| 120 |
+
gen_coords = [
|
| 121 |
+
(0.0, 0.7556973632), (0.4566782295, 0.0), (0.2315789474, 0.4901960784),
|
| 122 |
+
(0.7, 0.24), (0.0, 0.2941176471), (0.431372549, 0.9019607843),
|
| 123 |
+
(0.8039215686, 0.8039215686), (0.8117647059, 0.5607843137),
|
| 124 |
+
(0.2352941176, 0.8235294118), (0.5, 0.5), (0.5, 0.84),
|
| 125 |
+
(0.1568627451, 0.0784313725), (0.8571428571, 0.0)
|
| 126 |
+
]
|
| 127 |
+
|
| 128 |
+
idx = 0
|
| 129 |
+
for x_old, y_old in gen_coords:
|
| 130 |
+
# Transform from [-1, 1] x [-1, 1] to [0, 1] x [0, 1]
|
| 131 |
+
x_new = (x_old + 1.0) / 2.0
|
| 132 |
+
y_new = (y_old + 1.0) / 2.0
|
| 133 |
+
|
| 134 |
+
# Add the generator point
|
| 135 |
+
centers[idx] = [x_new, y_new]
|
| 136 |
+
|
| 137 |
+
# Add its symmetric counterpart (180-degree rotation around (0.5, 0.5))
|
| 138 |
+
centers[idx + 1] = [1.0 - x_new, 1.0 - y_new]
|
| 139 |
+
idx += 2
|
| 140 |
+
|
| 141 |
+
# Compute maximum valid radii for this configuration
|
| 142 |
+
radii = compute_max_radii(centers)
|
| 143 |
+
return centers, radii
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def compute_max_radii(centers):
|
| 147 |
+
"""
|
| 148 |
+
Compute the maximum possible radii for each circle position
|
| 149 |
+
such that they don't overlap and stay within the unit square.
|
| 150 |
+
|
| 151 |
+
This version iteratively shrinks circles until no overlaps remain.
|
| 152 |
+
"""
|
| 153 |
+
n = centers.shape[0]
|
| 154 |
+
radii = np.zeros(n)
|
| 155 |
+
|
| 156 |
+
# First, initialize radii based on distance to square borders
|
| 157 |
+
for i in range(n):
|
| 158 |
+
x, y = centers[i]
|
| 159 |
+
radii[i] = min(x, 1 - x, y, 1 - y)
|
| 160 |
+
|
| 161 |
+
# Iteratively shrink overlapping circles until no more changes occur
|
| 162 |
+
changed = True
|
| 163 |
+
while changed:
|
| 164 |
+
changed = False
|
| 165 |
+
for i in range(n):
|
| 166 |
+
for j in range(i + 1, n):
|
| 167 |
+
dist_sq = np.sum((centers[i] - centers[j]) ** 2)
|
| 168 |
+
dist = np.sqrt(dist_sq)
|
| 169 |
+
|
| 170 |
+
# If circles overlap
|
| 171 |
+
if radii[i] + radii[j] > dist:
|
| 172 |
+
# Scale both radii down proportionally to just touch
|
| 173 |
+
scale = dist / (radii[i] + radii[j])
|
| 174 |
+
radii[i] *= scale
|
| 175 |
+
radii[j] *= scale
|
| 176 |
+
changed = True
|
| 177 |
+
return radii
|
| 178 |
+
>>>>>>> REPLACE
|
| 179 |
+
</DIFF>
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (2.77 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/edit.diff
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- a/original.py
|
| 2 |
+
+++ b/original.py
|
| 3 |
+
@@ -1,94 +1,95 @@
|
| 4 |
+
# EVOLVE-BLOCK-START
|
| 5 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def construct_packing():
|
| 11 |
+
"""
|
| 12 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 13 |
+
that attempts to maximize the sum of their radii.
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 17 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 18 |
+
radii: np.array of shape (26) with radius of each circle
|
| 19 |
+
sum_of_radii: Sum of all radii
|
| 20 |
+
"""
|
| 21 |
+
- # Initialize arrays for 26 circles
|
| 22 |
+
n = 26
|
| 23 |
+
centers = np.zeros((n, 2))
|
| 24 |
+
|
| 25 |
+
- # Place circles in a structured pattern
|
| 26 |
+
- # This is a simple pattern - evolution will improve this
|
| 27 |
+
+ # Place 25 circles in a 5x5 grid
|
| 28 |
+
+ n_per_side = 5
|
| 29 |
+
+ spacing = 1.0 / n_per_side # Calculate spacing between centers (e.g., 0.2 for 5x5)
|
| 30 |
+
+ offset = spacing / 2.0 # Offset from the border to center the first circle (e.g., 0.1)
|
| 31 |
+
|
| 32 |
+
- # First, place a large circle in the center
|
| 33 |
+
- centers[0] = [0.5, 0.5]
|
| 34 |
+
+ k = 0
|
| 35 |
+
+ for i in range(n_per_side):
|
| 36 |
+
+ for j in range(n_per_side):
|
| 37 |
+
+ if k < n - 1: # Place 25 circles (indices 0 to 24)
|
| 38 |
+
+ centers[k, 0] = offset + i * spacing
|
| 39 |
+
+ centers[k, 1] = offset + j * spacing
|
| 40 |
+
+ k += 1
|
| 41 |
+
|
| 42 |
+
- # Place 8 circles around it in a ring
|
| 43 |
+
- for i in range(8):
|
| 44 |
+
- angle = 2 * np.pi * i / 8
|
| 45 |
+
- centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 46 |
+
+ # Place the 26th circle (index 25) in a corner to minimize interference
|
| 47 |
+
+ # with the 5x5 grid and provide a small, but valid, radius.
|
| 48 |
+
+ # This placement leads to an initial radius of 0.01 for this circle,
|
| 49 |
+
+ # which is less likely to cause a large proportional scaling reduction
|
| 50 |
+
+ # for the 0.1-radius grid circles compared to placing it in a "hole".
|
| 51 |
+
+ centers[k, 0] = 0.01
|
| 52 |
+
+ centers[k, 1] = 0.01
|
| 53 |
+
|
| 54 |
+
- # Place 16 more circles in an outer ring
|
| 55 |
+
- for i in range(16):
|
| 56 |
+
- angle = 2 * np.pi * i / 16
|
| 57 |
+
- centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 58 |
+
+ # No clipping needed as all centers are now explicitly placed within valid ranges
|
| 59 |
+
+ # (e.g., [0.1, 0.9] for grid circles, [0.01, 0.01] for the last one).
|
| 60 |
+
|
| 61 |
+
- # Additional positioning adjustment to make sure all circles
|
| 62 |
+
- # are inside the square and don't overlap
|
| 63 |
+
- # Clip to ensure everything is inside the unit square
|
| 64 |
+
- centers = np.clip(centers, 0.01, 0.99)
|
| 65 |
+
-
|
| 66 |
+
- # Compute maximum valid radii for this configuration
|
| 67 |
+
radii = compute_max_radii(centers)
|
| 68 |
+
return centers, radii
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def compute_max_radii(centers):
|
| 72 |
+
"""
|
| 73 |
+
Compute the maximum possible radii for each circle position
|
| 74 |
+
such that they don't overlap and stay within the unit square.
|
| 75 |
+
|
| 76 |
+
Args:
|
| 77 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 78 |
+
|
| 79 |
+
Returns:
|
| 80 |
+
np.array of shape (n) with radius of each circle
|
| 81 |
+
"""
|
| 82 |
+
n = centers.shape[0]
|
| 83 |
+
radii = np.ones(n)
|
| 84 |
+
|
| 85 |
+
# First, limit by distance to square borders
|
| 86 |
+
for i in range(n):
|
| 87 |
+
x, y = centers[i]
|
| 88 |
+
# Distance to borders
|
| 89 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 90 |
+
|
| 91 |
+
# Then, limit by distance to other circles
|
| 92 |
+
# Each pair of circles with centers at distance d can have
|
| 93 |
+
# sum of radii at most d to avoid overlap
|
| 94 |
+
for i in range(n):
|
| 95 |
+
for j in range(i + 1, n):
|
| 96 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 97 |
+
|
| 98 |
+
# If current radii would cause overlap
|
| 99 |
+
if radii[i] + radii[j] > dist:
|
| 100 |
+
# Scale both radii proportionally
|
| 101 |
+
scale = dist / (radii[i] + radii[j])
|
| 102 |
+
radii[i] *= scale
|
| 103 |
+
radii[j] *= scale
|
| 104 |
+
|
| 105 |
+
return radii
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
# EVOLVE-BLOCK-END
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# This part remains fixed (not evolved)
|
| 112 |
+
def run_packing():
|
| 113 |
+
"""Run the circle packing constructor for n=26"""
|
| 114 |
+
centers, radii = construct_packing()
|
| 115 |
+
# Calculate the sum of radii
|
| 116 |
+
sum_radii = np.sum(radii)
|
| 117 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/main.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
n = 26
|
| 19 |
+
centers = np.zeros((n, 2))
|
| 20 |
+
|
| 21 |
+
# Place 25 circles in a 5x5 grid
|
| 22 |
+
n_per_side = 5
|
| 23 |
+
spacing = 1.0 / n_per_side # Calculate spacing between centers (e.g., 0.2 for 5x5)
|
| 24 |
+
offset = spacing / 2.0 # Offset from the border to center the first circle (e.g., 0.1)
|
| 25 |
+
|
| 26 |
+
k = 0
|
| 27 |
+
for i in range(n_per_side):
|
| 28 |
+
for j in range(n_per_side):
|
| 29 |
+
if k < n - 1: # Place 25 circles (indices 0 to 24)
|
| 30 |
+
centers[k, 0] = offset + i * spacing
|
| 31 |
+
centers[k, 1] = offset + j * spacing
|
| 32 |
+
k += 1
|
| 33 |
+
|
| 34 |
+
# Place the 26th circle (index 25) in a corner to minimize interference
|
| 35 |
+
# with the 5x5 grid and provide a small, but valid, radius.
|
| 36 |
+
# This placement leads to an initial radius of 0.01 for this circle,
|
| 37 |
+
# which is less likely to cause a large proportional scaling reduction
|
| 38 |
+
# for the 0.1-radius grid circles compared to placing it in a "hole".
|
| 39 |
+
centers[k, 0] = 0.01
|
| 40 |
+
centers[k, 1] = 0.01
|
| 41 |
+
|
| 42 |
+
# No clipping needed as all centers are now explicitly placed within valid ranges
|
| 43 |
+
# (e.g., [0.1, 0.9] for grid circles, [0.01, 0.01] for the last one).
|
| 44 |
+
|
| 45 |
+
radii = compute_max_radii(centers)
|
| 46 |
+
return centers, radii
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def compute_max_radii(centers):
|
| 50 |
+
"""
|
| 51 |
+
Compute the maximum possible radii for each circle position
|
| 52 |
+
such that they don't overlap and stay within the unit square.
|
| 53 |
+
|
| 54 |
+
Args:
|
| 55 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
np.array of shape (n) with radius of each circle
|
| 59 |
+
"""
|
| 60 |
+
n = centers.shape[0]
|
| 61 |
+
radii = np.ones(n)
|
| 62 |
+
|
| 63 |
+
# First, limit by distance to square borders
|
| 64 |
+
for i in range(n):
|
| 65 |
+
x, y = centers[i]
|
| 66 |
+
# Distance to borders
|
| 67 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 68 |
+
|
| 69 |
+
# Then, limit by distance to other circles
|
| 70 |
+
# Each pair of circles with centers at distance d can have
|
| 71 |
+
# sum of radii at most d to avoid overlap
|
| 72 |
+
for i in range(n):
|
| 73 |
+
for j in range(i + 1, n):
|
| 74 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 75 |
+
|
| 76 |
+
# If current radii would cause overlap
|
| 77 |
+
if radii[i] + radii[j] > dist:
|
| 78 |
+
# Scale both radii proportionally
|
| 79 |
+
scale = dist / (radii[i] + radii[j])
|
| 80 |
+
radii[i] *= scale
|
| 81 |
+
radii[j] *= scale
|
| 82 |
+
|
| 83 |
+
return radii
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# EVOLVE-BLOCK-END
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
# This part remains fixed (not evolved)
|
| 90 |
+
def run_packing():
|
| 91 |
+
"""Run the circle packing constructor for n=26"""
|
| 92 |
+
centers, radii = construct_packing()
|
| 93 |
+
# Calculate the sum of radii
|
| 94 |
+
sum_radii = np.sum(radii)
|
| 95 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/original.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 1.8823951229219553,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.1000, 0.1000)\n centers[1] = (0.1000, 0.3000)\n centers[2] = (0.1000, 0.5000)\n centers[3] = (0.1000, 0.7000)\n centers[4] = (0.1000, 0.9000)\n centers[5] = (0.3000, 0.1000)\n centers[6] = (0.3000, 0.3000)\n centers[7] = (0.3000, 0.5000)\n centers[8] = (0.3000, 0.7000)\n centers[9] = (0.3000, 0.9000)\n centers[10] = (0.5000, 0.1000)\n centers[11] = (0.5000, 0.3000)\n centers[12] = (0.5000, 0.5000)\n centers[13] = (0.5000, 0.7000)\n centers[14] = (0.5000, 0.9000)\n centers[15] = (0.7000, 0.1000)\n centers[16] = (0.7000, 0.3000)\n centers[17] = (0.7000, 0.5000)\n centers[18] = (0.7000, 0.7000)\n centers[19] = (0.7000, 0.9000)\n centers[20] = (0.9000, 0.1000)\n centers[21] = (0.9000, 0.3000)\n centers[22] = (0.9000, 0.5000)\n centers[23] = (0.9000, 0.7000)\n centers[24] = (0.9000, 0.9000)\n centers[25] = (0.0100, 0.0100)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 1.8823951229219553
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.0020638909190893173,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_2/search_replace.txt
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<NAME>
|
| 2 |
+
grid_packing_and_fix_clip
|
| 3 |
+
</NAME>
|
| 4 |
+
|
| 5 |
+
<DESCRIPTION>
|
| 6 |
+
The original `construct_packing` function had several issues leading to a very low sum of radii:
|
| 7 |
+
1. The outer ring radius (0.7) caused many circle centers to fall outside the [0,1]x[0,1] square.
|
| 8 |
+
2. The `np.clip(centers, 0.01, 0.99)` statement then clamped these invalid coordinates to `0.01` or `0.99`, effectively forcing their radii to `0.01`.
|
| 9 |
+
3. Only 25 out of 26 circles were explicitly placed, leaving `centers[25]` at its default `[0,0]` (which was then clipped to `[0.01,0.01]` and assigned a radius of `0.01`).
|
| 10 |
+
|
| 11 |
+
This edit proposes a significant improvement by:
|
| 12 |
+
1. Replacing the problematic concentric ring pattern with a 5x5 uniform grid for the first 25 circles. This is a common and efficient pattern for circle packing, ensuring all circles have an initial radius (based on border distance) of 0.1, and are 0.2 units apart.
|
| 13 |
+
2. Explicitly placing the 26th circle at `(0.01, 0.01)`. This reuses the effective minimum radius from the original `np.clip` behavior for the last circle, but ensures it's intended. This position is chosen to minimize negative interaction with the larger grid circles, given the proportional scaling nature of `compute_max_radii`.
|
| 14 |
+
3. Removing the `np.clip` call entirely, as all centers are now explicitly placed within valid ranges.
|
| 15 |
+
|
| 16 |
+
This change is expected to yield a sum of radii around 2.51 (25 circles * 0.1 + 1 circle * 0.01), which is a substantial improvement over the current 0.96.
|
| 17 |
+
The `compute_max_radii` function's single-pass proportional scaling mechanism works best when initial border-limited radii are uniform or well-separated, which the 5x5 grid largely provides.
|
| 18 |
+
</DESCRIPTION>
|
| 19 |
+
|
| 20 |
+
<DIFF>
|
| 21 |
+
<<<<<<< SEARCH
|
| 22 |
+
# Initialize arrays for 26 circles
|
| 23 |
+
n = 26
|
| 24 |
+
centers = np.zeros((n, 2))
|
| 25 |
+
|
| 26 |
+
# Place circles in a structured pattern
|
| 27 |
+
# This is a simple pattern - evolution will improve this
|
| 28 |
+
|
| 29 |
+
# First, place a large circle in the center
|
| 30 |
+
centers[0] = [0.5, 0.5]
|
| 31 |
+
|
| 32 |
+
# Place 8 circles around it in a ring
|
| 33 |
+
for i in range(8):
|
| 34 |
+
angle = 2 * np.pi * i / 8
|
| 35 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 36 |
+
|
| 37 |
+
# Place 16 more circles in an outer ring
|
| 38 |
+
for i in range(16):
|
| 39 |
+
angle = 2 * np.pi * i / 16
|
| 40 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 41 |
+
|
| 42 |
+
# Additional positioning adjustment to make sure all circles
|
| 43 |
+
# are inside the square and don't overlap
|
| 44 |
+
# Clip to ensure everything is inside the unit square
|
| 45 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 46 |
+
|
| 47 |
+
# Compute maximum valid radii for this configuration
|
| 48 |
+
radii = compute_max_radii(centers)
|
| 49 |
+
return centers, radii
|
| 50 |
+
=======
|
| 51 |
+
n = 26
|
| 52 |
+
centers = np.zeros((n, 2))
|
| 53 |
+
|
| 54 |
+
# Place 25 circles in a 5x5 grid
|
| 55 |
+
n_per_side = 5
|
| 56 |
+
spacing = 1.0 / n_per_side # Calculate spacing between centers (e.g., 0.2 for 5x5)
|
| 57 |
+
offset = spacing / 2.0 # Offset from the border to center the first circle (e.g., 0.1)
|
| 58 |
+
|
| 59 |
+
k = 0
|
| 60 |
+
for i in range(n_per_side):
|
| 61 |
+
for j in range(n_per_side):
|
| 62 |
+
if k < n - 1: # Place 25 circles (indices 0 to 24)
|
| 63 |
+
centers[k, 0] = offset + i * spacing
|
| 64 |
+
centers[k, 1] = offset + j * spacing
|
| 65 |
+
k += 1
|
| 66 |
+
|
| 67 |
+
# Place the 26th circle (index 25) in a corner to minimize interference
|
| 68 |
+
# with the 5x5 grid and provide a small, but valid, radius.
|
| 69 |
+
# This placement leads to an initial radius of 0.01 for this circle,
|
| 70 |
+
# which is less likely to cause a large proportional scaling reduction
|
| 71 |
+
# for the 0.1-radius grid circles compared to placing it in a "hole".
|
| 72 |
+
centers[k, 0] = 0.01
|
| 73 |
+
centers[k, 1] = 0.01
|
| 74 |
+
|
| 75 |
+
# No clipping needed as all centers are now explicitly placed within valid ranges
|
| 76 |
+
# (e.g., [0.1, 0.9] for grid circles, [0.01, 0.01] for the last one).
|
| 77 |
+
|
| 78 |
+
radii = compute_max_radii(centers)
|
| 79 |
+
return centers, radii
|
| 80 |
+
>>>>>>> REPLACE
|
| 81 |
+
</DIFF>
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (3.63 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/edit.diff
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- a/original.py
|
| 2 |
+
+++ b/original.py
|
| 3 |
+
@@ -1,94 +1,111 @@
|
| 4 |
+
# EVOLVE-BLOCK-START
|
| 5 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def construct_packing():
|
| 11 |
+
"""
|
| 12 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 13 |
+
that attempts to maximize the sum of their radii.
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 17 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 18 |
+
radii: np.array of shape (26) with radius of each circle
|
| 19 |
+
sum_of_radii: Sum of all radii
|
| 20 |
+
"""
|
| 21 |
+
# Initialize arrays for 26 circles
|
| 22 |
+
n = 26
|
| 23 |
+
centers = np.zeros((n, 2))
|
| 24 |
+
|
| 25 |
+
- # Place circles in a structured pattern
|
| 26 |
+
- # This is a simple pattern - evolution will improve this
|
| 27 |
+
-
|
| 28 |
+
- # First, place a large circle in the center
|
| 29 |
+
+ # A structured concentric pattern 1+8+17=26 is a better starting point.
|
| 30 |
+
+ # The radii are chosen to keep circles within the square without clipping.
|
| 31 |
+
centers[0] = [0.5, 0.5]
|
| 32 |
+
|
| 33 |
+
- # Place 8 circles around it in a ring
|
| 34 |
+
- for i in range(8):
|
| 35 |
+
- angle = 2 * np.pi * i / 8
|
| 36 |
+
- centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 37 |
+
+ # Inner ring of 8 circles
|
| 38 |
+
+ num_inner = 8
|
| 39 |
+
+ radius_inner = 0.25
|
| 40 |
+
+ for i in range(num_inner):
|
| 41 |
+
+ angle = 2 * np.pi * i / num_inner
|
| 42 |
+
+ centers[i + 1] = [0.5 + radius_inner * np.cos(angle), 0.5 + radius_inner * np.sin(angle)]
|
| 43 |
+
|
| 44 |
+
- # Place 16 more circles in an outer ring
|
| 45 |
+
- for i in range(16):
|
| 46 |
+
- angle = 2 * np.pi * i / 16
|
| 47 |
+
- centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 48 |
+
+ # Outer ring of 17 circles
|
| 49 |
+
+ num_outer = 17
|
| 50 |
+
+ radius_outer = 0.44
|
| 51 |
+
+ offset_idx = 1 + num_inner
|
| 52 |
+
+ # Stagger the outer ring relative to the inner one for better packing.
|
| 53 |
+
+ angle_offset = np.pi / num_outer
|
| 54 |
+
+ for i in range(num_outer):
|
| 55 |
+
+ angle = (2 * np.pi * i / num_outer) + angle_offset
|
| 56 |
+
+ centers[i + offset_idx] = [0.5 + radius_outer * np.cos(angle), 0.5 + radius_outer * np.sin(angle)]
|
| 57 |
+
|
| 58 |
+
- # Additional positioning adjustment to make sure all circles
|
| 59 |
+
- # are inside the square and don't overlap
|
| 60 |
+
- # Clip to ensure everything is inside the unit square
|
| 61 |
+
- centers = np.clip(centers, 0.01, 0.99)
|
| 62 |
+
+ # The original aggressive clipping is removed. The new geometry is designed
|
| 63 |
+
+ # to fit within the square, and compute_max_radii handles boundaries.
|
| 64 |
+
|
| 65 |
+
# Compute maximum valid radii for this configuration
|
| 66 |
+
radii = compute_max_radii(centers)
|
| 67 |
+
return centers, radii
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def compute_max_radii(centers):
|
| 71 |
+
"""
|
| 72 |
+
Compute the maximum possible radii for each circle position
|
| 73 |
+
such that they don't overlap and stay within the unit square.
|
| 74 |
+
|
| 75 |
+
Args:
|
| 76 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 77 |
+
|
| 78 |
+
Returns:
|
| 79 |
+
np.array of shape (n) with radius of each circle
|
| 80 |
+
"""
|
| 81 |
+
n = centers.shape[0]
|
| 82 |
+
radii = np.ones(n)
|
| 83 |
+
|
| 84 |
+
# First, limit by distance to square borders
|
| 85 |
+
for i in range(n):
|
| 86 |
+
x, y = centers[i]
|
| 87 |
+
# Distance to borders
|
| 88 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 89 |
+
|
| 90 |
+
- # Then, limit by distance to other circles
|
| 91 |
+
- # Each pair of circles with centers at distance d can have
|
| 92 |
+
- # sum of radii at most d to avoid overlap
|
| 93 |
+
- for i in range(n):
|
| 94 |
+
- for j in range(i + 1, n):
|
| 95 |
+
- dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 96 |
+
+ # Then, iteratively limit by distance to other circles until radii converge
|
| 97 |
+
+ dist_matrix = np.sqrt(np.sum((centers[:, np.newaxis, :] - centers[np.newaxis, :, :])**2, axis=-1))
|
| 98 |
+
|
| 99 |
+
- # If current radii would cause overlap
|
| 100 |
+
- if radii[i] + radii[j] > dist:
|
| 101 |
+
- # Scale both radii proportionally
|
| 102 |
+
- scale = dist / (radii[i] + radii[j])
|
| 103 |
+
- radii[i] *= scale
|
| 104 |
+
- radii[j] *= scale
|
| 105 |
+
+ for _ in range(100): # Iterate to approach a stable solution
|
| 106 |
+
+ changed = False
|
| 107 |
+
+ for i in range(n):
|
| 108 |
+
+ for j in range(i + 1, n):
|
| 109 |
+
+ dist = dist_matrix[i, j]
|
| 110 |
+
+
|
| 111 |
+
+ # If current radii would cause overlap
|
| 112 |
+
+ if radii[i] + radii[j] > dist:
|
| 113 |
+
+ # Avoid division by zero if centers are nearly coincident
|
| 114 |
+
+ if dist < 1e-12:
|
| 115 |
+
+ radii[i] = 0
|
| 116 |
+
+ radii[j] = 0
|
| 117 |
+
+ changed = True
|
| 118 |
+
+ continue
|
| 119 |
+
+
|
| 120 |
+
+ # Scale both radii proportionally to resolve the overlap
|
| 121 |
+
+ scale = dist / (radii[i] + radii[j])
|
| 122 |
+
+ radii[i] *= scale
|
| 123 |
+
+ radii[j] *= scale
|
| 124 |
+
+ changed = True
|
| 125 |
+
+
|
| 126 |
+
+ # If no radii changed in a full pass, the configuration is stable
|
| 127 |
+
+ if not changed:
|
| 128 |
+
+ break
|
| 129 |
+
|
| 130 |
+
return radii
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
# EVOLVE-BLOCK-END
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
# This part remains fixed (not evolved)
|
| 137 |
+
def run_packing():
|
| 138 |
+
"""Run the circle packing constructor for n=26"""
|
| 139 |
+
centers, radii = construct_packing()
|
| 140 |
+
# Calculate the sum of radii
|
| 141 |
+
sum_radii = np.sum(radii)
|
| 142 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/main.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# A structured concentric pattern 1+8+17=26 is a better starting point.
|
| 23 |
+
# The radii are chosen to keep circles within the square without clipping.
|
| 24 |
+
centers[0] = [0.5, 0.5]
|
| 25 |
+
|
| 26 |
+
# Inner ring of 8 circles
|
| 27 |
+
num_inner = 8
|
| 28 |
+
radius_inner = 0.25
|
| 29 |
+
for i in range(num_inner):
|
| 30 |
+
angle = 2 * np.pi * i / num_inner
|
| 31 |
+
centers[i + 1] = [0.5 + radius_inner * np.cos(angle), 0.5 + radius_inner * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Outer ring of 17 circles
|
| 34 |
+
num_outer = 17
|
| 35 |
+
radius_outer = 0.44
|
| 36 |
+
offset_idx = 1 + num_inner
|
| 37 |
+
# Stagger the outer ring relative to the inner one for better packing.
|
| 38 |
+
angle_offset = np.pi / num_outer
|
| 39 |
+
for i in range(num_outer):
|
| 40 |
+
angle = (2 * np.pi * i / num_outer) + angle_offset
|
| 41 |
+
centers[i + offset_idx] = [0.5 + radius_outer * np.cos(angle), 0.5 + radius_outer * np.sin(angle)]
|
| 42 |
+
|
| 43 |
+
# The original aggressive clipping is removed. The new geometry is designed
|
| 44 |
+
# to fit within the square, and compute_max_radii handles boundaries.
|
| 45 |
+
|
| 46 |
+
# Compute maximum valid radii for this configuration
|
| 47 |
+
radii = compute_max_radii(centers)
|
| 48 |
+
return centers, radii
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def compute_max_radii(centers):
|
| 52 |
+
"""
|
| 53 |
+
Compute the maximum possible radii for each circle position
|
| 54 |
+
such that they don't overlap and stay within the unit square.
|
| 55 |
+
|
| 56 |
+
Args:
|
| 57 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 58 |
+
|
| 59 |
+
Returns:
|
| 60 |
+
np.array of shape (n) with radius of each circle
|
| 61 |
+
"""
|
| 62 |
+
n = centers.shape[0]
|
| 63 |
+
radii = np.ones(n)
|
| 64 |
+
|
| 65 |
+
# First, limit by distance to square borders
|
| 66 |
+
for i in range(n):
|
| 67 |
+
x, y = centers[i]
|
| 68 |
+
# Distance to borders
|
| 69 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 70 |
+
|
| 71 |
+
# Then, iteratively limit by distance to other circles until radii converge
|
| 72 |
+
dist_matrix = np.sqrt(np.sum((centers[:, np.newaxis, :] - centers[np.newaxis, :, :])**2, axis=-1))
|
| 73 |
+
|
| 74 |
+
for _ in range(100): # Iterate to approach a stable solution
|
| 75 |
+
changed = False
|
| 76 |
+
for i in range(n):
|
| 77 |
+
for j in range(i + 1, n):
|
| 78 |
+
dist = dist_matrix[i, j]
|
| 79 |
+
|
| 80 |
+
# If current radii would cause overlap
|
| 81 |
+
if radii[i] + radii[j] > dist:
|
| 82 |
+
# Avoid division by zero if centers are nearly coincident
|
| 83 |
+
if dist < 1e-12:
|
| 84 |
+
radii[i] = 0
|
| 85 |
+
radii[j] = 0
|
| 86 |
+
changed = True
|
| 87 |
+
continue
|
| 88 |
+
|
| 89 |
+
# Scale both radii proportionally to resolve the overlap
|
| 90 |
+
scale = dist / (radii[i] + radii[j])
|
| 91 |
+
radii[i] *= scale
|
| 92 |
+
radii[j] *= scale
|
| 93 |
+
changed = True
|
| 94 |
+
|
| 95 |
+
# If no radii changed in a full pass, the configuration is stable
|
| 96 |
+
if not changed:
|
| 97 |
+
break
|
| 98 |
+
|
| 99 |
+
return radii
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
# EVOLVE-BLOCK-END
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# This part remains fixed (not evolved)
|
| 106 |
+
def run_packing():
|
| 107 |
+
"""Run the circle packing constructor for n=26"""
|
| 108 |
+
centers, radii = construct_packing()
|
| 109 |
+
# Calculate the sum of radii
|
| 110 |
+
sum_radii = np.sum(radii)
|
| 111 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/original.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 1.7559408519755744,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.5000, 0.5000)\n centers[1] = (0.7500, 0.5000)\n centers[2] = (0.6768, 0.6768)\n centers[3] = (0.5000, 0.7500)\n centers[4] = (0.3232, 0.6768)\n centers[5] = (0.2500, 0.5000)\n centers[6] = (0.3232, 0.3232)\n centers[7] = (0.5000, 0.2500)\n centers[8] = (0.6768, 0.3232)\n centers[9] = (0.9325, 0.5808)\n centers[10] = (0.8741, 0.7316)\n centers[11] = (0.7652, 0.8511)\n centers[12] = (0.6204, 0.9232)\n centers[13] = (0.4594, 0.9381)\n centers[14] = (0.3039, 0.8939)\n centers[15] = (0.1748, 0.7964)\n centers[16] = (0.0897, 0.6589)\n centers[17] = (0.0600, 0.5000)\n centers[18] = (0.0897, 0.3411)\n centers[19] = (0.1748, 0.2036)\n centers[20] = (0.3039, 0.1061)\n centers[21] = (0.4594, 0.0619)\n centers[22] = (0.6204, 0.0768)\n centers[23] = (0.7652, 0.1489)\n centers[24] = (0.8741, 0.2684)\n centers[25] = (0.9325, 0.4192)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 1.7559408519755744
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.0008103139698505402,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_3/search_replace.txt
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
I will propose two edits. The first fixes fundamental bugs and geometric flaws in the initial circle placement. The second improves the algorithm for calculating the radii for any given placement.
|
| 2 |
+
|
| 3 |
+
<NAME>
|
| 4 |
+
concentric_geometry_fix
|
| 5 |
+
</NAME>
|
| 6 |
+
<DESCRIPTION>
|
| 7 |
+
The original `construct_packing` function had two major flaws for N=26:
|
| 8 |
+
1. **Bug:** It only placed 25 circles explicitly (1 central, 8 inner, 16 outer). The 26th circle defaulted to coordinates (0,0), which after clipping overlapped with another circle at (0.01, 0.01), resulting in zero radius for both.
|
| 9 |
+
2. **Poor Geometry:** The outer ring radius of 0.7 was too large, pushing most of its circles outside the unit square. The subsequent aggressive `np.clip` to [0.01, 0.99] collapsed multiple distinct centers onto the same boundary coordinates, creating more overlaps and significant wasted space.
|
| 10 |
+
|
| 11 |
+
This edit replaces the flawed implementation with a well-defined and geometrically sound structure:
|
| 12 |
+
- It correctly places all 26 circles in a `1+8+17` concentric ring pattern.
|
| 13 |
+
- It uses more reasonable ring radii (0.25 and 0.44) to ensure all centers are initially placed well within the unit square, eliminating the need for the problematic clipping.
|
| 14 |
+
- It staggers the outer ring by half an angle step to improve the initial packing density between the inner and outer rings.
|
| 15 |
+
|
| 16 |
+
This new starting configuration is vastly superior, avoids bugs, and provides a much better foundation for the `compute_max_radii` function to work with, leading to a significant increase in the sum of radii.
|
| 17 |
+
</DESCRIPTION>
|
| 18 |
+
<DIFF>
|
| 19 |
+
<<<<<<< SEARCH
|
| 20 |
+
def construct_packing():
|
| 21 |
+
"""
|
| 22 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 23 |
+
that attempts to maximize the sum of their radii.
|
| 24 |
+
|
| 25 |
+
Returns:
|
| 26 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 27 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 28 |
+
radii: np.array of shape (26) with radius of each circle
|
| 29 |
+
sum_of_radii: Sum of all radii
|
| 30 |
+
"""
|
| 31 |
+
# Initialize arrays for 26 circles
|
| 32 |
+
n = 26
|
| 33 |
+
centers = np.zeros((n, 2))
|
| 34 |
+
|
| 35 |
+
# Place circles in a structured pattern
|
| 36 |
+
# This is a simple pattern - evolution will improve this
|
| 37 |
+
|
| 38 |
+
# First, place a large circle in the center
|
| 39 |
+
centers[0] = [0.5, 0.5]
|
| 40 |
+
|
| 41 |
+
# Place 8 circles around it in a ring
|
| 42 |
+
for i in range(8):
|
| 43 |
+
angle = 2 * np.pi * i / 8
|
| 44 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 45 |
+
|
| 46 |
+
# Place 16 more circles in an outer ring
|
| 47 |
+
for i in range(16):
|
| 48 |
+
angle = 2 * np.pi * i / 16
|
| 49 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 50 |
+
|
| 51 |
+
# Additional positioning adjustment to make sure all circles
|
| 52 |
+
# are inside the square and don't overlap
|
| 53 |
+
# Clip to ensure everything is inside the unit square
|
| 54 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 55 |
+
|
| 56 |
+
# Compute maximum valid radii for this configuration
|
| 57 |
+
radii = compute_max_radii(centers)
|
| 58 |
+
return centers, radii
|
| 59 |
+
=======
|
| 60 |
+
def construct_packing():
|
| 61 |
+
"""
|
| 62 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 63 |
+
that attempts to maximize the sum of their radii.
|
| 64 |
+
|
| 65 |
+
Returns:
|
| 66 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 67 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 68 |
+
radii: np.array of shape (26) with radius of each circle
|
| 69 |
+
sum_of_radii: Sum of all radii
|
| 70 |
+
"""
|
| 71 |
+
# Initialize arrays for 26 circles
|
| 72 |
+
n = 26
|
| 73 |
+
centers = np.zeros((n, 2))
|
| 74 |
+
|
| 75 |
+
# A structured concentric pattern 1+8+17=26 is a better starting point.
|
| 76 |
+
# The radii are chosen to keep circles within the square without clipping.
|
| 77 |
+
centers[0] = [0.5, 0.5]
|
| 78 |
+
|
| 79 |
+
# Inner ring of 8 circles
|
| 80 |
+
num_inner = 8
|
| 81 |
+
radius_inner = 0.25
|
| 82 |
+
for i in range(num_inner):
|
| 83 |
+
angle = 2 * np.pi * i / num_inner
|
| 84 |
+
centers[i + 1] = [0.5 + radius_inner * np.cos(angle), 0.5 + radius_inner * np.sin(angle)]
|
| 85 |
+
|
| 86 |
+
# Outer ring of 17 circles
|
| 87 |
+
num_outer = 17
|
| 88 |
+
radius_outer = 0.44
|
| 89 |
+
offset_idx = 1 + num_inner
|
| 90 |
+
# Stagger the outer ring relative to the inner one for better packing.
|
| 91 |
+
angle_offset = np.pi / num_outer
|
| 92 |
+
for i in range(num_outer):
|
| 93 |
+
angle = (2 * np.pi * i / num_outer) + angle_offset
|
| 94 |
+
centers[i + offset_idx] = [0.5 + radius_outer * np.cos(angle), 0.5 + radius_outer * np.sin(angle)]
|
| 95 |
+
|
| 96 |
+
# The original aggressive clipping is removed. The new geometry is designed
|
| 97 |
+
# to fit within the square, and compute_max_radii handles boundaries.
|
| 98 |
+
|
| 99 |
+
# Compute maximum valid radii for this configuration
|
| 100 |
+
radii = compute_max_radii(centers)
|
| 101 |
+
return centers, radii
|
| 102 |
+
>>>>>>> REPLACE
|
| 103 |
+
</DIFF>
|
| 104 |
+
<NAME>
|
| 105 |
+
iterative_radius_refinement
|
| 106 |
+
</NAME>
|
| 107 |
+
<DESCRIPTION>
|
| 108 |
+
The original `compute_max_radii` function performs only a single pass over all circle pairs to resolve overlaps. This approach is path-dependent and not guaranteed to find the maximal radii for a given set of centers. For example, if circle C1's radius is shrunk due to an overlap with C2, it cannot be expanded later if C2's radius is subsequently shrunk by an interaction with C3, even if that frees up space for C1.
|
| 109 |
+
|
| 110 |
+
This edit improves the function by converting the single-pass scaling into an iterative process. The main loop now runs multiple times (up to 100 or until convergence), repeatedly applying the proportional scaling rule. This allows the radii to settle into a much more stable and globally consistent state, where slack created by one adjustment can be claimed by others in subsequent iterations. This iterative relaxation is a standard technique for solving such constraint systems and yields a much better approximation of the optimal radii for the fixed centers.
|
| 111 |
+
|
| 112 |
+
To improve efficiency, the pairwise distances are pre-calculated into a distance matrix. A check for nearly coincident centers is also made more robust to prevent division by zero.
|
| 113 |
+
</DESCRIPTION>
|
| 114 |
+
<DIFF>
|
| 115 |
+
<<<<<<< SEARCH
|
| 116 |
+
# Then, limit by distance to other circles
|
| 117 |
+
# Each pair of circles with centers at distance d can have
|
| 118 |
+
# sum of radii at most d to avoid overlap
|
| 119 |
+
for i in range(n):
|
| 120 |
+
for j in range(i + 1, n):
|
| 121 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 122 |
+
|
| 123 |
+
# If current radii would cause overlap
|
| 124 |
+
if radii[i] + radii[j] > dist:
|
| 125 |
+
# Scale both radii proportionally
|
| 126 |
+
scale = dist / (radii[i] + radii[j])
|
| 127 |
+
radii[i] *= scale
|
| 128 |
+
radii[j] *= scale
|
| 129 |
+
=======
|
| 130 |
+
# Then, iteratively limit by distance to other circles until radii converge
|
| 131 |
+
dist_matrix = np.sqrt(np.sum((centers[:, np.newaxis, :] - centers[np.newaxis, :, :])**2, axis=-1))
|
| 132 |
+
|
| 133 |
+
for _ in range(100): # Iterate to approach a stable solution
|
| 134 |
+
changed = False
|
| 135 |
+
for i in range(n):
|
| 136 |
+
for j in range(i + 1, n):
|
| 137 |
+
dist = dist_matrix[i, j]
|
| 138 |
+
|
| 139 |
+
# If current radii would cause overlap
|
| 140 |
+
if radii[i] + radii[j] > dist:
|
| 141 |
+
# Avoid division by zero if centers are nearly coincident
|
| 142 |
+
if dist < 1e-12:
|
| 143 |
+
radii[i] = 0
|
| 144 |
+
radii[j] = 0
|
| 145 |
+
changed = True
|
| 146 |
+
continue
|
| 147 |
+
|
| 148 |
+
# Scale both radii proportionally to resolve the overlap
|
| 149 |
+
scale = dist / (radii[i] + radii[j])
|
| 150 |
+
radii[i] *= scale
|
| 151 |
+
radii[j] *= scale
|
| 152 |
+
changed = True
|
| 153 |
+
|
| 154 |
+
# If no radii changed in a full pass, the configuration is stable
|
| 155 |
+
if not changed:
|
| 156 |
+
break
|
| 157 |
+
>>>>>>> REPLACE
|
| 158 |
+
</DIFF>
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (3.47 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/edit.diff
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- a/original.py
|
| 2 |
+
+++ b/original.py
|
| 3 |
+
@@ -1,94 +1,114 @@
|
| 4 |
+
# EVOLVE-BLOCK-START
|
| 5 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def construct_packing():
|
| 11 |
+
"""
|
| 12 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 13 |
+
that attempts to maximize the sum of their radii.
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 17 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 18 |
+
radii: np.array of shape (26) with radius of each circle
|
| 19 |
+
sum_of_radii: Sum of all radii
|
| 20 |
+
"""
|
| 21 |
+
# Initialize arrays for 26 circles
|
| 22 |
+
n = 26
|
| 23 |
+
centers = np.zeros((n, 2))
|
| 24 |
+
|
| 25 |
+
# Place circles in a structured pattern
|
| 26 |
+
# This is a simple pattern - evolution will improve this
|
| 27 |
+
|
| 28 |
+
# First, place a large circle in the center
|
| 29 |
+
centers[0] = [0.5, 0.5]
|
| 30 |
+
|
| 31 |
+
# Place 8 circles around it in a ring
|
| 32 |
+
for i in range(8):
|
| 33 |
+
angle = 2 * np.pi * i / 8
|
| 34 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 35 |
+
|
| 36 |
+
# Place 16 more circles in an outer ring
|
| 37 |
+
+ # Adjusted radius from 0.7 to 0.49 to better utilize space near the boundary
|
| 38 |
+
+ # (0.5 + 0.49 = 0.99, which is the default clipping limit before this change)
|
| 39 |
+
for i in range(16):
|
| 40 |
+
angle = 2 * np.pi * i / 16
|
| 41 |
+
- centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 42 |
+
+ centers[i + 9] = [0.5 + 0.49 * np.cos(angle), 0.5 + 0.49 * np.sin(angle)]
|
| 43 |
+
+
|
| 44 |
+
+ # Place the 26th circle (index 25) explicitly in a corner
|
| 45 |
+
+ centers[25] = [0.0, 0.0]
|
| 46 |
+
|
| 47 |
+
# Additional positioning adjustment to make sure all circles
|
| 48 |
+
# are inside the square and don't overlap
|
| 49 |
+
- # Clip to ensure everything is inside the unit square
|
| 50 |
+
- centers = np.clip(centers, 0.01, 0.99)
|
| 51 |
+
+ # Reduce clipping margin to allow centers to be very close to the edges,
|
| 52 |
+
+ # potentially allowing larger circles at the boundaries.
|
| 53 |
+
+ centers = np.clip(centers, 1e-6, 1 - 1e-6)
|
| 54 |
+
|
| 55 |
+
# Compute maximum valid radii for this configuration
|
| 56 |
+
radii = compute_max_radii(centers)
|
| 57 |
+
return centers, radii
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def compute_max_radii(centers):
|
| 61 |
+
"""
|
| 62 |
+
Compute the maximum possible radii for each circle position
|
| 63 |
+
such that they don't overlap and stay within the unit square.
|
| 64 |
+
|
| 65 |
+
Args:
|
| 66 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 67 |
+
|
| 68 |
+
Returns:
|
| 69 |
+
np.array of shape (n) with radius of each circle
|
| 70 |
+
"""
|
| 71 |
+
n = centers.shape[0]
|
| 72 |
+
radii = np.ones(n)
|
| 73 |
+
|
| 74 |
+
# First, limit by distance to square borders
|
| 75 |
+
for i in range(n):
|
| 76 |
+
x, y = centers[i]
|
| 77 |
+
# Distance to borders
|
| 78 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 79 |
+
|
| 80 |
+
# Then, limit by distance to other circles
|
| 81 |
+
- # Each pair of circles with centers at distance d can have
|
| 82 |
+
- # sum of radii at most d to avoid overlap
|
| 83 |
+
+ # Iterate until radii stabilize or max iterations reached
|
| 84 |
+
+ max_iterations = 1000 # Safety limit for iterations
|
| 85 |
+
+
|
| 86 |
+
+ for _ in range(max_iterations):
|
| 87 |
+
+ changed = False
|
| 88 |
+
+ for i in range(n):
|
| 89 |
+
+ for j in range(i + 1, n):
|
| 90 |
+
+ dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 91 |
+
+
|
| 92 |
+
+ # If current radii would cause overlap
|
| 93 |
+
+ if radii[i] + radii[j] > dist:
|
| 94 |
+
+ # Scale both radii proportionally
|
| 95 |
+
+ scale = dist / (radii[i] + radii[j])
|
| 96 |
+
+ radii[i] *= scale
|
| 97 |
+
+ radii[j] *= scale
|
| 98 |
+
+ changed = True
|
| 99 |
+
+
|
| 100 |
+
+ # If no radii changed in a full pass, we've converged
|
| 101 |
+
+ if not changed:
|
| 102 |
+
+ break
|
| 103 |
+
+
|
| 104 |
+
+ # After iterating, ensure no radius inadvertently grew beyond border limits due to precision issues
|
| 105 |
+
+ # (though unlikely with proportional scaling, it's a good safeguard)
|
| 106 |
+
for i in range(n):
|
| 107 |
+
- for j in range(i + 1, n):
|
| 108 |
+
- dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 109 |
+
-
|
| 110 |
+
- # If current radii would cause overlap
|
| 111 |
+
- if radii[i] + radii[j] > dist:
|
| 112 |
+
- # Scale both radii proportionally
|
| 113 |
+
- scale = dist / (radii[i] + radii[j])
|
| 114 |
+
- radii[i] *= scale
|
| 115 |
+
- radii[j] *= scale
|
| 116 |
+
+ x, y = centers[i]
|
| 117 |
+
+ radii[i] = min(radii[i], x, y, 1 - x, 1 - y)
|
| 118 |
+
|
| 119 |
+
return radii
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
# EVOLVE-BLOCK-END
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# This part remains fixed (not evolved)
|
| 126 |
+
def run_packing():
|
| 127 |
+
"""Run the circle packing constructor for n=26"""
|
| 128 |
+
centers, radii = construct_packing()
|
| 129 |
+
# Calculate the sum of radii
|
| 130 |
+
sum_radii = np.sum(radii)
|
| 131 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/main.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
# Adjusted radius from 0.7 to 0.49 to better utilize space near the boundary
|
| 35 |
+
# (0.5 + 0.49 = 0.99, which is the default clipping limit before this change)
|
| 36 |
+
for i in range(16):
|
| 37 |
+
angle = 2 * np.pi * i / 16
|
| 38 |
+
centers[i + 9] = [0.5 + 0.49 * np.cos(angle), 0.5 + 0.49 * np.sin(angle)]
|
| 39 |
+
|
| 40 |
+
# Place the 26th circle (index 25) explicitly in a corner
|
| 41 |
+
centers[25] = [0.0, 0.0]
|
| 42 |
+
|
| 43 |
+
# Additional positioning adjustment to make sure all circles
|
| 44 |
+
# are inside the square and don't overlap
|
| 45 |
+
# Reduce clipping margin to allow centers to be very close to the edges,
|
| 46 |
+
# potentially allowing larger circles at the boundaries.
|
| 47 |
+
centers = np.clip(centers, 1e-6, 1 - 1e-6)
|
| 48 |
+
|
| 49 |
+
# Compute maximum valid radii for this configuration
|
| 50 |
+
radii = compute_max_radii(centers)
|
| 51 |
+
return centers, radii
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def compute_max_radii(centers):
|
| 55 |
+
"""
|
| 56 |
+
Compute the maximum possible radii for each circle position
|
| 57 |
+
such that they don't overlap and stay within the unit square.
|
| 58 |
+
|
| 59 |
+
Args:
|
| 60 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 61 |
+
|
| 62 |
+
Returns:
|
| 63 |
+
np.array of shape (n) with radius of each circle
|
| 64 |
+
"""
|
| 65 |
+
n = centers.shape[0]
|
| 66 |
+
radii = np.ones(n)
|
| 67 |
+
|
| 68 |
+
# First, limit by distance to square borders
|
| 69 |
+
for i in range(n):
|
| 70 |
+
x, y = centers[i]
|
| 71 |
+
# Distance to borders
|
| 72 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 73 |
+
|
| 74 |
+
# Then, limit by distance to other circles
|
| 75 |
+
# Iterate until radii stabilize or max iterations reached
|
| 76 |
+
max_iterations = 1000 # Safety limit for iterations
|
| 77 |
+
|
| 78 |
+
for _ in range(max_iterations):
|
| 79 |
+
changed = False
|
| 80 |
+
for i in range(n):
|
| 81 |
+
for j in range(i + 1, n):
|
| 82 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 83 |
+
|
| 84 |
+
# If current radii would cause overlap
|
| 85 |
+
if radii[i] + radii[j] > dist:
|
| 86 |
+
# Scale both radii proportionally
|
| 87 |
+
scale = dist / (radii[i] + radii[j])
|
| 88 |
+
radii[i] *= scale
|
| 89 |
+
radii[j] *= scale
|
| 90 |
+
changed = True
|
| 91 |
+
|
| 92 |
+
# If no radii changed in a full pass, we've converged
|
| 93 |
+
if not changed:
|
| 94 |
+
break
|
| 95 |
+
|
| 96 |
+
# After iterating, ensure no radius inadvertently grew beyond border limits due to precision issues
|
| 97 |
+
# (though unlikely with proportional scaling, it's a good safeguard)
|
| 98 |
+
for i in range(n):
|
| 99 |
+
x, y = centers[i]
|
| 100 |
+
radii[i] = min(radii[i], x, y, 1 - x, 1 - y)
|
| 101 |
+
|
| 102 |
+
return radii
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# EVOLVE-BLOCK-END
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
# This part remains fixed (not evolved)
|
| 109 |
+
def run_packing():
|
| 110 |
+
"""Run the circle packing constructor for n=26"""
|
| 111 |
+
centers, radii = construct_packing()
|
| 112 |
+
# Calculate the sum of radii
|
| 113 |
+
sum_radii = np.sum(radii)
|
| 114 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/original.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/results/correct.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"correct": true,
|
| 3 |
+
"error": null
|
| 4 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/results/metrics.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"combined_score": 1.5600289398829672,
|
| 3 |
+
"public": {
|
| 4 |
+
"centers_str": " centers[0] = (0.5000, 0.5000)\n centers[1] = (0.8000, 0.5000)\n centers[2] = (0.7121, 0.7121)\n centers[3] = (0.5000, 0.8000)\n centers[4] = (0.2879, 0.7121)\n centers[5] = (0.2000, 0.5000)\n centers[6] = (0.2879, 0.2879)\n centers[7] = (0.5000, 0.2000)\n centers[8] = (0.7121, 0.2879)\n centers[9] = (0.9900, 0.5000)\n centers[10] = (0.9527, 0.6875)\n centers[11] = (0.8465, 0.8465)\n centers[12] = (0.6875, 0.9527)\n centers[13] = (0.5000, 0.9900)\n centers[14] = (0.3125, 0.9527)\n centers[15] = (0.1535, 0.8465)\n centers[16] = (0.0473, 0.6875)\n centers[17] = (0.0100, 0.5000)\n centers[18] = (0.0473, 0.3125)\n centers[19] = (0.1535, 0.1535)\n centers[20] = (0.3125, 0.0473)\n centers[21] = (0.5000, 0.0100)\n centers[22] = (0.6875, 0.0473)\n centers[23] = (0.8465, 0.1535)\n centers[24] = (0.9527, 0.3125)\n centers[25] = (0.0000, 0.0000)",
|
| 5 |
+
"num_circles": 26
|
| 6 |
+
},
|
| 7 |
+
"private": {
|
| 8 |
+
"reported_sum_of_radii": 1.5600289398829672
|
| 9 |
+
},
|
| 10 |
+
"execution_time_mean": 0.00560357328504324,
|
| 11 |
+
"execution_time_std": 0.0,
|
| 12 |
+
"num_valid_runs": 1,
|
| 13 |
+
"num_invalid_runs": 0,
|
| 14 |
+
"all_validation_errors": []
|
| 15 |
+
}
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_4/search_replace.txt
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<NAME>
|
| 2 |
+
iterative_radius_refinement
|
| 3 |
+
</NAME>
|
| 4 |
+
|
| 5 |
+
<DESCRIPTION>
|
| 6 |
+
The `compute_max_radii` function currently performs a single pass of pairwise proportional scaling to resolve overlaps. This is often insufficient for complex interactions where resolving one overlap might create or worsen another. This change introduces an iterative loop that repeatedly applies the pairwise scaling until no further significant changes in radii occur, or a maximum number of iterations is reached. This ensures a more stable and locally optimal set of radii for the given center positions, leading to a higher sum of radii.
|
| 7 |
+
</DESCRIPTION>
|
| 8 |
+
|
| 9 |
+
<DIFF>
|
| 10 |
+
<<<<<<< SEARCH
|
| 11 |
+
# Then, limit by distance to other circles
|
| 12 |
+
# Each pair of circles with centers at distance d can have
|
| 13 |
+
# sum of radii at most d to avoid overlap
|
| 14 |
+
for i in range(n):
|
| 15 |
+
for j in range(i + 1, n):
|
| 16 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 17 |
+
|
| 18 |
+
# If current radii would cause overlap
|
| 19 |
+
if radii[i] + radii[j] > dist:
|
| 20 |
+
# Scale both radii proportionally
|
| 21 |
+
scale = dist / (radii[i] + radii[j])
|
| 22 |
+
radii[i] *= scale
|
| 23 |
+
radii[j] *= scale
|
| 24 |
+
|
| 25 |
+
return radii
|
| 26 |
+
=======
|
| 27 |
+
# Then, limit by distance to other circles
|
| 28 |
+
# Iterate until radii stabilize or max iterations reached
|
| 29 |
+
max_iterations = 1000 # Safety limit for iterations
|
| 30 |
+
|
| 31 |
+
for _ in range(max_iterations):
|
| 32 |
+
changed = False
|
| 33 |
+
for i in range(n):
|
| 34 |
+
for j in range(i + 1, n):
|
| 35 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 36 |
+
|
| 37 |
+
# If current radii would cause overlap
|
| 38 |
+
if radii[i] + radii[j] > dist:
|
| 39 |
+
# Scale both radii proportionally
|
| 40 |
+
scale = dist / (radii[i] + radii[j])
|
| 41 |
+
radii[i] *= scale
|
| 42 |
+
radii[j] *= scale
|
| 43 |
+
changed = True
|
| 44 |
+
|
| 45 |
+
# If no radii changed in a full pass, we've converged
|
| 46 |
+
if not changed:
|
| 47 |
+
break
|
| 48 |
+
|
| 49 |
+
# After iterating, ensure no radius inadvertently grew beyond border limits due to precision issues
|
| 50 |
+
# (though unlikely with proportional scaling, it's a good safeguard)
|
| 51 |
+
for i in range(n):
|
| 52 |
+
x, y = centers[i]
|
| 53 |
+
radii[i] = min(radii[i], x, y, 1 - x, 1 - y)
|
| 54 |
+
|
| 55 |
+
return radii
|
| 56 |
+
>>>>>>> REPLACE
|
| 57 |
+
</DIFF>
|
| 58 |
+
<NAME>
|
| 59 |
+
construct_packing_refinements
|
| 60 |
+
</NAME>
|
| 61 |
+
|
| 62 |
+
<DESCRIPTION>
|
| 63 |
+
This edit introduces three refinements to the `construct_packing` function:
|
| 64 |
+
1. **Explicit 26th Circle Placement:** The original code implicitly left `centers[25]` to default to `(0,0)` before clipping. This change explicitly assigns `centers[25]` to `[0.0, 0.0]`, making the initial placement for all 26 circles deterministic.
|
| 65 |
+
2. **Outer Ring Radius Adjustment:** The initial outer ring radius of `0.7` caused centers to overshoot the unit square boundaries, leading to significant clipping. By adjusting it to `0.49` (calculated as `0.99 - 0.5`), centers are placed precisely to touch the `0.99` boundary after clipping, maximizing space utilization near the edges without excessive initial overlap.
|
| 66 |
+
3. **Reduced Clipping Margin:** The fixed `0.01` clipping margin was arbitrary and could restrict radii for circles near the boundaries. Reducing this to `1e-6` allows centers to be placed much closer to the `0` and `1` edges, enabling larger radii for circles positioned at the boundaries, leveraging the full unit square dimensions.
|
| 67 |
+
These combined changes aim to provide a more optimized and precise initial center configuration.
|
| 68 |
+
</DESCRIPTION>
|
| 69 |
+
|
| 70 |
+
<DIFF>
|
| 71 |
+
<<<<<<< SEARCH
|
| 72 |
+
# Place 16 more circles in an outer ring
|
| 73 |
+
for i in range(16):
|
| 74 |
+
angle = 2 * np.pi * i / 16
|
| 75 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 76 |
+
|
| 77 |
+
# Additional positioning adjustment to make sure all circles
|
| 78 |
+
# are inside the square and don't overlap
|
| 79 |
+
# Clip to ensure everything is inside the unit square
|
| 80 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 81 |
+
=======
|
| 82 |
+
# Place 16 more circles in an outer ring
|
| 83 |
+
# Adjusted radius from 0.7 to 0.49 to better utilize space near the boundary
|
| 84 |
+
# (0.5 + 0.49 = 0.99, which is the default clipping limit before this change)
|
| 85 |
+
for i in range(16):
|
| 86 |
+
angle = 2 * np.pi * i / 16
|
| 87 |
+
centers[i + 9] = [0.5 + 0.49 * np.cos(angle), 0.5 + 0.49 * np.sin(angle)]
|
| 88 |
+
|
| 89 |
+
# Place the 26th circle (index 25) explicitly in a corner
|
| 90 |
+
centers[25] = [0.0, 0.0]
|
| 91 |
+
|
| 92 |
+
# Additional positioning adjustment to make sure all circles
|
| 93 |
+
# are inside the square and don't overlap
|
| 94 |
+
# Reduce clipping margin to allow centers to be very close to the edges,
|
| 95 |
+
# potentially allowing larger circles at the boundaries.
|
| 96 |
+
centers = np.clip(centers, 1e-6, 1 - 1e-6)
|
| 97 |
+
>>>>>>> REPLACE
|
| 98 |
+
</DIFF>
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (3.19 kB). View file
|
|
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/edit.diff
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--- a/original.py
|
| 2 |
+
+++ b/original.py
|
| 3 |
+
@@ -1,94 +1,94 @@
|
| 4 |
+
# EVOLVE-BLOCK-START
|
| 5 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def construct_packing():
|
| 11 |
+
"""
|
| 12 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 13 |
+
that attempts to maximize the sum of their radii.
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 17 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 18 |
+
radii: np.array of shape (26) with radius of each circle
|
| 19 |
+
sum_of_radii: Sum of all radii
|
| 20 |
+
"""
|
| 21 |
+
# Initialize arrays for 26 circles
|
| 22 |
+
n = 26
|
| 23 |
+
centers = np.zeros((n, 2))
|
| 24 |
+
|
| 25 |
+
# Place circles in a structured pattern
|
| 26 |
+
# This is a simple pattern - evolution will improve this
|
| 27 |
+
|
| 28 |
+
# First, place a large circle in the center
|
| 29 |
+
centers[0] = [0.5, 0.5]
|
| 30 |
+
|
| 31 |
+
- # Place 8 circles around it in a ring
|
| 32 |
+
- for i in range(8):
|
| 33 |
+
- angle = 2 * np.pi * i / 8
|
| 34 |
+
+ # Place 9 circles in an inner ring to make the total 26
|
| 35 |
+
+ for i in range(9):
|
| 36 |
+
+ angle = 2 * np.pi * i / 9
|
| 37 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 38 |
+
|
| 39 |
+
# Place 16 more circles in an outer ring
|
| 40 |
+
for i in range(16):
|
| 41 |
+
angle = 2 * np.pi * i / 16
|
| 42 |
+
- centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 43 |
+
+ centers[i + 10] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 44 |
+
|
| 45 |
+
# Additional positioning adjustment to make sure all circles
|
| 46 |
+
# are inside the square and don't overlap
|
| 47 |
+
# Clip to ensure everything is inside the unit square
|
| 48 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 49 |
+
|
| 50 |
+
# Compute maximum valid radii for this configuration
|
| 51 |
+
radii = compute_max_radii(centers)
|
| 52 |
+
return centers, radii
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def compute_max_radii(centers):
|
| 56 |
+
"""
|
| 57 |
+
Compute the maximum possible radii for each circle position
|
| 58 |
+
such that they don't overlap and stay within the unit square.
|
| 59 |
+
|
| 60 |
+
Args:
|
| 61 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 62 |
+
|
| 63 |
+
Returns:
|
| 64 |
+
np.array of shape (n) with radius of each circle
|
| 65 |
+
"""
|
| 66 |
+
n = centers.shape[0]
|
| 67 |
+
radii = np.ones(n)
|
| 68 |
+
|
| 69 |
+
# First, limit by distance to square borders
|
| 70 |
+
for i in range(n):
|
| 71 |
+
x, y = centers[i]
|
| 72 |
+
# Distance to borders
|
| 73 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 74 |
+
|
| 75 |
+
- # Then, limit by distance to other circles
|
| 76 |
+
- # Each pair of circles with centers at distance d can have
|
| 77 |
+
- # sum of radii at most d to avoid overlap
|
| 78 |
+
- for i in range(n):
|
| 79 |
+
- for j in range(i + 1, n):
|
| 80 |
+
- dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 81 |
+
+ # Then, limit by distance to other circles.
|
| 82 |
+
+ # The scaling process is repeated iteratively to find a stable solution
|
| 83 |
+
+ # for all radii, as changes to one pair affect all others.
|
| 84 |
+
+ for _ in range(20):
|
| 85 |
+
+ for i in range(n):
|
| 86 |
+
+ for j in range(i + 1, n):
|
| 87 |
+
+ dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 88 |
+
|
| 89 |
+
- # If current radii would cause overlap
|
| 90 |
+
- if radii[i] + radii[j] > dist:
|
| 91 |
+
- # Scale both radii proportionally
|
| 92 |
+
- scale = dist / (radii[i] + radii[j])
|
| 93 |
+
- radii[i] *= scale
|
| 94 |
+
- radii[j] *= scale
|
| 95 |
+
+ # If current radii would cause overlap, scale them down proportionally.
|
| 96 |
+
+ if radii[i] + radii[j] > dist:
|
| 97 |
+
+ scale = dist / (radii[i] + radii[j])
|
| 98 |
+
+ radii[i] *= scale
|
| 99 |
+
+ radii[j] *= scale
|
| 100 |
+
|
| 101 |
+
return radii
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
# EVOLVE-BLOCK-END
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# This part remains fixed (not evolved)
|
| 108 |
+
def run_packing():
|
| 109 |
+
"""Run the circle packing constructor for n=26"""
|
| 110 |
+
centers, radii = construct_packing()
|
| 111 |
+
# Calculate the sum of radii
|
| 112 |
+
sum_radii = np.sum(radii)
|
| 113 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/main.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 9 circles in an inner ring to make the total 26
|
| 29 |
+
for i in range(9):
|
| 30 |
+
angle = 2 * np.pi * i / 9
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 10] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles.
|
| 69 |
+
# The scaling process is repeated iteratively to find a stable solution
|
| 70 |
+
# for all radii, as changes to one pair affect all others.
|
| 71 |
+
for _ in range(20):
|
| 72 |
+
for i in range(n):
|
| 73 |
+
for j in range(i + 1, n):
|
| 74 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 75 |
+
|
| 76 |
+
# If current radii would cause overlap, scale them down proportionally.
|
| 77 |
+
if radii[i] + radii[j] > dist:
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|
examples_deprecated/circle_packing/results/results_debug_gen10_20260205_230555/gen_5/original.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVOLVE-BLOCK-START
|
| 2 |
+
"""Constructor-based circle packing for n=26 circles"""
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def construct_packing():
|
| 8 |
+
"""
|
| 9 |
+
Construct a specific arrangement of 26 circles in a unit square
|
| 10 |
+
that attempts to maximize the sum of their radii.
|
| 11 |
+
|
| 12 |
+
Returns:
|
| 13 |
+
Tuple of (centers, radii, sum_of_radii)
|
| 14 |
+
centers: np.array of shape (26, 2) with (x, y) coordinates
|
| 15 |
+
radii: np.array of shape (26) with radius of each circle
|
| 16 |
+
sum_of_radii: Sum of all radii
|
| 17 |
+
"""
|
| 18 |
+
# Initialize arrays for 26 circles
|
| 19 |
+
n = 26
|
| 20 |
+
centers = np.zeros((n, 2))
|
| 21 |
+
|
| 22 |
+
# Place circles in a structured pattern
|
| 23 |
+
# This is a simple pattern - evolution will improve this
|
| 24 |
+
|
| 25 |
+
# First, place a large circle in the center
|
| 26 |
+
centers[0] = [0.5, 0.5]
|
| 27 |
+
|
| 28 |
+
# Place 8 circles around it in a ring
|
| 29 |
+
for i in range(8):
|
| 30 |
+
angle = 2 * np.pi * i / 8
|
| 31 |
+
centers[i + 1] = [0.5 + 0.3 * np.cos(angle), 0.5 + 0.3 * np.sin(angle)]
|
| 32 |
+
|
| 33 |
+
# Place 16 more circles in an outer ring
|
| 34 |
+
for i in range(16):
|
| 35 |
+
angle = 2 * np.pi * i / 16
|
| 36 |
+
centers[i + 9] = [0.5 + 0.7 * np.cos(angle), 0.5 + 0.7 * np.sin(angle)]
|
| 37 |
+
|
| 38 |
+
# Additional positioning adjustment to make sure all circles
|
| 39 |
+
# are inside the square and don't overlap
|
| 40 |
+
# Clip to ensure everything is inside the unit square
|
| 41 |
+
centers = np.clip(centers, 0.01, 0.99)
|
| 42 |
+
|
| 43 |
+
# Compute maximum valid radii for this configuration
|
| 44 |
+
radii = compute_max_radii(centers)
|
| 45 |
+
return centers, radii
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compute_max_radii(centers):
|
| 49 |
+
"""
|
| 50 |
+
Compute the maximum possible radii for each circle position
|
| 51 |
+
such that they don't overlap and stay within the unit square.
|
| 52 |
+
|
| 53 |
+
Args:
|
| 54 |
+
centers: np.array of shape (n, 2) with (x, y) coordinates
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
np.array of shape (n) with radius of each circle
|
| 58 |
+
"""
|
| 59 |
+
n = centers.shape[0]
|
| 60 |
+
radii = np.ones(n)
|
| 61 |
+
|
| 62 |
+
# First, limit by distance to square borders
|
| 63 |
+
for i in range(n):
|
| 64 |
+
x, y = centers[i]
|
| 65 |
+
# Distance to borders
|
| 66 |
+
radii[i] = min(x, y, 1 - x, 1 - y)
|
| 67 |
+
|
| 68 |
+
# Then, limit by distance to other circles
|
| 69 |
+
# Each pair of circles with centers at distance d can have
|
| 70 |
+
# sum of radii at most d to avoid overlap
|
| 71 |
+
for i in range(n):
|
| 72 |
+
for j in range(i + 1, n):
|
| 73 |
+
dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))
|
| 74 |
+
|
| 75 |
+
# If current radii would cause overlap
|
| 76 |
+
if radii[i] + radii[j] > dist:
|
| 77 |
+
# Scale both radii proportionally
|
| 78 |
+
scale = dist / (radii[i] + radii[j])
|
| 79 |
+
radii[i] *= scale
|
| 80 |
+
radii[j] *= scale
|
| 81 |
+
|
| 82 |
+
return radii
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# EVOLVE-BLOCK-END
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# This part remains fixed (not evolved)
|
| 89 |
+
def run_packing():
|
| 90 |
+
"""Run the circle packing constructor for n=26"""
|
| 91 |
+
centers, radii = construct_packing()
|
| 92 |
+
# Calculate the sum of radii
|
| 93 |
+
sum_radii = np.sum(radii)
|
| 94 |
+
return centers, radii, sum_radii
|