Skip to content

fix: use _sample_inspirations in sample_from_island for consistent inspiration selection#456

Open
octo-patch wants to merge 1 commit intoalgorithmicsuperintelligence:mainfrom
octo-patch:fix/issue-437-sample-from-island-inspirations
Open

fix: use _sample_inspirations in sample_from_island for consistent inspiration selection#456
octo-patch wants to merge 1 commit intoalgorithmicsuperintelligence:mainfrom
octo-patch:fix/issue-437-sample-from-island-inspirations

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #437

Problem

sample_from_island() selects inspiration programs using plain random.sample() from island program IDs, while sample() delegates to the much richer _sample_inspirations() method. This inconsistency means that the parallel execution path (process_parallel.pysample_from_island) misses:

  • Prioritising the island's best program as an inspiration
  • Including top-ranked programs from the island (elite selection ratio)
  • Selecting programs from nearby MAP-Elites feature cells for diversity

Solution

Replace the ad-hoc random sampling block in sample_from_island() with a call to _sample_inspirations(parent, n=num_inspirations). Because _sample_inspirations derives the target island from parent.metadata["island"] — and the parent was sampled from the correct island — the method automatically scopes sampling to the right island, maintaining the same island isolation guarantee.

Testing

  • All 370 existing unit tests pass (python -m unittest discover tests)
  • The change is a pure behavioural alignment: no interface changes, no new parameters

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: sample_from_island method in PromptDatabase

2 participants