JustinTX commited on
Commit
95ce620
·
verified ·
1 Parent(s): 1b2fd52

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +141 -0
  2. .venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_axes.cpython-313.pyc +3 -0
  3. .venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_base.cpython-313.pyc +3 -0
  4. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +3 -0
  5. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +3 -0
  6. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +3 -0
  7. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf +3 -0
  8. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +3 -0
  9. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf +3 -0
  10. .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf +3 -0
  11. .venv/lib/python3.13/site-packages/pip/_vendor/__pycache__/typing_extensions.cpython-313.pyc +3 -0
  12. .venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe +3 -0
  13. .venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe +3 -0
  14. .venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe +3 -0
  15. .venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe +3 -0
  16. .venv/lib/python3.13/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-313.pyc +3 -0
  17. .venv/lib/python3.13/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-313.pyc +3 -0
  18. .venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-313.pyc +3 -0
  19. .venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/console.cpython-313.pyc +3 -0
  20. .venv/lib/python3.13/site-packages/wandb/bin/gpu_stats +3 -0
  21. .venv/lib/python3.13/site-packages/wandb/bin/wandb-core +3 -0
  22. .venv/lib/python3.13/site-packages/wandb/cli/__pycache__/cli.cpython-313.pyc +3 -0
  23. .venv/lib/python3.13/site-packages/wandb/sdk/__pycache__/wandb_run.cpython-313.pyc +3 -0
  24. .venv/lib/python3.13/site-packages/wandb/sdk/artifacts/__pycache__/artifact.cpython-313.pyc +3 -0
  25. .venv/lib/python3.13/site-packages/wandb/sdk/internal/__pycache__/internal_api.cpython-313.pyc +3 -0
  26. docker_space/frontier_cs_3/interactor +3 -0
  27. docker_space/frontier_cs_7/core +3 -0
  28. examples_deprecated/circle_packing/demo_aux_results/extra.npz +3 -0
  29. examples_deprecated/circle_packing/demo_aux_results/packing_viz.png +3 -0
  30. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/__pycache__/main.cpython-313.pyc +0 -0
  31. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/edit.diff +482 -0
  32. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/main.py +291 -0
  33. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/original.py +204 -0
  34. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/results/correct.json +4 -0
  35. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/results/metrics.json +121 -0
  36. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/rewrite.txt +282 -0
  37. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/eval_agent_memory/__pycache__/auxiliary_metrics.cpython-313.pyc +0 -0
  38. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/__pycache__/main.cpython-313.pyc +0 -0
  39. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/correct.json +4 -0
  40. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/job_log.err +9 -0
  41. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/job_log.out +16 -0
  42. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/metrics.json +15 -0
  43. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_1/__pycache__/main.cpython-313.pyc +0 -0
  44. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_1/results/correct.json +4 -0
  45. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_1/results/metrics.json +25 -0
  46. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/__pycache__/main.cpython-313.pyc +0 -0
  47. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/main.py +162 -0
  48. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/results/correct.json +4 -0
  49. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/results/metrics.json +43 -0
  50. examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_100/__pycache__/main.cpython-313.pyc +0 -0
.gitattributes CHANGED
@@ -921,3 +921,144 @@ py311/lib/python3.11/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.
921
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf filter=lfs diff=lfs merge=lfs -text
922
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf filter=lfs diff=lfs merge=lfs -text
923
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf filter=lfs diff=lfs merge=lfs -text
922
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf filter=lfs diff=lfs merge=lfs -text
923
  .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf filter=lfs diff=lfs merge=lfs -text
924
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf filter=lfs diff=lfs merge=lfs -text
925
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf filter=lfs diff=lfs merge=lfs -text
926
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf filter=lfs diff=lfs merge=lfs -text
927
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf filter=lfs diff=lfs merge=lfs -text
928
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf filter=lfs diff=lfs merge=lfs -text
929
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf filter=lfs diff=lfs merge=lfs -text
930
+ .venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf filter=lfs diff=lfs merge=lfs -text
931
+ .venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_axes.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
932
+ .venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_base.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
933
+ .venv/lib/python3.13/site-packages/wandb/bin/gpu_stats filter=lfs diff=lfs merge=lfs -text
934
+ .venv/lib/python3.13/site-packages/wandb/cli/__pycache__/cli.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
935
+ .venv/lib/python3.13/site-packages/wandb/bin/wandb-core filter=lfs diff=lfs merge=lfs -text
936
+ .venv/lib/python3.13/site-packages/wandb/sdk/__pycache__/wandb_run.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
937
+ .venv/lib/python3.13/site-packages/wandb/sdk/internal/__pycache__/internal_api.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
938
+ .venv/lib/python3.13/site-packages/wandb/sdk/artifacts/__pycache__/artifact.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
939
+ .venv/lib/python3.13/site-packages/pip/_vendor/__pycache__/typing_extensions.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
940
+ .venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
941
+ .venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
942
+ .venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
943
+ .venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text
944
+ docker_space/frontier_cs_7/core filter=lfs diff=lfs merge=lfs -text
945
+ .venv/lib/python3.13/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
946
+ .venv/lib/python3.13/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
947
+ docker_space/frontier_cs_3/interactor filter=lfs diff=lfs merge=lfs -text
948
+ .venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/console.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
949
+ .venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-313.pyc filter=lfs diff=lfs merge=lfs -text
950
+ examples_deprecated/circle_packing/demo_aux_results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
951
+ examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_065910/evolution_db_circle_packing_WITHOUT_vision_20260114_065910.sqlite-wal filter=lfs diff=lfs merge=lfs -text
952
+ examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_065910/best/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
953
+ examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_065910/gen_0/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
954
+ examples_deprecated/circle_packing/results_circle_packing_WITHOUT_vision_20260114_070110/evolution_db_circle_packing_WITHOUT_vision_20260114_070110.sqlite filter=lfs diff=lfs merge=lfs -text
955
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/evolution_db_circle_packing_WITH_vision_20260114_065819.sqlite filter=lfs diff=lfs merge=lfs -text
956
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_73/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
957
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_75/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
958
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_20/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
959
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_156/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
960
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_40/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
961
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_28/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
962
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_131/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
963
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_11/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
964
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_117/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
965
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_35/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
966
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_72/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
967
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_168/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
968
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_52/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
969
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_180/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
970
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_123/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
971
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_141/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
972
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_71/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
973
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_176/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
974
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_142/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
975
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_196/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
976
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_42/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
977
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_194/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
978
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_145/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
979
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_136/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
980
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_133/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
981
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_82/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
982
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_147/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
983
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_182/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
984
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_31/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
985
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_24/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
986
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_148/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
987
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_104/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
988
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_149/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
989
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_175/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
990
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_65/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
991
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_43/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
992
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_38/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
993
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_7/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
994
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_60/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
995
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_151/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
996
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_10/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
997
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_102/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
998
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_159/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
999
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_179/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1000
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_125/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1001
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_93/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1002
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_36/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1003
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_195/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1004
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_56/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1005
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_89/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1006
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_54/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1007
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_61/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1008
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_120/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1009
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/best/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1010
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_183/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1011
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_99/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1012
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_66/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1013
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_160/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1014
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_6/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1015
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_193/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1016
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_87/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1017
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_2/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1018
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_18/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1019
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_197/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1020
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_19/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1021
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_137/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1022
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_68/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1023
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_113/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1024
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_181/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1025
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_29/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1026
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_47/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1027
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_124/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1028
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_22/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1029
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_3/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1030
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_69/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1031
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_107/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1032
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_57/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1033
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_164/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1034
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_46/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1035
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_1/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1036
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_95/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1037
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_188/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1038
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_109/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1039
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_192/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1040
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_178/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1041
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_115/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1042
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_186/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1043
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_0/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1044
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_5/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1045
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_80/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1046
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_25/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1047
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_191/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1048
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_138/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1049
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_112/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1050
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_32/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1051
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_130/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1052
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_170/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1053
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_128/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1054
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_62/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1055
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_55/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1056
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_33/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1057
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_132/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1058
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_45/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1059
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_74/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1060
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_173/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1061
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_146/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1062
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_70/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1063
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_77/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
1064
+ examples_deprecated/circle_packing/results_circle_packing_WITH_vision_20260114_065819/gen_34/results/packing_viz.png filter=lfs diff=lfs merge=lfs -text
.venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_axes.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69e4bfe3ed01aa50342b79e1be0dccd434f6ab26d47a1135111ae87761e448ff
3
+ size 326542
.venv/lib/python3.13/site-packages/matplotlib/axes/__pycache__/_base.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5388050de096f2f9291c81a32cba91d7f7db7fb06cd68e3d72472579fbecbaba
3
+ size 202795
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b184b89e3c1075f22f6b71575b6fc20d4972b3cfd3b23322ca6fd596dcaef167
3
+ size 704128
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:baada9a5172fe20886251aff0433fc38461912d5daf07287e7bee56620a8da96
3
+ size 331536
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28052813f7a709fc89f52d192dc995ef4f0fdc5c3d7b73a49d6849b1916d0cd0
3
+ size 251472
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:602ec86b8948cfcd956482fe64f94c36c867770149ef2f791d4613f443bcecb3
3
+ size 340240
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d93efec7a9d2e826768d1a2ee95b95870e15e29599a84f3484af1de1cec2e181
3
+ size 347064
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:167378031e2dddc6216d67819c9260e9a06ffc4c478e4e23cb98a6fd44b183c2
3
+ size 448228
.venv/lib/python3.13/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8533dc7083fa346bda1933d60ea4a83b67d0945bceaf1b3541f82b4a0e2c6a0
3
+ size 237360
.venv/lib/python3.13/site-packages/pip/_vendor/__pycache__/typing_extensions.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a939f6ebfcf5bf0245db39a57326a5f024bc9fa15fba4b8526086146f9b58c65
3
+ size 178260
.venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebc4c06b7d95e74e315419ee7e88e1d0f71e9e9477538c00a93a9ff8c66a6cfc
3
+ size 182784
.venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81a618f21cb87db9076134e70388b6e9cb7c2106739011b6a51772d22cae06b7
3
+ size 108032
.venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5dc9884a8f458371550e09bd396e5418bf375820a31b9899f6499bf391c7b2e
3
+ size 168448
.venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a319ffaba23a017d7b1e18ba726ba6c54c53d6446db55f92af53c279894f8ad
3
+ size 101888
.venv/lib/python3.13/site-packages/pip/_vendor/idna/__pycache__/uts46data.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a2e00441fe3e028ffacf0e8e071738a7467a04c45f42681649c01f824cca6b9
3
+ size 159013
.venv/lib/python3.13/site-packages/pip/_vendor/pkg_resources/__pycache__/__init__.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0d59cd3a13cec0d6fa4ee812cc12eec22c51e6fe8e15032f10e8c5a5b76305c
3
+ size 161621
.venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:515250a023268fd07bb2e3522df6922c8567f26e4bc76f5833fbeb57bd1293c5
3
+ size 205980
.venv/lib/python3.13/site-packages/pip/_vendor/rich/__pycache__/console.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83b6e3d3d318d675f16c6726c5478281c8079938ac0665c2e2777d767151db3c
3
+ size 113962
.venv/lib/python3.13/site-packages/wandb/bin/gpu_stats ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06209469379a5177ff760a7f09cb5315352dbb37e31a6376ec744c99a29f6ac6
3
+ size 11334704
.venv/lib/python3.13/site-packages/wandb/bin/wandb-core ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d01613cf37022f61eeeae0a8f34a23d70da3526fed875c5ee0118faae859e7b
3
+ size 51445944
.venv/lib/python3.13/site-packages/wandb/cli/__pycache__/cli.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d17d1f31aa53b485814c784a485fc30ce3c655984fd1d8425d55b0201c613a15
3
+ size 116465
.venv/lib/python3.13/site-packages/wandb/sdk/__pycache__/wandb_run.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2f6ccda517ae52cff2a7b5ade46f4336dd3fbb23783a0c92e6d0a102dfbe935
3
+ size 172818
.venv/lib/python3.13/site-packages/wandb/sdk/artifacts/__pycache__/artifact.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a6a2da0d3e2b471019d29de11bd37284f463d492ac4cf82334744f43d1637c9
3
+ size 115883
.venv/lib/python3.13/site-packages/wandb/sdk/internal/__pycache__/internal_api.cpython-313.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c82e303b5f0273ade380e5518f61fe8de7f92f558ed02aedb8a49eb7962a3d7
3
+ size 164828
docker_space/frontier_cs_3/interactor ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a3dd5cf98d709aa59bc7bf7414dc709443d86e5b770efb257d06c898f5141d0
3
+ size 310928
docker_space/frontier_cs_7/core ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdd9c8aade4835ba69120747445d5fa9b7a233690bcee08132c31aa73e5efebb
3
+ size 552960
examples_deprecated/circle_packing/demo_aux_results/extra.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e879ac74db27b5974e0503ad813e76270adf2b257fd32271b38109828e34f42
3
+ size 1398
examples_deprecated/circle_packing/demo_aux_results/packing_viz.png ADDED

Git LFS Details

  • SHA256: 8938b61e9e6dd8d4edac61b2bc0793948a32211e35efff2606eb6eafbda73276
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/__pycache__/main.cpython-313.pyc ADDED
Binary file (16.5 kB). View file
 
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/edit.diff ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --- a/original.py
2
+ +++ b/original.py
3
+ @@ -1,204 +1,291 @@
4
+ # EVOLVE-BLOCK-START
5
+ import numpy as np
6
+ from scipy.optimize import minimize
7
+
8
+ +class EliteOptimizer:
9
+ + """
10
+ + Manages the entire optimization process, including an elite pool for feedback,
11
+ + diverse seeding, and staged NLP runs.
12
+ + """
13
+ + def __init__(self, n_circles, config):
14
+ + self.n = n_circles
15
+ + self.config = config
16
+ +
17
+ + # --- Elite Pool (Hall of Fame) ---
18
+ + self.elite_pool = [] # Stores (score, x_vector) tuples
19
+ + self.elite_pool_capacity = config['elite_pool_capacity']
20
+ + self.uniqueness_threshold = config['uniqueness_threshold']
21
+ +
22
+ + # --- Problem Definition ---
23
+ + self.bounds = self._define_bounds()
24
+ + self.constraints = self._define_constraints()
25
+ + self.initial_strategies = self._get_initial_strategies()
26
+ +
27
+ + # --- Elite Pool Management ---
28
+ + def add_to_elite_pool(self, x):
29
+ + score = -self.objective_radii(x)
30
+ +
31
+ + # Check for uniqueness against existing elites to avoid redundancy
32
+ + new_centers, _ = self.unpack_vars(x)
33
+ + # Sort centers to make comparison invariant to circle indexing
34
+ + new_centers_sorted = new_centers[np.lexsort((new_centers[:, 1], new_centers[:, 0]))]
35
+ +
36
+ + for _, elite_x in self.elite_pool:
37
+ + elite_centers, _ = self.unpack_vars(elite_x)
38
+ + elite_centers_sorted = elite_centers[np.lexsort((elite_centers[:, 1], elite_centers[:, 0]))]
39
+ + if np.linalg.norm(new_centers_sorted - elite_centers_sorted) < self.uniqueness_threshold:
40
+ + return False # Not unique enough
41
+ +
42
+ + # If the pool has space or the new score is better than the worst elite, add it
43
+ + if len(self.elite_pool) < self.elite_pool_capacity or score > self.elite_pool[-1][0]:
44
+ + self.elite_pool.append((score, x))
45
+ + self.elite_pool.sort(key=lambda item: item[0], reverse=True) # Keep sorted by score
46
+ + if len(self.elite_pool) > self.elite_pool_capacity:
47
+ + self.elite_pool.pop() # Maintain capacity
48
+ + return True
49
+ + return False
50
+ +
51
+ + # --- Problem Formulation (Objectives, Constraints, Bounds) ---
52
+ + def pack_vars(self, centers, radii):
53
+ + x = np.zeros(self.n * 3)
54
+ + x[0::3], x[1::3], x[2::3] = centers[:, 0], centers[:, 1], radii
55
+ + return x
56
+ +
57
+ + def unpack_vars(self, x):
58
+ + centers = np.vstack((x[0::3], x[1::3])).T
59
+ + radii = x[2::3]
60
+ + return centers, radii
61
+ +
62
+ + def objective_area(self, x):
63
+ + _, radii = self.unpack_vars(x)
64
+ + return -np.sum(radii**2)
65
+ +
66
+ + def objective_radii(self, x):
67
+ + _, radii = self.unpack_vars(x)
68
+ + return -np.sum(radii)
69
+ +
70
+ + def _define_bounds(self):
71
+ + return [(0.0, 1.0), (0.0, 1.0), (1e-9, 0.5)] * self.n
72
+ +
73
+ + def _define_constraints(self):
74
+ + cons = []
75
+ + def non_overlap_constraint(x):
76
+ + centers, radii = self.unpack_vars(x)
77
+ + i, j = np.triu_indices(self.n, k=1)
78
+ + dist_sq = np.sum((centers[i] - centers[j])**2, axis=1)
79
+ + sum_radii_sq = (radii[i] + radii[j])**2
80
+ + return dist_sq - sum_radii_sq
81
+ + cons.append({'type': 'ineq', 'fun': non_overlap_constraint})
82
+ +
83
+ + def boundary_constraint(x):
84
+ + centers, radii = self.unpack_vars(x)
85
+ + return np.concatenate([
86
+ + centers[:, 0] - radii, 1 - centers[:, 0] - radii,
87
+ + centers[:, 1] - radii, 1 - centers[:, 1] - radii
88
+ + ])
89
+ + cons.append({'type': 'ineq', 'fun': boundary_constraint})
90
+ + return cons
91
+ +
92
+ + # --- Initial State Generation ---
93
+ + def _get_initial_strategies(self):
94
+ + # Grid
95
+ + grid_centers = np.zeros((self.n, 2))
96
+ + idx = 0; grid_points = np.linspace(0.1, 0.9, 5)
97
+ + for i in range(5):
98
+ + for j in range(5):
99
+ + if i == 2 and j == 2: continue
100
+ + grid_centers[idx] = [grid_points[i], grid_points[j]]; idx += 1
101
+ + grid_centers[24], grid_centers[25] = [0.5, 0.45], [0.5, 0.55]
102
+ +
103
+ + # Best Known
104
+ + best_known_centers = np.array([
105
+ + [0.1136, 0.1136], [0.0708, 0.2931], [0.1297, 0.4848], [0.1088, 0.7224],
106
+ + [0.0851, 0.9149], [0.3299, 0.1029], [0.2408, 0.2845], [0.3534, 0.4458],
107
+ + [0.3031, 0.6392], [0.2949, 0.8708], [0.5335, 0.1008], [0.4355, 0.2711],
108
+ + [0.4488, 0.7384], [0.5252, 0.8974], [0.7351, 0.1008], [0.6343, 0.2781],
109
+ + [0.7103, 0.4961], [0.6275, 0.7152], [0.7305, 0.8973], [0.9175, 0.0825],
110
+ + [0.8686, 0.2908], [0.9190, 0.4972], [0.8669, 0.7048], [0.9161, 0.9161],
111
+ + [0.5234, 0.4175], [0.4860, 0.5786]
112
+ + ])
113
+ +
114
+ + # Hexagonal
115
+ + centers_hex = []; rows = [5, 6, 5, 6, 4]; y, r = 0.05, 0.1
116
+ + for i, count in enumerate(rows):
117
+ + offset = r if i % 2 != 0 else 0.05
118
+ + for j in range(count):
119
+ + if len(centers_hex) < self.n: centers_hex.append([offset + j * 2 * r, y])
120
+ + y += r * np.sqrt(3)
121
+ + centers_hex = np.array(centers_hex)
122
+ + if centers_hex.size > 0:
123
+ + centers_hex /= np.max(centers_hex, axis=0) * 1.05
124
+ + centers_hex += (1 - np.max(centers_hex, axis=0)) / 2
125
+ +
126
+ + return [
127
+ + grid_centers,
128
+ + best_known_centers,
129
+ + best_known_centers[:, [1, 0]], # Reflection across y=x
130
+ + 1.0 - best_known_centers, # Inversion through center
131
+ + centers_hex
132
+ + ]
133
+ +
134
+ + def _compute_initial_radii(self, centers):
135
+ + radii = np.zeros(self.n)
136
+ + MIN_GAP = self.config['initial_radii_min_gap']
137
+ + for i in range(self.n):
138
+ + radii[i] = min(centers[i,0], 1-centers[i,0], centers[i,1], 1-centers[i,1])
139
+ +
140
+ + for _ in range(self.config['initial_radii_max_iter']):
141
+ + changed = False
142
+ + for i in range(self.n):
143
+ + for j in range(i + 1, self.n):
144
+ + dist = np.linalg.norm(centers[i] - centers[j])
145
+ + if radii[i] + radii[j] > dist - MIN_GAP:
146
+ + target_sum = max(0.0, dist - MIN_GAP)
147
+ + if radii[i] + radii[j] > 1e-12:
148
+ + scale = target_sum / (radii[i] + radii[j])
149
+ + radii[i] *= scale; radii[j] *= scale
150
+ + changed = True
151
+ + if not changed: break
152
+ + return radii
153
+ +
154
+ + def _prepare_initial_state(self, base_centers, perturb_std):
155
+ + """Perturb, repel, and then compute initial radii for a robust start."""
156
+ + # 1. Perturb
157
+ + perturbed = np.clip(base_centers + np.random.normal(0, perturb_std, base_centers.shape), 0, 1)
158
+ +
159
+ + # 2. Repel (Lightweight force-directed pre-processing)
160
+ + cfg_repel = self.config['repulsion']
161
+ + c = perturbed.copy()
162
+ + for _ in range(cfg_repel['iterations']):
163
+ + forces = np.zeros_like(c)
164
+ + # Boundary repulsion
165
+ + forces[:, 0] += cfg_repel['boundary_strength'] * np.exp(-c[:, 0] / 0.1)
166
+ + forces[:, 0] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 0]) / 0.1)
167
+ + forces[:, 1] += cfg_repel['boundary_strength'] * np.exp(-c[:, 1] / 0.1)
168
+ + forces[:, 1] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 1]) / 0.1)
169
+ +
170
+ + # Inter-circle repulsion
171
+ + i, j = np.triu_indices(self.n, k=1)
172
+ + diffs = c[i] - c[j]
173
+ + dist_sq = np.sum(diffs**2, axis=1)
174
+ +
175
+ + # Repel only circles that are "close" to each other
176
+ + close_indices = np.where(dist_sq < cfg_repel['repel_radius_sq'])[0]
177
+ + for k in close_indices:
178
+ + force_mag = cfg_repel['strength'] / (dist_sq[k] + 1e-9)
179
+ + force_vec = diffs[k] * force_mag
180
+ + forces[i[k]] += force_vec
181
+ + forces[j[k]] -= force_vec
182
+ +
183
+ + c += forces * cfg_repel['dt']
184
+ + c = np.clip(c, 0, 1)
185
+ +
186
+ + # 3. Compute Radii
187
+ + initial_radii = self._compute_initial_radii(c)
188
+ + return self.pack_vars(c, initial_radii)
189
+ +
190
+ + # --- Main Optimization Loop ---
191
+ + def run(self):
192
+ + best_x = None
193
+ + best_score = -np.inf
194
+ +
195
+ + cfg_opts = self.config['optimizer_options']
196
+ + num_runs = self.config['num_optimization_runs']
197
+ + max_perturb = self.config['max_perturb_std']
198
+ + min_perturb = self.config['min_perturb_std']
199
+ + elite_seeding_prob = self.config['elite_seeding_prob']
200
+ +
201
+ + for run_idx in range(num_runs):
202
+ + perturb_std = max_perturb - (run_idx / (num_runs - 1)) * (max_perturb - min_perturb) if num_runs > 1 else min_perturb
203
+ +
204
+ + # Probabilistic choice between static and elite pools for seeding
205
+ + if self.elite_pool and np.random.rand() < elite_seeding_prob:
206
+ + _, elite_x = self.elite_pool[np.random.randint(len(self.elite_pool))]
207
+ + base_centers, _ = self.unpack_vars(elite_x)
208
+ + else:
209
+ + base_centers = self.initial_strategies[run_idx % len(self.initial_strategies)]
210
+ +
211
+ + x0 = self._prepare_initial_state(base_centers, perturb_std)
212
+ +
213
+ + # Staged Optimization
214
+ + res1 = minimize(self.objective_area, x0, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage1'])
215
+ + x1 = res1.x if res1.success else x0
216
+ +
217
+ + res2 = minimize(self.objective_radii, x1, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
218
+ + x2 = res2.x if res2.success else x1
219
+ +
220
+ + res3 = minimize(self.objective_radii, x2, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage3'])
221
+ + x_final = res3.x if res3.success else x2
222
+ +
223
+ + if -self.objective_radii(x_final) > best_score:
224
+ + best_score = -self.objective_radii(x_final)
225
+ + best_x = x_final
226
+ + self.add_to_elite_pool(x_final)
227
+ +
228
+ + # Final Polishing Stage
229
+ + if best_x is not None:
230
+ + res_polish = minimize(self.objective_radii, best_x, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['polish'])
231
+ + if res_polish.success and -res_polish.fun > best_score:
232
+ + best_x = res_polish.x
233
+ +
234
+ + # Fallback if no solution was found
235
+ + if best_x is None:
236
+ + x0_fallback = self._prepare_initial_state(self.initial_strategies[0], 0)
237
+ + res_fallback = minimize(self.objective_radii, x0_fallback, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
238
+ + best_x = res_fallback.x
239
+ +
240
+ + return self.unpack_vars(best_x)
241
+ +
242
+ +
243
+ def construct_packing():
244
+ """
245
+ - Constructs an optimized arrangement of 26 circles using a hybrid, high-precision,
246
+ - multi-start NLP approach. This method is a crossover of several successful prior
247
+ - implementations, combining their best features.
248
+ -
249
+ - - **Structure:** A single-phase, multi-start loop (inspired by high-scoring variants)
250
+ - runs a three-stage NLP optimization from multiple perturbed starting points.
251
+ - - **Precision:** Employs extremely tight solver tolerances for high-precision refinement,
252
+ - adopted from the best-performing parent.
253
+ - - **Stability:** Utilizes a numerically stable squared-distance non-overlap constraint,
254
+ - a key feature from another robust implementation.
255
+ - - **Robustness:** Includes stage-by-stage success checks and a fallback mechanism.
256
+ - """
257
+ - n = 26
258
+ -
259
+ - # --- Helper functions to pack/unpack optimization variables ---
260
+ - def pack_vars(centers, radii):
261
+ - x = np.zeros(n * 3)
262
+ - x[0::3] = centers[:, 0]
263
+ - x[1::3] = centers[:, 1]
264
+ - x[2::3] = radii
265
+ - return x
266
+ -
267
+ - def unpack_vars(x):
268
+ - centers_x = x[0::3]
269
+ - centers_y = x[1::3]
270
+ - radii = x[2::3]
271
+ - centers = np.vstack((centers_x, centers_y)).T
272
+ - return centers, radii
273
+ -
274
+ - # --- Initial Guess Generation ---
275
+ - def _compute_initial_radii(centers, max_iter=200):
276
+ - """Iteratively compute max feasible radii for a given set of centers."""
277
+ - num_circles = centers.shape[0]
278
+ - radii = np.zeros(num_circles)
279
+ - MIN_GAP = 1e-8 # Use a small gap for numerical robustness
280
+ -
281
+ - for i in range(num_circles):
282
+ - x, y = centers[i]
283
+ - radii[i] = min(x, 1 - x, y, 1 - y)
284
+ -
285
+ - for _ in range(max_iter):
286
+ - had_change = False
287
+ - for i in range(num_circles):
288
+ - for j in range(i + 1, num_circles):
289
+ - dist = np.linalg.norm(centers[i] - centers[j])
290
+ - sum_r = radii[i] + radii[j]
291
+ - if sum_r > dist - MIN_GAP:
292
+ - target_sum_r = max(0.0, dist - MIN_GAP)
293
+ - if sum_r > 1e-12:
294
+ - scale = target_sum_r / sum_r
295
+ - radii[i] *= scale
296
+ - radii[j] *= scale
297
+ - had_change = True
298
+ - if not had_change:
299
+ - break
300
+ - return radii
301
+ -
302
+ - # --- Objective Functions for Staged Optimization ---
303
+ - def objective_area(x):
304
+ - """Stage 1: Maximize sum of areas (r^2) for a dense packing."""
305
+ - _, radii = unpack_vars(x)
306
+ - return -np.sum(radii**2)
307
+ -
308
+ - def objective_radii(x):
309
+ - """Stage 2 & 3: Maximize sum of radii (r), the primary goal."""
310
+ - _, radii = unpack_vars(x)
311
+ - return -np.sum(radii)
312
+ -
313
+ - # --- Constraints (Numerically Stable Formulation) ---
314
+ - cons = []
315
+ -
316
+ - def non_overlap_constraint(x):
317
+ - """Constraint: dist_ij^2 - (ri + rj)^2 >= 0. This squared formulation avoids sqrt."""
318
+ - centers, radii = unpack_vars(x)
319
+ - i, j = np.triu_indices(n, k=1)
320
+ - dist_sq = np.sum((centers[i] - centers[j])**2, axis=1)
321
+ - sum_radii_sq = (radii[i] + radii[j])**2
322
+ - return dist_sq - sum_radii_sq
323
+ - cons.append({'type': 'ineq', 'fun': non_overlap_constraint})
324
+ -
325
+ - def boundary_constraint(x):
326
+ - """Constraint: All circles must be inside the [0,1]x[0,1] square."""
327
+ - centers, radii = unpack_vars(x)
328
+ - return np.concatenate([
329
+ - centers[:, 0] - radii, 1 - centers[:, 0] - radii,
330
+ - centers[:, 1] - radii, 1 - centers[:, 1] - radii
331
+ - ])
332
+ - cons.append({'type': 'ineq', 'fun': boundary_constraint})
333
+ -
334
+ - # --- Variable Bounds ---
335
+ - bounds = []
336
+ - MIN_RADIUS_BOUND = 1e-9 # Enforce non-zero radius for numerical stability.
337
+ - for _ in range(n):
338
+ - bounds.extend([(0.0, 1.0), (0.0, 1.0), (MIN_RADIUS_BOUND, 0.5)])
339
+ -
340
+ - # --- Multi-Start Optimizer with Hybrid Initial Guess ---
341
+ - # Strategy 1: The proven 5x5 grid with a split center.
342
+ - base_initial_centers_grid = np.zeros((n, 2))
343
+ - idx = 0
344
+ - grid_points = np.linspace(0.1, 0.9, 5)
345
+ - for i in range(5):
346
+ - for j in range(5):
347
+ - if i == 2 and j == 2: continue
348
+ - base_initial_centers_grid[idx] = [grid_points[i], grid_points[j]]
349
+ - idx += 1
350
+ - base_initial_centers_grid[24] = [0.5, 0.45]
351
+ - base_initial_centers_grid[25] = [0.5, 0.55]
352
+ -
353
+ - # Strategy 2: Seed with the current best known solution (powerful heuristic).
354
+ - base_centers_best_known = np.array([
355
+ - [0.1136, 0.1136], [0.0708, 0.2931], [0.1297, 0.4848], [0.1088, 0.7224],
356
+ - [0.0851, 0.9149], [0.3299, 0.1029], [0.2408, 0.2845], [0.3534, 0.4458],
357
+ - [0.3031, 0.6392], [0.2949, 0.8708], [0.5335, 0.1008], [0.4355, 0.2711],
358
+ - [0.4488, 0.7384], [0.5252, 0.8974], [0.7351, 0.1008], [0.6343, 0.2781],
359
+ - [0.7103, 0.4961], [0.6275, 0.7152], [0.7305, 0.8973], [0.9175, 0.0825],
360
+ - [0.8686, 0.2908], [0.9190, 0.4972], [0.8669, 0.7048], [0.9161, 0.9161],
361
+ - [0.5234, 0.4175], [0.4860, 0.5786]
362
+ - ])
363
+ - initial_strategies = [base_initial_centers_grid, base_centers_best_known]
364
+ -
365
+ - best_sum_radii = -np.inf
366
+ - best_result_x = None
367
+ -
368
+ - num_optimization_runs = 50 # Increased runs for broader exploration
369
+ -
370
+ - # High-precision optimizer settings with increased max iterations for the final stage.
371
+ - options_stage1 = {'maxiter': 1000, 'ftol': 1e-9, 'gtol': 1e-6, 'disp': False}
372
+ - options_stage2 = {'maxiter': 2500, 'ftol': 1e-11, 'gtol': 1e-8, 'disp': False}
373
+ - options_stage3 = {'maxiter': 5000, 'ftol': 1e-13, 'gtol': 1e-10, 'disp': False}
374
+ -
375
+ - max_perturb_std = 0.035
376
+ - min_perturb_std = 0.003
377
+ -
378
+ - for run in range(num_optimization_runs):
379
+ - # Linearly decreasing perturbation standard deviation
380
+ - if num_optimization_runs > 1:
381
+ - perturb_std = max_perturb_std - (run / (num_optimization_runs - 1)) * (max_perturb_std - min_perturb_std)
382
+ - else:
383
+ - perturb_std = min_perturb_std
384
+ -
385
+ - # Cycle through initial guess strategies
386
+ - base_centers = initial_strategies[run % len(initial_strategies)]
387
+ -
388
+ - perturbed_centers = base_centers + np.random.normal(0, perturb_std, base_centers.shape)
389
+ - perturbed_centers = np.clip(perturbed_centers, 0.0, 1.0)
390
+ -
391
+ - perturbed_radii = _compute_initial_radii(perturbed_centers)
392
+ - x0_run = pack_vars(perturbed_centers, perturbed_radii)
393
+ -
394
+ - # Stage 1: Maximize sum of areas
395
+ - res1 = minimize(objective_area, x0_run, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage1)
396
+ - x_after_s1 = res1.x if res1.success else x0_run
397
+ -
398
+ - # Stage 2: Maximize sum of radii
399
+ - res2 = minimize(objective_radii, x_after_s1, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage2)
400
+ - x_after_s2 = res2.x if res2.success else x_after_s1
401
+ -
402
+ - # Stage 3: Further maximize sum of radii with highest precision
403
+ - res3 = minimize(objective_radii, x_after_s2, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage3)
404
+ - final_run_x = res3.x if res3.success else x_after_s2
405
+ -
406
+ - _, current_radii = unpack_vars(final_run_x)
407
+ - current_sum_radii = np.sum(current_radii)
408
+ -
409
+ - if current_sum_radii > best_sum_radii:
410
+ - best_sum_radii = current_sum_radii
411
+ - best_result_x = final_run_x
412
+ -
413
+ - # --- Final Polishing Stage ---
414
+ - # After all runs, take the best solution and run one more hyper-aggressive optimization.
415
+ - if best_result_x is not None:
416
+ - options_polish = {'maxiter': 10000, 'ftol': 1e-15, 'gtol': 1e-12, 'disp': False}
417
+ - res_polish = minimize(objective_radii, best_result_x, method='SLSQP',
418
+ - bounds=bounds, constraints=cons, options=options_polish)
419
+ - if res_polish.success and -res_polish.fun > best_sum_radii:
420
+ - best_result_x = res_polish.x
421
+ - best_sum_radii = -res_polish.fun
422
+ -
423
+ - # --- Final Result Extraction ---
424
+ - # Fallback if all runs fail (highly unlikely)
425
+ - if best_result_x is None:
426
+ - initial_radii = _compute_initial_radii(initial_strategies[0]) # Use first strategy as fallback
427
+ - best_result_x = pack_vars(initial_strategies[0], initial_radii)
428
+ -
429
+ - final_centers, final_radii = unpack_vars(best_result_x)
430
+ - final_radii = np.maximum(final_radii, 0) # Final cleanup
431
+ -
432
+ - return final_centers, final_radii
433
+ + Sets up and runs the Elite Propagating Basin Search optimizer.
434
+ + This architecture integrates a dynamic Hall of Fame (elite pool) with a
435
+ + diverse set of initial strategies and a robust pre-processing step to
436
+ + systematically explore and exploit the solution space.
437
+ + """
438
+ + config = {
439
+ + # Search process
440
+ + 'num_optimization_runs': 60,
441
+ + 'max_perturb_std': 0.04,
442
+ + 'min_perturb_std': 0.001,
443
+ + 'elite_seeding_prob': 0.75,
444
+ +
445
+ + # Elite Pool
446
+ + 'elite_pool_capacity': 8,
447
+ + 'uniqueness_threshold': 0.01,
448
+ +
449
+ + # Initial state preparation
450
+ + 'initial_radii_min_gap': 1e-8,
451
+ + 'initial_radii_max_iter': 200,
452
+ + 'repulsion': {
453
+ + 'iterations': 20,
454
+ + 'strength': 0.0005,
455
+ + 'dt': 0.1,
456
+ + 'repel_radius_sq': 0.2**2,
457
+ + 'boundary_strength': 0.005,
458
+ + },
459
+ +
460
+ + # SLSQP optimizer options
461
+ + 'optimizer_options': {
462
+ + 'stage1': {'maxiter': 1200, 'ftol': 1e-9, 'gtol': 1e-6, 'disp': False},
463
+ + 'stage2': {'maxiter': 3000, 'ftol': 1e-11, 'gtol': 1e-8, 'disp': False},
464
+ + 'stage3': {'maxiter': 6000, 'ftol': 1e-13, 'gtol': 1e-10, 'disp': False},
465
+ + 'polish': {'maxiter': 15000,'ftol': 1e-15, 'gtol': 1e-12, 'disp': False},
466
+ + }
467
+ + }
468
+ +
469
+ + optimizer = EliteOptimizer(n_circles=26, config=config)
470
+ + final_centers, final_radii = optimizer.run()
471
+ +
472
+ + return final_centers, np.maximum(final_radii, 0)
473
+ # EVOLVE-BLOCK-END
474
+
475
+
476
+ # This part remains fixed (not evolved)
477
+ def run_packing():
478
+ """Run the circle packing constructor for n=26"""
479
+ centers, radii = construct_packing()
480
+ # Calculate the sum of radii
481
+ sum_radii = np.sum(radii)
482
+ return centers, radii, sum_radii
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/main.py ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVOLVE-BLOCK-START
2
+ import numpy as np
3
+ from scipy.optimize import minimize
4
+
5
+ class EliteOptimizer:
6
+ """
7
+ Manages the entire optimization process, including an elite pool for feedback,
8
+ diverse seeding, and staged NLP runs.
9
+ """
10
+ def __init__(self, n_circles, config):
11
+ self.n = n_circles
12
+ self.config = config
13
+
14
+ # --- Elite Pool (Hall of Fame) ---
15
+ self.elite_pool = [] # Stores (score, x_vector) tuples
16
+ self.elite_pool_capacity = config['elite_pool_capacity']
17
+ self.uniqueness_threshold = config['uniqueness_threshold']
18
+
19
+ # --- Problem Definition ---
20
+ self.bounds = self._define_bounds()
21
+ self.constraints = self._define_constraints()
22
+ self.initial_strategies = self._get_initial_strategies()
23
+
24
+ # --- Elite Pool Management ---
25
+ def add_to_elite_pool(self, x):
26
+ score = -self.objective_radii(x)
27
+
28
+ # Check for uniqueness against existing elites to avoid redundancy
29
+ new_centers, _ = self.unpack_vars(x)
30
+ # Sort centers to make comparison invariant to circle indexing
31
+ new_centers_sorted = new_centers[np.lexsort((new_centers[:, 1], new_centers[:, 0]))]
32
+
33
+ for _, elite_x in self.elite_pool:
34
+ elite_centers, _ = self.unpack_vars(elite_x)
35
+ elite_centers_sorted = elite_centers[np.lexsort((elite_centers[:, 1], elite_centers[:, 0]))]
36
+ if np.linalg.norm(new_centers_sorted - elite_centers_sorted) < self.uniqueness_threshold:
37
+ return False # Not unique enough
38
+
39
+ # If the pool has space or the new score is better than the worst elite, add it
40
+ if len(self.elite_pool) < self.elite_pool_capacity or score > self.elite_pool[-1][0]:
41
+ self.elite_pool.append((score, x))
42
+ self.elite_pool.sort(key=lambda item: item[0], reverse=True) # Keep sorted by score
43
+ if len(self.elite_pool) > self.elite_pool_capacity:
44
+ self.elite_pool.pop() # Maintain capacity
45
+ return True
46
+ return False
47
+
48
+ # --- Problem Formulation (Objectives, Constraints, Bounds) ---
49
+ def pack_vars(self, centers, radii):
50
+ x = np.zeros(self.n * 3)
51
+ x[0::3], x[1::3], x[2::3] = centers[:, 0], centers[:, 1], radii
52
+ return x
53
+
54
+ def unpack_vars(self, x):
55
+ centers = np.vstack((x[0::3], x[1::3])).T
56
+ radii = x[2::3]
57
+ return centers, radii
58
+
59
+ def objective_area(self, x):
60
+ _, radii = self.unpack_vars(x)
61
+ return -np.sum(radii**2)
62
+
63
+ def objective_radii(self, x):
64
+ _, radii = self.unpack_vars(x)
65
+ return -np.sum(radii)
66
+
67
+ def _define_bounds(self):
68
+ return [(0.0, 1.0), (0.0, 1.0), (1e-9, 0.5)] * self.n
69
+
70
+ def _define_constraints(self):
71
+ cons = []
72
+ def non_overlap_constraint(x):
73
+ centers, radii = self.unpack_vars(x)
74
+ i, j = np.triu_indices(self.n, k=1)
75
+ dist_sq = np.sum((centers[i] - centers[j])**2, axis=1)
76
+ sum_radii_sq = (radii[i] + radii[j])**2
77
+ return dist_sq - sum_radii_sq
78
+ cons.append({'type': 'ineq', 'fun': non_overlap_constraint})
79
+
80
+ def boundary_constraint(x):
81
+ centers, radii = self.unpack_vars(x)
82
+ return np.concatenate([
83
+ centers[:, 0] - radii, 1 - centers[:, 0] - radii,
84
+ centers[:, 1] - radii, 1 - centers[:, 1] - radii
85
+ ])
86
+ cons.append({'type': 'ineq', 'fun': boundary_constraint})
87
+ return cons
88
+
89
+ # --- Initial State Generation ---
90
+ def _get_initial_strategies(self):
91
+ # Grid
92
+ grid_centers = np.zeros((self.n, 2))
93
+ idx = 0; grid_points = np.linspace(0.1, 0.9, 5)
94
+ for i in range(5):
95
+ for j in range(5):
96
+ if i == 2 and j == 2: continue
97
+ grid_centers[idx] = [grid_points[i], grid_points[j]]; idx += 1
98
+ grid_centers[24], grid_centers[25] = [0.5, 0.45], [0.5, 0.55]
99
+
100
+ # Best Known
101
+ best_known_centers = np.array([
102
+ [0.1136, 0.1136], [0.0708, 0.2931], [0.1297, 0.4848], [0.1088, 0.7224],
103
+ [0.0851, 0.9149], [0.3299, 0.1029], [0.2408, 0.2845], [0.3534, 0.4458],
104
+ [0.3031, 0.6392], [0.2949, 0.8708], [0.5335, 0.1008], [0.4355, 0.2711],
105
+ [0.4488, 0.7384], [0.5252, 0.8974], [0.7351, 0.1008], [0.6343, 0.2781],
106
+ [0.7103, 0.4961], [0.6275, 0.7152], [0.7305, 0.8973], [0.9175, 0.0825],
107
+ [0.8686, 0.2908], [0.9190, 0.4972], [0.8669, 0.7048], [0.9161, 0.9161],
108
+ [0.5234, 0.4175], [0.4860, 0.5786]
109
+ ])
110
+
111
+ # Hexagonal
112
+ centers_hex = []; rows = [5, 6, 5, 6, 4]; y, r = 0.05, 0.1
113
+ for i, count in enumerate(rows):
114
+ offset = r if i % 2 != 0 else 0.05
115
+ for j in range(count):
116
+ if len(centers_hex) < self.n: centers_hex.append([offset + j * 2 * r, y])
117
+ y += r * np.sqrt(3)
118
+ centers_hex = np.array(centers_hex)
119
+ if centers_hex.size > 0:
120
+ centers_hex /= np.max(centers_hex, axis=0) * 1.05
121
+ centers_hex += (1 - np.max(centers_hex, axis=0)) / 2
122
+
123
+ return [
124
+ grid_centers,
125
+ best_known_centers,
126
+ best_known_centers[:, [1, 0]], # Reflection across y=x
127
+ 1.0 - best_known_centers, # Inversion through center
128
+ centers_hex
129
+ ]
130
+
131
+ def _compute_initial_radii(self, centers):
132
+ radii = np.zeros(self.n)
133
+ MIN_GAP = self.config['initial_radii_min_gap']
134
+ for i in range(self.n):
135
+ radii[i] = min(centers[i,0], 1-centers[i,0], centers[i,1], 1-centers[i,1])
136
+
137
+ for _ in range(self.config['initial_radii_max_iter']):
138
+ changed = False
139
+ for i in range(self.n):
140
+ for j in range(i + 1, self.n):
141
+ dist = np.linalg.norm(centers[i] - centers[j])
142
+ if radii[i] + radii[j] > dist - MIN_GAP:
143
+ target_sum = max(0.0, dist - MIN_GAP)
144
+ if radii[i] + radii[j] > 1e-12:
145
+ scale = target_sum / (radii[i] + radii[j])
146
+ radii[i] *= scale; radii[j] *= scale
147
+ changed = True
148
+ if not changed: break
149
+ return radii
150
+
151
+ def _prepare_initial_state(self, base_centers, perturb_std):
152
+ """Perturb, repel, and then compute initial radii for a robust start."""
153
+ # 1. Perturb
154
+ perturbed = np.clip(base_centers + np.random.normal(0, perturb_std, base_centers.shape), 0, 1)
155
+
156
+ # 2. Repel (Lightweight force-directed pre-processing)
157
+ cfg_repel = self.config['repulsion']
158
+ c = perturbed.copy()
159
+ for _ in range(cfg_repel['iterations']):
160
+ forces = np.zeros_like(c)
161
+ # Boundary repulsion
162
+ forces[:, 0] += cfg_repel['boundary_strength'] * np.exp(-c[:, 0] / 0.1)
163
+ forces[:, 0] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 0]) / 0.1)
164
+ forces[:, 1] += cfg_repel['boundary_strength'] * np.exp(-c[:, 1] / 0.1)
165
+ forces[:, 1] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 1]) / 0.1)
166
+
167
+ # Inter-circle repulsion
168
+ i, j = np.triu_indices(self.n, k=1)
169
+ diffs = c[i] - c[j]
170
+ dist_sq = np.sum(diffs**2, axis=1)
171
+
172
+ # Repel only circles that are "close" to each other
173
+ close_indices = np.where(dist_sq < cfg_repel['repel_radius_sq'])[0]
174
+ for k in close_indices:
175
+ force_mag = cfg_repel['strength'] / (dist_sq[k] + 1e-9)
176
+ force_vec = diffs[k] * force_mag
177
+ forces[i[k]] += force_vec
178
+ forces[j[k]] -= force_vec
179
+
180
+ c += forces * cfg_repel['dt']
181
+ c = np.clip(c, 0, 1)
182
+
183
+ # 3. Compute Radii
184
+ initial_radii = self._compute_initial_radii(c)
185
+ return self.pack_vars(c, initial_radii)
186
+
187
+ # --- Main Optimization Loop ---
188
+ def run(self):
189
+ best_x = None
190
+ best_score = -np.inf
191
+
192
+ cfg_opts = self.config['optimizer_options']
193
+ num_runs = self.config['num_optimization_runs']
194
+ max_perturb = self.config['max_perturb_std']
195
+ min_perturb = self.config['min_perturb_std']
196
+ elite_seeding_prob = self.config['elite_seeding_prob']
197
+
198
+ for run_idx in range(num_runs):
199
+ perturb_std = max_perturb - (run_idx / (num_runs - 1)) * (max_perturb - min_perturb) if num_runs > 1 else min_perturb
200
+
201
+ # Probabilistic choice between static and elite pools for seeding
202
+ if self.elite_pool and np.random.rand() < elite_seeding_prob:
203
+ _, elite_x = self.elite_pool[np.random.randint(len(self.elite_pool))]
204
+ base_centers, _ = self.unpack_vars(elite_x)
205
+ else:
206
+ base_centers = self.initial_strategies[run_idx % len(self.initial_strategies)]
207
+
208
+ x0 = self._prepare_initial_state(base_centers, perturb_std)
209
+
210
+ # Staged Optimization
211
+ res1 = minimize(self.objective_area, x0, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage1'])
212
+ x1 = res1.x if res1.success else x0
213
+
214
+ res2 = minimize(self.objective_radii, x1, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
215
+ x2 = res2.x if res2.success else x1
216
+
217
+ res3 = minimize(self.objective_radii, x2, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage3'])
218
+ x_final = res3.x if res3.success else x2
219
+
220
+ if -self.objective_radii(x_final) > best_score:
221
+ best_score = -self.objective_radii(x_final)
222
+ best_x = x_final
223
+ self.add_to_elite_pool(x_final)
224
+
225
+ # Final Polishing Stage
226
+ if best_x is not None:
227
+ res_polish = minimize(self.objective_radii, best_x, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['polish'])
228
+ if res_polish.success and -res_polish.fun > best_score:
229
+ best_x = res_polish.x
230
+
231
+ # Fallback if no solution was found
232
+ if best_x is None:
233
+ x0_fallback = self._prepare_initial_state(self.initial_strategies[0], 0)
234
+ res_fallback = minimize(self.objective_radii, x0_fallback, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
235
+ best_x = res_fallback.x
236
+
237
+ return self.unpack_vars(best_x)
238
+
239
+
240
+ def construct_packing():
241
+ """
242
+ Sets up and runs the Elite Propagating Basin Search optimizer.
243
+ This architecture integrates a dynamic Hall of Fame (elite pool) with a
244
+ diverse set of initial strategies and a robust pre-processing step to
245
+ systematically explore and exploit the solution space.
246
+ """
247
+ config = {
248
+ # Search process
249
+ 'num_optimization_runs': 60,
250
+ 'max_perturb_std': 0.04,
251
+ 'min_perturb_std': 0.001,
252
+ 'elite_seeding_prob': 0.75,
253
+
254
+ # Elite Pool
255
+ 'elite_pool_capacity': 8,
256
+ 'uniqueness_threshold': 0.01,
257
+
258
+ # Initial state preparation
259
+ 'initial_radii_min_gap': 1e-8,
260
+ 'initial_radii_max_iter': 200,
261
+ 'repulsion': {
262
+ 'iterations': 20,
263
+ 'strength': 0.0005,
264
+ 'dt': 0.1,
265
+ 'repel_radius_sq': 0.2**2,
266
+ 'boundary_strength': 0.005,
267
+ },
268
+
269
+ # SLSQP optimizer options
270
+ 'optimizer_options': {
271
+ 'stage1': {'maxiter': 1200, 'ftol': 1e-9, 'gtol': 1e-6, 'disp': False},
272
+ 'stage2': {'maxiter': 3000, 'ftol': 1e-11, 'gtol': 1e-8, 'disp': False},
273
+ 'stage3': {'maxiter': 6000, 'ftol': 1e-13, 'gtol': 1e-10, 'disp': False},
274
+ 'polish': {'maxiter': 15000,'ftol': 1e-15, 'gtol': 1e-12, 'disp': False},
275
+ }
276
+ }
277
+
278
+ optimizer = EliteOptimizer(n_circles=26, config=config)
279
+ final_centers, final_radii = optimizer.run()
280
+
281
+ return final_centers, np.maximum(final_radii, 0)
282
+ # EVOLVE-BLOCK-END
283
+
284
+
285
+ # This part remains fixed (not evolved)
286
+ def run_packing():
287
+ """Run the circle packing constructor for n=26"""
288
+ centers, radii = construct_packing()
289
+ # Calculate the sum of radii
290
+ sum_radii = np.sum(radii)
291
+ return centers, radii, sum_radii
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/original.py ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVOLVE-BLOCK-START
2
+ import numpy as np
3
+ from scipy.optimize import minimize
4
+
5
+ def construct_packing():
6
+ """
7
+ Constructs an optimized arrangement of 26 circles using a hybrid, high-precision,
8
+ multi-start NLP approach. This method is a crossover of several successful prior
9
+ implementations, combining their best features.
10
+
11
+ - **Structure:** A single-phase, multi-start loop (inspired by high-scoring variants)
12
+ runs a three-stage NLP optimization from multiple perturbed starting points.
13
+ - **Precision:** Employs extremely tight solver tolerances for high-precision refinement,
14
+ adopted from the best-performing parent.
15
+ - **Stability:** Utilizes a numerically stable squared-distance non-overlap constraint,
16
+ a key feature from another robust implementation.
17
+ - **Robustness:** Includes stage-by-stage success checks and a fallback mechanism.
18
+ """
19
+ n = 26
20
+
21
+ # --- Helper functions to pack/unpack optimization variables ---
22
+ def pack_vars(centers, radii):
23
+ x = np.zeros(n * 3)
24
+ x[0::3] = centers[:, 0]
25
+ x[1::3] = centers[:, 1]
26
+ x[2::3] = radii
27
+ return x
28
+
29
+ def unpack_vars(x):
30
+ centers_x = x[0::3]
31
+ centers_y = x[1::3]
32
+ radii = x[2::3]
33
+ centers = np.vstack((centers_x, centers_y)).T
34
+ return centers, radii
35
+
36
+ # --- Initial Guess Generation ---
37
+ def _compute_initial_radii(centers, max_iter=200):
38
+ """Iteratively compute max feasible radii for a given set of centers."""
39
+ num_circles = centers.shape[0]
40
+ radii = np.zeros(num_circles)
41
+ MIN_GAP = 1e-8 # Use a small gap for numerical robustness
42
+
43
+ for i in range(num_circles):
44
+ x, y = centers[i]
45
+ radii[i] = min(x, 1 - x, y, 1 - y)
46
+
47
+ for _ in range(max_iter):
48
+ had_change = False
49
+ for i in range(num_circles):
50
+ for j in range(i + 1, num_circles):
51
+ dist = np.linalg.norm(centers[i] - centers[j])
52
+ sum_r = radii[i] + radii[j]
53
+ if sum_r > dist - MIN_GAP:
54
+ target_sum_r = max(0.0, dist - MIN_GAP)
55
+ if sum_r > 1e-12:
56
+ scale = target_sum_r / sum_r
57
+ radii[i] *= scale
58
+ radii[j] *= scale
59
+ had_change = True
60
+ if not had_change:
61
+ break
62
+ return radii
63
+
64
+ # --- Objective Functions for Staged Optimization ---
65
+ def objective_area(x):
66
+ """Stage 1: Maximize sum of areas (r^2) for a dense packing."""
67
+ _, radii = unpack_vars(x)
68
+ return -np.sum(radii**2)
69
+
70
+ def objective_radii(x):
71
+ """Stage 2 & 3: Maximize sum of radii (r), the primary goal."""
72
+ _, radii = unpack_vars(x)
73
+ return -np.sum(radii)
74
+
75
+ # --- Constraints (Numerically Stable Formulation) ---
76
+ cons = []
77
+
78
+ def non_overlap_constraint(x):
79
+ """Constraint: dist_ij^2 - (ri + rj)^2 >= 0. This squared formulation avoids sqrt."""
80
+ centers, radii = unpack_vars(x)
81
+ i, j = np.triu_indices(n, k=1)
82
+ dist_sq = np.sum((centers[i] - centers[j])**2, axis=1)
83
+ sum_radii_sq = (radii[i] + radii[j])**2
84
+ return dist_sq - sum_radii_sq
85
+ cons.append({'type': 'ineq', 'fun': non_overlap_constraint})
86
+
87
+ def boundary_constraint(x):
88
+ """Constraint: All circles must be inside the [0,1]x[0,1] square."""
89
+ centers, radii = unpack_vars(x)
90
+ return np.concatenate([
91
+ centers[:, 0] - radii, 1 - centers[:, 0] - radii,
92
+ centers[:, 1] - radii, 1 - centers[:, 1] - radii
93
+ ])
94
+ cons.append({'type': 'ineq', 'fun': boundary_constraint})
95
+
96
+ # --- Variable Bounds ---
97
+ bounds = []
98
+ MIN_RADIUS_BOUND = 1e-9 # Enforce non-zero radius for numerical stability.
99
+ for _ in range(n):
100
+ bounds.extend([(0.0, 1.0), (0.0, 1.0), (MIN_RADIUS_BOUND, 0.5)])
101
+
102
+ # --- Multi-Start Optimizer with Hybrid Initial Guess ---
103
+ # Strategy 1: The proven 5x5 grid with a split center.
104
+ base_initial_centers_grid = np.zeros((n, 2))
105
+ idx = 0
106
+ grid_points = np.linspace(0.1, 0.9, 5)
107
+ for i in range(5):
108
+ for j in range(5):
109
+ if i == 2 and j == 2: continue
110
+ base_initial_centers_grid[idx] = [grid_points[i], grid_points[j]]
111
+ idx += 1
112
+ base_initial_centers_grid[24] = [0.5, 0.45]
113
+ base_initial_centers_grid[25] = [0.5, 0.55]
114
+
115
+ # Strategy 2: Seed with the current best known solution (powerful heuristic).
116
+ base_centers_best_known = np.array([
117
+ [0.1136, 0.1136], [0.0708, 0.2931], [0.1297, 0.4848], [0.1088, 0.7224],
118
+ [0.0851, 0.9149], [0.3299, 0.1029], [0.2408, 0.2845], [0.3534, 0.4458],
119
+ [0.3031, 0.6392], [0.2949, 0.8708], [0.5335, 0.1008], [0.4355, 0.2711],
120
+ [0.4488, 0.7384], [0.5252, 0.8974], [0.7351, 0.1008], [0.6343, 0.2781],
121
+ [0.7103, 0.4961], [0.6275, 0.7152], [0.7305, 0.8973], [0.9175, 0.0825],
122
+ [0.8686, 0.2908], [0.9190, 0.4972], [0.8669, 0.7048], [0.9161, 0.9161],
123
+ [0.5234, 0.4175], [0.4860, 0.5786]
124
+ ])
125
+ initial_strategies = [base_initial_centers_grid, base_centers_best_known]
126
+
127
+ best_sum_radii = -np.inf
128
+ best_result_x = None
129
+
130
+ num_optimization_runs = 50 # Increased runs for broader exploration
131
+
132
+ # High-precision optimizer settings with increased max iterations for the final stage.
133
+ options_stage1 = {'maxiter': 1000, 'ftol': 1e-9, 'gtol': 1e-6, 'disp': False}
134
+ options_stage2 = {'maxiter': 2500, 'ftol': 1e-11, 'gtol': 1e-8, 'disp': False}
135
+ options_stage3 = {'maxiter': 5000, 'ftol': 1e-13, 'gtol': 1e-10, 'disp': False}
136
+
137
+ max_perturb_std = 0.035
138
+ min_perturb_std = 0.003
139
+
140
+ for run in range(num_optimization_runs):
141
+ # Linearly decreasing perturbation standard deviation
142
+ if num_optimization_runs > 1:
143
+ perturb_std = max_perturb_std - (run / (num_optimization_runs - 1)) * (max_perturb_std - min_perturb_std)
144
+ else:
145
+ perturb_std = min_perturb_std
146
+
147
+ # Cycle through initial guess strategies
148
+ base_centers = initial_strategies[run % len(initial_strategies)]
149
+
150
+ perturbed_centers = base_centers + np.random.normal(0, perturb_std, base_centers.shape)
151
+ perturbed_centers = np.clip(perturbed_centers, 0.0, 1.0)
152
+
153
+ perturbed_radii = _compute_initial_radii(perturbed_centers)
154
+ x0_run = pack_vars(perturbed_centers, perturbed_radii)
155
+
156
+ # Stage 1: Maximize sum of areas
157
+ res1 = minimize(objective_area, x0_run, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage1)
158
+ x_after_s1 = res1.x if res1.success else x0_run
159
+
160
+ # Stage 2: Maximize sum of radii
161
+ res2 = minimize(objective_radii, x_after_s1, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage2)
162
+ x_after_s2 = res2.x if res2.success else x_after_s1
163
+
164
+ # Stage 3: Further maximize sum of radii with highest precision
165
+ res3 = minimize(objective_radii, x_after_s2, method='SLSQP', bounds=bounds, constraints=cons, options=options_stage3)
166
+ final_run_x = res3.x if res3.success else x_after_s2
167
+
168
+ _, current_radii = unpack_vars(final_run_x)
169
+ current_sum_radii = np.sum(current_radii)
170
+
171
+ if current_sum_radii > best_sum_radii:
172
+ best_sum_radii = current_sum_radii
173
+ best_result_x = final_run_x
174
+
175
+ # --- Final Polishing Stage ---
176
+ # After all runs, take the best solution and run one more hyper-aggressive optimization.
177
+ if best_result_x is not None:
178
+ options_polish = {'maxiter': 10000, 'ftol': 1e-15, 'gtol': 1e-12, 'disp': False}
179
+ res_polish = minimize(objective_radii, best_result_x, method='SLSQP',
180
+ bounds=bounds, constraints=cons, options=options_polish)
181
+ if res_polish.success and -res_polish.fun > best_sum_radii:
182
+ best_result_x = res_polish.x
183
+ best_sum_radii = -res_polish.fun
184
+
185
+ # --- Final Result Extraction ---
186
+ # Fallback if all runs fail (highly unlikely)
187
+ if best_result_x is None:
188
+ initial_radii = _compute_initial_radii(initial_strategies[0]) # Use first strategy as fallback
189
+ best_result_x = pack_vars(initial_strategies[0], initial_radii)
190
+
191
+ final_centers, final_radii = unpack_vars(best_result_x)
192
+ final_radii = np.maximum(final_radii, 0) # Final cleanup
193
+
194
+ return final_centers, final_radii
195
+ # EVOLVE-BLOCK-END
196
+
197
+
198
+ # This part remains fixed (not evolved)
199
+ def run_packing():
200
+ """Run the circle packing constructor for n=26"""
201
+ centers, radii = construct_packing()
202
+ # Calculate the sum of radii
203
+ sum_radii = np.sum(radii)
204
+ return centers, radii, sum_radii
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/results/correct.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "correct": true,
3
+ "error": null
4
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/results/metrics.json ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "combined_score": 2.6359830849177337,
3
+ "correct": true,
4
+ "primary": {
5
+ "combined_score": 2.6359830849177337,
6
+ "public": {
7
+ "centers_str": " centers[0] = (0.1112, 0.1112)\n centers[1] = (0.0926, 0.3141)\n centers[2] = (0.0939, 0.5006)\n centers[3] = (0.0924, 0.6869)\n centers[4] = (0.1108, 0.8892)\n centers[5] = (0.3179, 0.0962)\n centers[6] = (0.2370, 0.2406)\n centers[7] = (0.2580, 0.4048)\n centers[8] = (0.2363, 0.7603)\n centers[9] = (0.3167, 0.9043)\n centers[10] = (0.5174, 0.1035)\n centers[11] = (0.4040, 0.2731)\n centers[12] = (0.4024, 0.7284)\n centers[13] = (0.5154, 0.8969)\n centers[14] = (0.7260, 0.1052)\n centers[15] = (0.6183, 0.2974)\n centers[16] = (0.7247, 0.5045)\n centers[17] = (0.6131, 0.7053)\n centers[18] = (0.7252, 0.8932)\n centers[19] = (0.9151, 0.0849)\n centers[20] = (0.8667, 0.2977)\n centers[21] = (0.9211, 0.5027)\n centers[22] = (0.8698, 0.7054)\n centers[23] = (0.9154, 0.9154)\n centers[24] = (0.4700, 0.5013)\n centers[25] = (0.2576, 0.5966)",
8
+ "num_circles": 26
9
+ },
10
+ "private": {
11
+ "reported_sum_of_radii": 2.6359830849177337
12
+ },
13
+ "execution_time_mean": 599.4981776839122,
14
+ "execution_time_std": 0.0,
15
+ "num_valid_runs": 1,
16
+ "num_invalid_runs": 0,
17
+ "all_validation_errors": [],
18
+ "correct": true,
19
+ "validation_error": null
20
+ },
21
+ "auxiliary": {
22
+ "error": "unexpected indent (auxiliary_metrics.py, line 164)",
23
+ "traceback": "Traceback (most recent call last):\n File \"/home/tengxiao/pj/ShinkaEvolve/eval_agent/ev2_service_standalone.py\", line 912, in run_auxiliary_evaluators\n spec.loader.exec_module(aux_module)\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^\n File \"<frozen importlib._bootstrap_external>\", line 1022, in exec_module\n File \"<frozen importlib._bootstrap_external>\", line 1160, in get_code\n File \"<frozen importlib._bootstrap_external>\", line 1090, in source_to_code\n File \"<frozen importlib._bootstrap>\", line 488, in _call_with_frames_removed\n File \"/home/tengxiao/pj/ShinkaEvolve/examples/circle_packing/results/results_full_gen200_period10_20260206_062935/eval_agent_memory/auxiliary_metrics.py\", line 164\n dist = np.sqrt(np.sum((centers[i] - centers[j]) ** 2))\nIndentationError: unexpected indent\n"
24
+ },
25
+ "auxiliary_descriptions": {
26
+ "avg_radius": "The average radius of all 26 circles. This helps understand the typical size of circles in the solution.",
27
+ "std_dev_radius": "Monitoring `std_dev_radius` can reveal if the evolution is exploring solutions with diverse circle sizes (e.g., one large circle and many tiny ones) or more uniform sizes. A sudden change in this metric might indicate a new packing strategy being explored or a local optimum being escaped.",
28
+ "std_dev_radius_normalized": "Standard deviation of radii divided by the average radius. Provides a relative measure of diversity, useful for comparing solutions with different overall scales.",
29
+ "min_dist_to_boundary_avg": "The average of the minimum distances from each circle's edge to the closest of the four unit square boundaries. Lower values indicate that circles are generally placed closer to the edges, suggesting better utilization of the square's perimeter.",
30
+ "packing_efficiency_area_ratio": "Ratio of the total area covered by circles (sum of \u03c0r\u00b2) to the area of the unit square (which is 1.0). This metric directly quantifies how much of the available space is filled by the circles. Higher values indicate better utilization of space.",
31
+ "median_radius": "Median radius. Less sensitive to outliers than average.",
32
+ "min_radius": "Smallest radius found. Can indicate presence of very small \\'filler\\' circles.",
33
+ "max_radius": "Largest radius found.",
34
+ "avg_min_dist_to_boundary": "The average of the minimum distances from the edge of each circle to the closest boundary of the unit square. A value close to zero (but positive) suggests that circles are generally packed efficiently against the container edges.",
35
+ "min_overall_dist_to_boundary": "The smallest distance from the edge of any circle to any of the four boundaries of the unit square. A value close to zero (but positive) indicates that circles are effectively utilizing the space near the boundaries, which is crucial for optimal packing. A larger value might suggest inefficient use of the boundary regions.",
36
+ "min_inter_circle_gap_or_overlap": "The smallest gap or largest overlap between any two circles. A negative value indicates an overlap, which is a violation of the primary constraint. A positive value indicates a minimum gap between circles. This helps to identify how tightly packed the circles are without violating the non-overlap rule.",
37
+ "avg_inter_circle_gap_or_overlap": "The average gap or overlap between all unique pairs of circles. This metric provides a general sense of how \"loose\" or \"tight\" the overall packing is.",
38
+ "num_degenerate_circles": "The count of circles with a radius smaller than a predefined threshold (currently 1e-5). A high number of degenerate circles might indicate that the algorithm is struggling to find valid placements for some circles and is effectively \"removing\" them by making their radii minuscule.",
39
+ "total_circle_area_ratio": "Sum of all circle areas (sum of pi * r^2) divided by the unit square area (which is 1.0). This metric directly quantifies the density of the packing in terms of area covered. A higher value indicates better space utilization, complementing the primary metric (sum of radii) by considering the actual area occupied.",
40
+ "overall_min_dist_to_boundary": "The absolute minimum distance from any circle's edge to any boundary. This metric helps confirm that circles are not violating the boundary constraints, and if it's very close to zero, it means at least one circle is tightly packed against an edge.",
41
+ "total_packed_area": "The absolute sum of the areas of all circles. This is directly proportional to `packing_efficiency_area_ratio` since the unit square's area is 1.",
42
+ "local_packing_density_std_dev": "Standard deviation of packing densities calculated across a 5x5 grid dividing the unit square. Lower values indicate a more uniform distribution of circles throughout the packing space, suggesting an even spread. Higher values suggest clustering or significant empty regions.",
43
+ "avg_dist_from_square_center": "Average Euclidean distance of each circle\\'s center from the center of the unit square (0.5, 0.5). Lower values imply circles are more concentrated towards the center.",
44
+ "std_dev_dist_from_square_center": "Standard deviation of distances of circle centers from the unit square center. Indicates how spread out the circles are around the center.",
45
+ "total_packed_area_ratio": "The sum of the areas of all circles (pi * r^2) divided by the area of the unit square (1). This provides a direct measure of the total area covered by the circles. Higher values indicate more efficient packing in terms of physical space occupied.",
46
+ "radii_std_dev": "Standard deviation of the radii of the 26 circles. Measures the diversity of circle sizes. A higher value indicates more varied circle sizes (useful for filling gaps), while a lower value suggests more uniform sizes (potentially for a more regular packing).",
47
+ "radii_coefficient_of_variation": "Coefficient of variation (standard deviation / mean) of the radii. This normalizes the standard deviation, allowing for comparison of relative variability across different scales of radii, which can be useful if the overall radii scale changes significantly.",
48
+ "sum_of_radii_from_aux": "The sum of all radii, calculated independently in auxiliary metrics. This is included for comparison and to ensure consistency with the primary metric's core value.",
49
+ "avg_min_boundary_distance": "The average of the minimum distances from each circle's edge to the closest boundary of the unit square. A lower value for this metric suggests that circles are generally pushed closer to the edges of the packing region, indicating a 'tighter' or more compact arrangement against the container walls.",
50
+ "min_overall_boundary_distance": "The absolute minimum distance from any circle's edge to any boundary of the unit square. This can highlight if any single circle is extremely close to an edge.",
51
+ "center_of_mass_x": "The average x-coordinate of all circle centers. Indicates the horizontal center of the packing arrangement. Values close to 0.5 suggest a balanced horizontal distribution.",
52
+ "center_of_mass_y": "The average y-coordinate of all circle centers. Indicates the vertical center of the packing arrangement. Values close to 0.5 suggest a balanced vertical distribution.",
53
+ "center_x_variance": "The variance of the x-coordinates of the circle centers. Higher variance suggests a wider horizontal spread of circles.",
54
+ "center_y_variance": "The variance of the y-coordinates of the circle centers. Higher variance suggests a wider vertical spread of circles.",
55
+ "area_coverage_ratio": "This metric will show if the evolution is effectively translating increased sum of radii into increased packed area. A high sum of radii with a disproportionately lower area coverage might hint at issues with circle placement or a preference for many small circles rather than fewer large ones that fill space well.",
56
+ "violation_overlap_magnitude_sum": "Sum of the magnitudes of overlap for all pairs of overlapping circles. A value of 0 indicates no overlaps. Lower values are better. This metric quantifies *how much* overlap exists in the current solution, providing a more granular insight than just a boolean \"overlap detected\".",
57
+ "violation_out_of_bounds_magnitude_sum": "Sum of the distances by which circles extend beyond the [0,1]x[0,1] unit square boundaries. A value of 0 indicates all circles are within bounds. Lower values are better. This quantifies *how much* circles are out of bounds, indicating the severity of boundary violations.",
58
+ "violation_radii_negative_count": "The number of circles that have a non-positive (zero or negative) radius. Such circles are invalid. A value of 0 is ideal. This highlights a fundamental issue in circle generation.",
59
+ "valid_circles_count": "The number of circles that are *individually* within the unit square, have positive radii, and do not overlap with any other such individually valid circles. This acts as a \"partial success\" count, indicating how many circles are placed perfectly. Higher values are better.",
60
+ "valid_circles_total_area": "The sum of the areas of the `valid_circles` (those counted in `valid_circles_count`). This reflects the total area covered by properly placed, non-overlapping circles. Higher values indicate more effective partial packing.",
61
+ "valid_circles_density": "The `valid_circles_total_area` divided by the area of the unit square (1.0). Represents the packing density achieved by only the valid circles. Higher values are better.",
62
+ "valid_circles_avg_radius": "The average radius of the `valid_circles`. Indicates the typical size of successfully placed circles. Useful for understanding if the solution focuses on many small valid circles or fewer large ones.",
63
+ "valid_circles_std_radius": "The standard deviation of the radii of the `valid_circles`. Lower values suggest a more uniform size among valid circles, higher values suggest more diversity in radii among valid circles.",
64
+ "avg_min_dist_center_to_boundary": "The average of the minimum distances from each circle\\'s center to any of the four unit square boundaries. Smaller values suggest that circles are placed closer to the edges on average, indicating better utilization of the boundary regions.",
65
+ "num_boundary_touching_circles": "The count of circles whose circumference is within a small epsilon (1e-4) distance of any of the unit square boundaries. This metric directly quantifies how many circles are \"hugging\" the edges, a common characteristic of efficient packing solutions.",
66
+ "packing_density": "The total area covered by circles as a proportion of the unit square's area (which is 1). This is a direct measure of how much of the square is filled. For a unit square, this value is identical to `total_circle_area`.",
67
+ "total_circle_area": "Sum of the areas of all circles ($\\pi \\\\sum r_i^2$). Higher values are generally better but might not capture overlap if validation fails.",
68
+ "radii_mean": "The average radius across all 26 circles. Provides insight into the typical size of circles being packed.",
69
+ "radii_median": "Median radius among the 26 circles.",
70
+ "radii_min": "Minimum radius among the 26 circles.",
71
+ "radii_max": "Maximum radius among the 26 circles.",
72
+ "avg_distance_to_square_center": "The average Euclidean distance of each circle's center from the center of the unit square (0.5, 0.5). Lower values suggest a more centralized and compact packing, which can be an indicator of a well-balanced solution.",
73
+ "num_boundary_contacts": "The count of circles whose edges are within a small epsilon distance (1e-4) of any of the four boundaries of the unit square. A higher number indicates that more circles are interacting with the container's edges, which is often a characteristic of tightly packed arrangements and can help prevent circles from floating freely in the interior.",
74
+ "avg_min_distance_to_boundary": "The average of the minimum distances from each circle's edge to its closest boundary. Smaller values mean circles are generally closer to the boundaries.",
75
+ "min_overall_distance_to_boundary": "The absolute minimum distance from any circle's edge to any boundary. A value near zero indicates at least one circle is very close to or touching a boundary.",
76
+ "min_dist_to_overlap": "The minimum positive distance between the edges of any two non-overlapping circles. A smaller positive value indicates circles are very close to overlapping. If overlaps occur, this metric is 0.0.",
77
+ "max_overlap_magnitude": "The maximum magnitude of overlap found. A positive value indicates the largest overlap, 0 if no overlaps. This is a critical metric for validity.",
78
+ "convex_hull_area": "The area of the convex hull formed by the centers of all packed circles. Measures how widely dispersed the centers are.",
79
+ "convex_hull_area_ratio": "The ratio of the `convex_hull_area` to the area of the unit square (1.0). A higher ratio (closer to 1.0) indicates that the circle centers are spread out more broadly across the unit square, suggesting better overall utilization of the available space, not just by the circles themselves but by their distribution.",
80
+ "skewness_radii": "Measures the asymmetry of the radii distribution. Positive skew indicates more small radii, negative skew more large radii. Can reveal if solutions favor many small circles or few large ones.",
81
+ "kurtosis_radii": "Measures the \\\"tailedness\\\" of the radii distribution. Higher kurtosis indicates more extreme radii (very small or very large) compared to a normal distribution, suggesting a specialized packing strategy.",
82
+ "std_dev_centroid_x": "Standard deviation of the x-coordinates of the circle centers. Indicates how spread out the circles are horizontally. Lower values mean circles are more vertically aligned or clustered.",
83
+ "std_dev_centroid_y": "Standard deviation of the y-coordinates of the circle centers. Indicates how spread out the circles are vertically. Lower values mean circles are more horizontally aligned or clustered.",
84
+ "avg_distance_from_center_of_mass": "Average Euclidean distance of each circle's centroid from the overall center of mass of all 26 circles. Lower values indicate a more compact internal arrangement of the packing, centered around its own mass.",
85
+ "num_circles_in_corners": "Count of circles whose centroid is within a corner region (e.g., x or y < 0.1 or > 0.9). This quantifies how many circles are actively placed in the four corners, which are often key areas for efficient packing.",
86
+ "actual_num_circles_attempted": "The number of circles found in the solution. Should ideally be 26.",
87
+ "expected_num_circles": "The target number of circles (26 for this problem).",
88
+ "is_num_circles_count_correct": "Boolean indicating if `actual_num_circles_attempted` matches `expected_num_circles`. Useful for early stage debugging.",
89
+ "num_radii_positive": "Count of circles with positive radii. Should ideally be equal to `actual_num_circles_attempted`.",
90
+ "num_radii_zero": "Count of circles with zero radius. Indicates \\'missing\\' circles or degenerate solutions.",
91
+ "num_radii_negative": "Count of circles with negative radius. Indicates an invalid solution state.",
92
+ "has_negative_radii": "Boolean flag for existence of any negative radii.",
93
+ "has_zero_radii": "Boolean flag for existence of any zero radii.",
94
+ "avg_contact_count": "Average number of contacts per circle. High values can indicate dense packing.",
95
+ "max_contact_count": "Maximum number of contacts for any single circle. Useful for identifying highly constrained circles.",
96
+ "min_gap_between_non_touching_circles": "The smallest positive gap found between any two circles that are *not* considered touching. A smaller value indicates tighter packing in general, even for non-touching pairs. Zero if all circles are touching or overlapping.",
97
+ "min_pairwise_separation_avg": "Average of `(distance between centers - sum of radii)` for all pairs. Should be >= 0 for valid solutions. Averages the \\'tightness\\' or \\'looseness\\' of packing.",
98
+ "min_pairwise_separation_min": "Minimum of `(distance between centers - sum of radii)` for all pairs. The smallest gap or difference from touching. Closer to 0 indicates tighter packing. Negative values imply overlap.",
99
+ "total_area_covered": "The sum of the areas of all circles (\u03c0r\u00b2). This metric directly measures the total space utilized by the circles within the unit square. A higher value indicates better packing density and efficiency in utilizing the available area.",
100
+ "min_gap_between_circles": "This metric calculates the smallest positive distance between the edges of any two distinct circles. The primary evaluator only checks for *overlap* (i.e., `gap < 0`). This auxiliary metric provides a more nuanced view of how \"tight\" the packing is without violating the non-overlap constraint. A smaller positive `min_gap` suggests a denser packing configuration, pushing circles closer together towards a theoretical optimum. This can help guide the optimizer to find solutions where circles are just touching or nearly touching.",
101
+ "min_boundary_distance": "The smallest minimum distance found across all circles, indicating how close at least one circle's edge is to a boundary. A value close to zero suggests a circle is touching a boundary.",
102
+ "avg_min_boundary_dist": "Average minimum distance from each circle's edge to the closest unit square boundary. Negative values indicate circles are outside the boundary; positive values indicate distance from the boundary. Lower positive values suggest tighter packing against the edges.",
103
+ "max_boundary_excursion": "The maximum magnitude by which any circle extends outside the [0,1] unit square. Should be 0 for valid solutions; a non-zero value indicates a violation.",
104
+ "num_overlaps": "Count of pairs of circles that overlap. Crucial for validity assessment.",
105
+ "overall_min_boundary_dist": "The absolute minimum signed distance any circle's edge is from any boundary. This is the smallest gap or largest excursion.",
106
+ "num_unique_radii": "The count of unique radius values present in the solution. This can indicate if the solution uses a few distinct circle sizes (e.g., from a predefined set) or a continuous distribution.",
107
+ "num_circles_touching_boundary": "Similar to `boundary_contacts_strict_count`, counts circles with edges very close to boundaries.",
108
+ "bounding_box_area_ratio": "Ratio of the area of the minimum bounding box encompassing all circles (including their full extent) to the unit square area (1.0). Lower values indicate a more compact arrangement of the circle *extents*, not necessarily their internal arrangement.",
109
+ "center_of_mass_distance_to_square_center": "Euclidean distance between the packing\\'s center of mass (average of all circle centers) and the unit square\\'s center (0.5, 0.5). Lower values indicate a more centrally balanced packing overall.",
110
+ "packing_density_relative_to_unit_square": "Ratio of `total_circle_area` to the unit square area (1.0). Provides a theoretical density, without accounting for overlaps.",
111
+ "avg_min_edge_dist_to_nn": "Average of the minimum edge distances to the nearest neighbor for each circle. A value close to 0 (but non-negative) indicates tight packing without overlap. Positive values suggest gaps, negative values suggest overlap.",
112
+ "boundary_contacts_strict_count": "Number of circles whose edge is strictly (within `1e-6` tolerance) touching any of the unit square boundaries. Indicates effective use of boundaries.",
113
+ "boundary_contacts_loose_count": "Number of circles whose edge is loosely (within `0.01` tolerance) touching any of the unit square boundaries. A broader measure of boundary utilization.",
114
+ "avg_min_dist_to_wall": "Average of the minimum distance from each circle\\'s edge to its nearest unit square wall. Lower values indicate circles are generally closer to the boundaries.",
115
+ "num_contacting_pairs": "Count of pairs of circles that are touching (distance between centers equals sum of radii within tolerance).",
116
+ "avg_boundary_distance": "Average minimum distance from each circle's edge to the closest boundary of the unit square. Smaller values indicate better utilization of the boundaries, which is often characteristic of optimal packings.",
117
+ "max_boundary_distance": "The largest minimum distance found across all circles, indicating the circle whose edge is furthest from any boundary. A large value here might suggest inefficient use of space."
118
+ },
119
+ "timestamp": 1770380987.2572758,
120
+ "generation": 195
121
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/best/rewrite.txt ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVOLVE-BLOCK-START
2
+ import numpy as np
3
+ from scipy.optimize import minimize
4
+
5
+ class EliteOptimizer:
6
+ """
7
+ Manages the entire optimization process, including an elite pool for feedback,
8
+ diverse seeding, and staged NLP runs.
9
+ """
10
+ def __init__(self, n_circles, config):
11
+ self.n = n_circles
12
+ self.config = config
13
+
14
+ # --- Elite Pool (Hall of Fame) ---
15
+ self.elite_pool = [] # Stores (score, x_vector) tuples
16
+ self.elite_pool_capacity = config['elite_pool_capacity']
17
+ self.uniqueness_threshold = config['uniqueness_threshold']
18
+
19
+ # --- Problem Definition ---
20
+ self.bounds = self._define_bounds()
21
+ self.constraints = self._define_constraints()
22
+ self.initial_strategies = self._get_initial_strategies()
23
+
24
+ # --- Elite Pool Management ---
25
+ def add_to_elite_pool(self, x):
26
+ score = -self.objective_radii(x)
27
+
28
+ # Check for uniqueness against existing elites to avoid redundancy
29
+ new_centers, _ = self.unpack_vars(x)
30
+ # Sort centers to make comparison invariant to circle indexing
31
+ new_centers_sorted = new_centers[np.lexsort((new_centers[:, 1], new_centers[:, 0]))]
32
+
33
+ for _, elite_x in self.elite_pool:
34
+ elite_centers, _ = self.unpack_vars(elite_x)
35
+ elite_centers_sorted = elite_centers[np.lexsort((elite_centers[:, 1], elite_centers[:, 0]))]
36
+ if np.linalg.norm(new_centers_sorted - elite_centers_sorted) < self.uniqueness_threshold:
37
+ return False # Not unique enough
38
+
39
+ # If the pool has space or the new score is better than the worst elite, add it
40
+ if len(self.elite_pool) < self.elite_pool_capacity or score > self.elite_pool[-1][0]:
41
+ self.elite_pool.append((score, x))
42
+ self.elite_pool.sort(key=lambda item: item[0], reverse=True) # Keep sorted by score
43
+ if len(self.elite_pool) > self.elite_pool_capacity:
44
+ self.elite_pool.pop() # Maintain capacity
45
+ return True
46
+ return False
47
+
48
+ # --- Problem Formulation (Objectives, Constraints, Bounds) ---
49
+ def pack_vars(self, centers, radii):
50
+ x = np.zeros(self.n * 3)
51
+ x[0::3], x[1::3], x[2::3] = centers[:, 0], centers[:, 1], radii
52
+ return x
53
+
54
+ def unpack_vars(self, x):
55
+ centers = np.vstack((x[0::3], x[1::3])).T
56
+ radii = x[2::3]
57
+ return centers, radii
58
+
59
+ def objective_area(self, x):
60
+ _, radii = self.unpack_vars(x)
61
+ return -np.sum(radii**2)
62
+
63
+ def objective_radii(self, x):
64
+ _, radii = self.unpack_vars(x)
65
+ return -np.sum(radii)
66
+
67
+ def _define_bounds(self):
68
+ return [(0.0, 1.0), (0.0, 1.0), (1e-9, 0.5)] * self.n
69
+
70
+ def _define_constraints(self):
71
+ cons = []
72
+ def non_overlap_constraint(x):
73
+ centers, radii = self.unpack_vars(x)
74
+ i, j = np.triu_indices(self.n, k=1)
75
+ dist_sq = np.sum((centers[i] - centers[j])**2, axis=1)
76
+ sum_radii_sq = (radii[i] + radii[j])**2
77
+ return dist_sq - sum_radii_sq
78
+ cons.append({'type': 'ineq', 'fun': non_overlap_constraint})
79
+
80
+ def boundary_constraint(x):
81
+ centers, radii = self.unpack_vars(x)
82
+ return np.concatenate([
83
+ centers[:, 0] - radii, 1 - centers[:, 0] - radii,
84
+ centers[:, 1] - radii, 1 - centers[:, 1] - radii
85
+ ])
86
+ cons.append({'type': 'ineq', 'fun': boundary_constraint})
87
+ return cons
88
+
89
+ # --- Initial State Generation ---
90
+ def _get_initial_strategies(self):
91
+ # Grid
92
+ grid_centers = np.zeros((self.n, 2))
93
+ idx = 0; grid_points = np.linspace(0.1, 0.9, 5)
94
+ for i in range(5):
95
+ for j in range(5):
96
+ if i == 2 and j == 2: continue
97
+ grid_centers[idx] = [grid_points[i], grid_points[j]]; idx += 1
98
+ grid_centers[24], grid_centers[25] = [0.5, 0.45], [0.5, 0.55]
99
+
100
+ # Best Known
101
+ best_known_centers = np.array([
102
+ [0.1136, 0.1136], [0.0708, 0.2931], [0.1297, 0.4848], [0.1088, 0.7224],
103
+ [0.0851, 0.9149], [0.3299, 0.1029], [0.2408, 0.2845], [0.3534, 0.4458],
104
+ [0.3031, 0.6392], [0.2949, 0.8708], [0.5335, 0.1008], [0.4355, 0.2711],
105
+ [0.4488, 0.7384], [0.5252, 0.8974], [0.7351, 0.1008], [0.6343, 0.2781],
106
+ [0.7103, 0.4961], [0.6275, 0.7152], [0.7305, 0.8973], [0.9175, 0.0825],
107
+ [0.8686, 0.2908], [0.9190, 0.4972], [0.8669, 0.7048], [0.9161, 0.9161],
108
+ [0.5234, 0.4175], [0.4860, 0.5786]
109
+ ])
110
+
111
+ # Hexagonal
112
+ centers_hex = []; rows = [5, 6, 5, 6, 4]; y, r = 0.05, 0.1
113
+ for i, count in enumerate(rows):
114
+ offset = r if i % 2 != 0 else 0.05
115
+ for j in range(count):
116
+ if len(centers_hex) < self.n: centers_hex.append([offset + j * 2 * r, y])
117
+ y += r * np.sqrt(3)
118
+ centers_hex = np.array(centers_hex)
119
+ if centers_hex.size > 0:
120
+ centers_hex /= np.max(centers_hex, axis=0) * 1.05
121
+ centers_hex += (1 - np.max(centers_hex, axis=0)) / 2
122
+
123
+ return [
124
+ grid_centers,
125
+ best_known_centers,
126
+ best_known_centers[:, [1, 0]], # Reflection across y=x
127
+ 1.0 - best_known_centers, # Inversion through center
128
+ centers_hex
129
+ ]
130
+
131
+ def _compute_initial_radii(self, centers):
132
+ radii = np.zeros(self.n)
133
+ MIN_GAP = self.config['initial_radii_min_gap']
134
+ for i in range(self.n):
135
+ radii[i] = min(centers[i,0], 1-centers[i,0], centers[i,1], 1-centers[i,1])
136
+
137
+ for _ in range(self.config['initial_radii_max_iter']):
138
+ changed = False
139
+ for i in range(self.n):
140
+ for j in range(i + 1, self.n):
141
+ dist = np.linalg.norm(centers[i] - centers[j])
142
+ if radii[i] + radii[j] > dist - MIN_GAP:
143
+ target_sum = max(0.0, dist - MIN_GAP)
144
+ if radii[i] + radii[j] > 1e-12:
145
+ scale = target_sum / (radii[i] + radii[j])
146
+ radii[i] *= scale; radii[j] *= scale
147
+ changed = True
148
+ if not changed: break
149
+ return radii
150
+
151
+ def _prepare_initial_state(self, base_centers, perturb_std):
152
+ """Perturb, repel, and then compute initial radii for a robust start."""
153
+ # 1. Perturb
154
+ perturbed = np.clip(base_centers + np.random.normal(0, perturb_std, base_centers.shape), 0, 1)
155
+
156
+ # 2. Repel (Lightweight force-directed pre-processing)
157
+ cfg_repel = self.config['repulsion']
158
+ c = perturbed.copy()
159
+ for _ in range(cfg_repel['iterations']):
160
+ forces = np.zeros_like(c)
161
+ # Boundary repulsion
162
+ forces[:, 0] += cfg_repel['boundary_strength'] * np.exp(-c[:, 0] / 0.1)
163
+ forces[:, 0] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 0]) / 0.1)
164
+ forces[:, 1] += cfg_repel['boundary_strength'] * np.exp(-c[:, 1] / 0.1)
165
+ forces[:, 1] -= cfg_repel['boundary_strength'] * np.exp(-(1 - c[:, 1]) / 0.1)
166
+
167
+ # Inter-circle repulsion
168
+ i, j = np.triu_indices(self.n, k=1)
169
+ diffs = c[i] - c[j]
170
+ dist_sq = np.sum(diffs**2, axis=1)
171
+
172
+ # Repel only circles that are "close" to each other
173
+ close_indices = np.where(dist_sq < cfg_repel['repel_radius_sq'])[0]
174
+ for k in close_indices:
175
+ force_mag = cfg_repel['strength'] / (dist_sq[k] + 1e-9)
176
+ force_vec = diffs[k] * force_mag
177
+ forces[i[k]] += force_vec
178
+ forces[j[k]] -= force_vec
179
+
180
+ c += forces * cfg_repel['dt']
181
+ c = np.clip(c, 0, 1)
182
+
183
+ # 3. Compute Radii
184
+ initial_radii = self._compute_initial_radii(c)
185
+ return self.pack_vars(c, initial_radii)
186
+
187
+ # --- Main Optimization Loop ---
188
+ def run(self):
189
+ best_x = None
190
+ best_score = -np.inf
191
+
192
+ cfg_opts = self.config['optimizer_options']
193
+ num_runs = self.config['num_optimization_runs']
194
+ max_perturb = self.config['max_perturb_std']
195
+ min_perturb = self.config['min_perturb_std']
196
+ elite_seeding_prob = self.config['elite_seeding_prob']
197
+
198
+ for run_idx in range(num_runs):
199
+ perturb_std = max_perturb - (run_idx / (num_runs - 1)) * (max_perturb - min_perturb) if num_runs > 1 else min_perturb
200
+
201
+ # Probabilistic choice between static and elite pools for seeding
202
+ if self.elite_pool and np.random.rand() < elite_seeding_prob:
203
+ _, elite_x = self.elite_pool[np.random.randint(len(self.elite_pool))]
204
+ base_centers, _ = self.unpack_vars(elite_x)
205
+ else:
206
+ base_centers = self.initial_strategies[run_idx % len(self.initial_strategies)]
207
+
208
+ x0 = self._prepare_initial_state(base_centers, perturb_std)
209
+
210
+ # Staged Optimization
211
+ res1 = minimize(self.objective_area, x0, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage1'])
212
+ x1 = res1.x if res1.success else x0
213
+
214
+ res2 = minimize(self.objective_radii, x1, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
215
+ x2 = res2.x if res2.success else x1
216
+
217
+ res3 = minimize(self.objective_radii, x2, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage3'])
218
+ x_final = res3.x if res3.success else x2
219
+
220
+ if -self.objective_radii(x_final) > best_score:
221
+ best_score = -self.objective_radii(x_final)
222
+ best_x = x_final
223
+ self.add_to_elite_pool(x_final)
224
+
225
+ # Final Polishing Stage
226
+ if best_x is not None:
227
+ res_polish = minimize(self.objective_radii, best_x, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['polish'])
228
+ if res_polish.success and -res_polish.fun > best_score:
229
+ best_x = res_polish.x
230
+
231
+ # Fallback if no solution was found
232
+ if best_x is None:
233
+ x0_fallback = self._prepare_initial_state(self.initial_strategies[0], 0)
234
+ res_fallback = minimize(self.objective_radii, x0_fallback, method='SLSQP', bounds=self.bounds, constraints=self.constraints, options=cfg_opts['stage2'])
235
+ best_x = res_fallback.x
236
+
237
+ return self.unpack_vars(best_x)
238
+
239
+
240
+ def construct_packing():
241
+ """
242
+ Sets up and runs the Elite Propagating Basin Search optimizer.
243
+ This architecture integrates a dynamic Hall of Fame (elite pool) with a
244
+ diverse set of initial strategies and a robust pre-processing step to
245
+ systematically explore and exploit the solution space.
246
+ """
247
+ config = {
248
+ # Search process
249
+ 'num_optimization_runs': 60,
250
+ 'max_perturb_std': 0.04,
251
+ 'min_perturb_std': 0.001,
252
+ 'elite_seeding_prob': 0.75,
253
+
254
+ # Elite Pool
255
+ 'elite_pool_capacity': 8,
256
+ 'uniqueness_threshold': 0.01,
257
+
258
+ # Initial state preparation
259
+ 'initial_radii_min_gap': 1e-8,
260
+ 'initial_radii_max_iter': 200,
261
+ 'repulsion': {
262
+ 'iterations': 20,
263
+ 'strength': 0.0005,
264
+ 'dt': 0.1,
265
+ 'repel_radius_sq': 0.2**2,
266
+ 'boundary_strength': 0.005,
267
+ },
268
+
269
+ # SLSQP optimizer options
270
+ 'optimizer_options': {
271
+ 'stage1': {'maxiter': 1200, 'ftol': 1e-9, 'gtol': 1e-6, 'disp': False},
272
+ 'stage2': {'maxiter': 3000, 'ftol': 1e-11, 'gtol': 1e-8, 'disp': False},
273
+ 'stage3': {'maxiter': 6000, 'ftol': 1e-13, 'gtol': 1e-10, 'disp': False},
274
+ 'polish': {'maxiter': 15000,'ftol': 1e-15, 'gtol': 1e-12, 'disp': False},
275
+ }
276
+ }
277
+
278
+ optimizer = EliteOptimizer(n_circles=26, config=config)
279
+ final_centers, final_radii = optimizer.run()
280
+
281
+ return final_centers, np.maximum(final_radii, 0)
282
+ # EVOLVE-BLOCK-END
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/eval_agent_memory/__pycache__/auxiliary_metrics.cpython-313.pyc ADDED
Binary file (6.11 kB). View file
 
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/__pycache__/main.cpython-313.pyc ADDED
Binary file (3.14 kB). View file
 
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/correct.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "correct": true,
3
+ "error": null
4
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/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_full_gen200_period10_20260206_062935/gen_0/results/job_log.out ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Evaluating program: examples/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/main.py
2
+ Saving results to: examples/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results
3
+ Run 1/1 completed in 0.00 seconds
4
+ Detailed packing data saved to examples/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/extra.npz
5
+ Correctness and error status saved to examples/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_0/results/correct.json
6
+ Metrics saved to examples/circle_packing/results/results_full_gen200_period10_20260206_062935/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.0020979009568691254
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_full_gen200_period10_20260206_062935/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.0020979009568691254,
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_full_gen200_period10_20260206_062935/gen_1/__pycache__/main.cpython-313.pyc ADDED
Binary file (3.24 kB). View file
 
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_1/results/correct.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "correct": true,
3
+ "error": null
4
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_1/results/metrics.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "combined_score": 1.853356327835797,
3
+ "correct": true,
4
+ "primary": {
5
+ "combined_score": 1.853356327835797,
6
+ "public": {
7
+ "centers_str": " centers[0] = (0.1000, 0.1000)\n centers[1] = (0.3000, 0.1000)\n centers[2] = (0.5000, 0.1000)\n centers[3] = (0.7000, 0.1000)\n centers[4] = (0.9000, 0.1000)\n centers[5] = (0.1000, 0.3000)\n centers[6] = (0.3000, 0.3000)\n centers[7] = (0.5000, 0.3000)\n centers[8] = (0.7000, 0.3000)\n centers[9] = (0.9000, 0.3000)\n centers[10] = (0.0833, 0.5000)\n centers[11] = (0.2500, 0.5000)\n centers[12] = (0.4167, 0.5000)\n centers[13] = (0.5833, 0.5000)\n centers[14] = (0.7500, 0.5000)\n centers[15] = (0.9167, 0.5000)\n centers[16] = (0.1000, 0.7000)\n centers[17] = (0.3000, 0.7000)\n centers[18] = (0.5000, 0.7000)\n centers[19] = (0.7000, 0.7000)\n centers[20] = (0.9000, 0.7000)\n centers[21] = (0.1000, 0.9000)\n centers[22] = (0.3000, 0.9000)\n centers[23] = (0.5000, 0.9000)\n centers[24] = (0.7000, 0.9000)\n centers[25] = (0.9000, 0.9000)",
8
+ "num_circles": 26
9
+ },
10
+ "private": {
11
+ "reported_sum_of_radii": 1.853356327835797
12
+ },
13
+ "execution_time_mean": 0.0023046964779496193,
14
+ "execution_time_std": 0.0,
15
+ "num_valid_runs": 1,
16
+ "num_invalid_runs": 0,
17
+ "all_validation_errors": [],
18
+ "correct": true,
19
+ "validation_error": null
20
+ },
21
+ "auxiliary": {},
22
+ "auxiliary_descriptions": {},
23
+ "timestamp": 1770359475.5668924,
24
+ "generation": 1
25
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/__pycache__/main.cpython-313.pyc ADDED
Binary file (7.03 kB). View file
 
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/main.py ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVOLVE-BLOCK-START
2
+ import numpy as np
3
+
4
+ def compute_max_radii(centers, max_iter=100):
5
+ """
6
+ Compute the maximum possible radii for each circle position iteratively
7
+ such that they don't overlap and stay within the unit square.
8
+ This is a more robust method than the original's proportional scaling.
9
+
10
+ Args:
11
+ centers: np.array of shape (n, 2) with (x, y) coordinates.
12
+ max_iter: The maximum number of relaxation iterations.
13
+
14
+ Returns:
15
+ np.array of shape (n) with the radius of each circle.
16
+ """
17
+ n = centers.shape[0]
18
+ if n == 0:
19
+ return np.array([])
20
+
21
+ # Initial radii are limited by the distance to the walls
22
+ radii = np.min(np.hstack([centers, 1 - centers]), axis=1)
23
+
24
+ if n <= 1:
25
+ return radii
26
+
27
+ # Pre-compute pairwise distances for efficiency
28
+ # dist_matrix[i, j] will be the distance between center i and center j
29
+ dist_matrix = np.sqrt(np.sum((centers[:, np.newaxis, :] - centers[np.newaxis, :, :])**2, axis=-1))
30
+
31
+ # Iteratively shrink radii until no conflicts exist (relaxation method)
32
+ for _ in range(max_iter):
33
+ radii_old = radii.copy()
34
+ updated = False
35
+ for i in range(n):
36
+ # For circle i, its radius is limited by every other circle j:
37
+ # r_i + r_j <= dist_ij => r_i <= dist_ij - r_j
38
+ # We take the minimum of these constraints over all j.
39
+ # np.delete is used to efficiently select all j != i
40
+ other_indices = np.arange(n) != i
41
+ limit_from_others = np.min(dist_matrix[i, other_indices] - radii_old[other_indices])
42
+
43
+ # The new radius is the minimum of its current value and the new limit
44
+ new_radius = min(radii[i], limit_from_others)
45
+
46
+ if new_radius < radii[i]:
47
+ radii[i] = new_radius
48
+ updated = True
49
+
50
+ # If no radii were updated in a full pass, the system is stable
51
+ if not updated:
52
+ break
53
+
54
+ # Ensure no negative radii due to floating point errors or initial overlap
55
+ radii[radii < 0] = 0
56
+ return radii
57
+
58
+
59
+ class CirclePacker:
60
+ """
61
+ Manages the state and optimization of circle centers using a force-directed layout algorithm.
62
+ """
63
+ def __init__(self, n_circles, seed=42):
64
+ self.n = n_circles
65
+ self._rng = np.random.default_rng(seed)
66
+ self.centers = self._initialize_centers()
67
+
68
+ def _initialize_centers(self):
69
+ """
70
+ Initializes centers in a structured pattern: one central circle,
71
+ an inner ring of 8, and an outer ring of 17. This provides a
72
+ much better starting point than random placement for N=26.
73
+ """
74
+ if self.n != 26:
75
+ # Fallback for other counts, though we focus on N=26
76
+ return self._rng.random((self.n, 2))
77
+
78
+ initial_centers = np.zeros((self.n, 2))
79
+ initial_centers[0] = [0.5, 0.5]
80
+
81
+ # Inner ring (8 circles)
82
+ r_inner = 0.25
83
+ for i in range(8):
84
+ angle = 2 * np.pi * i / 8
85
+ initial_centers[i + 1] = [0.5 + r_inner * np.cos(angle), 0.5 + r_inner * np.sin(angle)]
86
+
87
+ # Outer ring (17 circles)
88
+ r_outer = 0.45
89
+ for i in range(17):
90
+ angle = 2 * np.pi * i / 17
91
+ initial_centers[i + 9] = [0.5 + r_outer * np.cos(angle), 0.5 + r_outer * np.sin(angle)]
92
+
93
+ return initial_centers
94
+
95
+ def optimize_placements(self, iterations, learning_rate):
96
+ """
97
+ Refines circle positions using a force-directed algorithm.
98
+ Circles repel each other and are pushed from the walls.
99
+ """
100
+ epsilon = 1e-7 # Small constant to prevent division by zero
101
+
102
+ for _ in range(iterations):
103
+ # Calculate all pairwise differences and distances at once for efficiency
104
+ diff = self.centers[:, np.newaxis, :] - self.centers[np.newaxis, :, :]
105
+ dist_sq = np.sum(diff**2, axis=-1)
106
+ np.fill_diagonal(dist_sq, np.inf) # Avoid self-repulsion
107
+
108
+ # Repulsion force is proportional to 1/dist^2, direction is diff/dist.
109
+ # Total force vector is sum over j of (diff_ij / dist_ij^3)
110
+ inv_dist_cubed = 1 / (dist_sq**1.5 + epsilon)
111
+
112
+ # Sum of repulsion forces from all other circles for each circle
113
+ inter_circle_forces = np.sum(diff * inv_dist_cubed[..., np.newaxis], axis=1)
114
+
115
+ # Wall repulsion forces (1/d^2 law) with increased strength
116
+ wall_force_strength = 2.0
117
+ wall_forces = np.zeros_like(self.centers)
118
+ wall_forces[:, 0] = wall_force_strength * (1 / (self.centers[:, 0]**2 + epsilon) - 1 / ((1 - self.centers[:, 0])**2 + epsilon))
119
+ wall_forces[:, 1] = wall_force_strength * (1 / (self.centers[:, 1]**2 + epsilon) - 1 / ((1 - self.centers[:, 1])**2 + epsilon))
120
+
121
+ # Combine forces and update positions
122
+ total_force = inter_circle_forces + wall_forces
123
+ self.centers += learning_rate * total_force
124
+
125
+ # Clip to keep circles strictly inside the unit square
126
+ self.centers = np.clip(self.centers, epsilon, 1 - epsilon)
127
+
128
+ def get_centers(self):
129
+ return self.centers
130
+
131
+
132
+ def construct_packing():
133
+ """
134
+ Constructs an optimized arrangement of 26 circles in a unit square.
135
+ This function orchestrates the creation and optimization process.
136
+ """
137
+ N_CIRCLES = 26
138
+
139
+ # 1. Instantiate the packer, which sets up initial random positions deterministically.
140
+ packer = CirclePacker(n_circles=N_CIRCLES, seed=42)
141
+
142
+ # 2. Run the optimization process to find a good spatial arrangement.
143
+ # Parameters are chosen for more aggressive optimization from the structured start.
144
+ packer.optimize_placements(iterations=2000, learning_rate=2e-5)
145
+
146
+ # 3. Get the final, optimized centers from the packer.
147
+ centers = packer.get_centers()
148
+
149
+ # 4. Compute the maximum possible radii for these final center positions.
150
+ radii = compute_max_radii(centers)
151
+
152
+ return centers, radii
153
+ # EVOLVE-BLOCK-END
154
+
155
+
156
+ # This part remains fixed (not evolved)
157
+ def run_packing():
158
+ """Run the circle packing constructor for n=26"""
159
+ centers, radii = construct_packing()
160
+ # Calculate the sum of radii
161
+ sum_radii = np.sum(radii)
162
+ return centers, radii, sum_radii
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/results/correct.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "correct": true,
3
+ "error": null
4
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_10/results/metrics.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "combined_score": 0.0,
3
+ "correct": true,
4
+ "primary": {
5
+ "combined_score": 0.0,
6
+ "public": {
7
+ "centers_str": " centers[0] = (0.5183, 0.5000)\n centers[1] = (0.7101, 0.5000)\n centers[2] = (0.6943, 0.6982)\n centers[3] = (0.4914, 0.7012)\n centers[4] = (0.2979, 0.7058)\n centers[5] = (0.3186, 0.5000)\n centers[6] = (0.2979, 0.2942)\n centers[7] = (0.4914, 0.2988)\n centers[8] = (0.6943, 0.3018)\n centers[9] = (0.8677, 0.5000)\n centers[10] = (0.8635, 0.6847)\n centers[11] = (0.8617, 0.8495)\n centers[12] = (0.7132, 0.8646)\n centers[13] = (0.5391, 0.8636)\n centers[14] = (0.3522, 0.8651)\n centers[15] = (0.1712, 0.8726)\n centers[16] = (0.1314, 0.7440)\n centers[17] = (0.1421, 0.5825)\n centers[18] = (0.1421, 0.4175)\n centers[19] = (0.1314, 0.2560)\n centers[20] = (0.1712, 0.1274)\n centers[21] = (0.3522, 0.1349)\n centers[22] = (0.5391, 0.1364)\n centers[23] = (0.7132, 0.1354)\n centers[24] = (0.8617, 0.1505)\n centers[25] = (0.8635, 0.3153)",
8
+ "num_circles": 26
9
+ },
10
+ "private": {
11
+ "reported_sum_of_radii": 0.0
12
+ },
13
+ "execution_time_mean": 0.24106993060559034,
14
+ "execution_time_std": 0.0,
15
+ "num_valid_runs": 1,
16
+ "num_invalid_runs": 0,
17
+ "all_validation_errors": [],
18
+ "correct": true,
19
+ "validation_error": null
20
+ },
21
+ "auxiliary": {
22
+ "std_dev_radius": 0.0,
23
+ "median_radius": 0.0,
24
+ "min_radius": 0.0,
25
+ "max_radius": 0.0,
26
+ "boundary_util_error": "No valid circles to calculate boundary distance.",
27
+ "inter_circle_gap_error": "No valid pairs to calculate inter-circle distance.",
28
+ "num_degenerate_circles": 26
29
+ },
30
+ "auxiliary_descriptions": {
31
+ "std_dev_radius": "Standard deviation of the radii of all 26 circles. A higher value indicates greater diversity in circle sizes, while a lower value suggests more uniformly sized circles. This can reveal different packing strategies.",
32
+ "median_radius": "The median radius among all circles. Provides a robust measure of the typical circle size, less sensitive to outliers than the mean.",
33
+ "min_radius": "The smallest radius found among all circles. Useful for identifying if solutions are introducing very tiny circles, potentially indicating difficulty in packing or a strategy to fill small gaps.",
34
+ "max_radius": "The largest radius found among all circles. Indicates the maximum size of circles the algorithm is able to place.",
35
+ "avg_min_dist_to_boundary": "The average of the minimum distances from the edge of each circle to the closest boundary of the unit square. A value close to zero (but positive) suggests that circles are generally packed efficiently against the container edges.",
36
+ "min_overall_dist_to_boundary": "The absolute minimum distance from any circle's edge to any boundary of the unit square. A value closer to zero indicates excellent utilization of the container's perimeter.",
37
+ "min_inter_circle_gap_or_overlap": "The smallest gap or largest overlap between any two circles. A negative value indicates an overlap, which is a violation of the primary constraint. A positive value indicates a minimum gap between circles. This helps to identify how tightly packed the circles are without violating the non-overlap rule.",
38
+ "avg_inter_circle_gap_or_overlap": "The average gap or overlap between all unique pairs of circles. This metric provides a general sense of how \"loose\" or \"tight\" the overall packing is.",
39
+ "num_degenerate_circles": "The count of circles with a radius smaller than a predefined threshold (currently 1e-5). A high number of degenerate circles might indicate that the algorithm is struggling to find valid placements for some circles and is effectively \"removing\" them by making their radii minuscule."
40
+ },
41
+ "timestamp": 1770360224.091167,
42
+ "generation": 10
43
+ }
examples_deprecated/circle_packing/results/results_full_gen200_period10_20260206_062935/gen_100/__pycache__/main.cpython-313.pyc ADDED
Binary file (8.22 kB). View file