Fix island-based evolution not distributing programs across islands #392
+342
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #391 where all evolved programs were placed in Island 0 instead of being distributed across configured islands.
Root Cause
When sampling from an empty island,
sample_from_island()falls back to sampling from any available program (typically from Island 0). Children then inherited their parent's island viadatabase.add(), creating a feedback loop where all programs ended up in Island 0.Fix
target_islandfield toSerializableResultsampling_islandfrom the snapshot in the resultProcessParallelControllerpassestarget_islandtodatabase.add()when processing resultsThis ensures children are placed in the intended target island, not the parent's island.
Changes
openevolve/process_parallel.py: Addedtarget_islandto result and pass it todatabase.add()tests/test_island_child_placement.py: Comprehensive tests for island placement behaviorTest Plan
Closes #391
🤖 Generated with Claude Code