Repository navigation
fix(database): choose island migrants before moving any - #524
Open
flyingdoubleG wants to merge 1 commit into
Open
flyingdoubleG wants to merge 1 commit into
flyingdoubleG wants to merge 1 commit into
Conversation
migrate_programs picked each island's migrants while it was already moving the previous islands' migrants. Island i's best copies land in island i+1 before i+1 is processed, so i+1's top migration slots went to those fresh copies (which _migrate_one skips, since migrants never migrate again) and the copies could displace i+1's own programs from their cells first. In a 3-island ring with bests 0.9 / 0.5 / 0.3 in distinct cells, only the 0.9 program ever spread; the others never left their island. The existing ring test already noted this as a "known limitation". Plan all moves from the pre-migration population, and do not let migrant copies take migration slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
ProgramDatabase.migrate_programs(default ring migration) picks each island's migrants while it is already moving the previous islands' migrants:i's best programs are copied into islandi+1(andi-1) before islandi+1is processed.i+1is processed, the fresh copies (metadata["migrant"] = True) compete for its topmax(1, int(n * migration_rate))slots._migrate_oneskips migrants, so those slots are wasted.i+1's own programs from their MAP-Elites cells before they get a chance to migrate.The result depends on island order, and good programs on later islands may never leave their island.
test_migration_ring_topologyalready notes this as "a known limitation of the current implementation that processes islands sequentially while modifying them, causing interference between migration rounds."Repro: 3 islands,
migration_rate=0.1, one program per island with scores 0.9 / 0.5 / 0.3 in distinct cells, then onemigrate_programs()call:On
mainonly the top program spreads;bandcnever migrate.Fix
_migrate_onewould skip them anyway.The pluggable
population_strategy.migratepath is unchanged.Tests
New
test_every_island_migrates_its_own_bestcovers the scenario above. It fails onmainand passes with this change.tests/test_island_migration.py,test_migration_no_duplicates.py,test_island_isolation.py,test_database.pyandtest_population_strategy.pyall pass: 66 tests, CPU.🤖 Generated with Claude Code