Skip to content

Commit dcc96c2

Browse files
committed
add note in readme
1 parent b7da4fd commit dcc96c2

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,44 @@ OpenEvolve orchestrates a sophisticated evolutionary pipeline:
9191
- Feature map clustering and archive management
9292
- Comprehensive metadata and lineage tracking
9393

94+
### Island-Based Evolution with Worker Pinning
95+
96+
OpenEvolve implements a sophisticated island-based evolutionary architecture that maintains multiple isolated populations to prevent premature convergence and preserve genetic diversity.
97+
98+
#### How Islands Work
99+
100+
- **Multiple Isolated Populations**: Each island maintains its own population of programs that evolve independently
101+
- **Periodic Migration**: Top-performing programs periodically migrate between adjacent islands (ring topology) to share beneficial mutations
102+
- **True Population Isolation**: Worker processes are deterministically pinned to specific islands to ensure no cross-contamination during parallel evolution
103+
104+
#### Worker-to-Island Pinning
105+
106+
To ensure true island isolation during parallel execution, OpenEvolve implements automatic worker-to-island pinning:
107+
108+
```python
109+
# Workers are distributed across islands using modulo arithmetic
110+
worker_id = 0, 1, 2, 3, 4, 5, ...
111+
island_id = worker_id % num_islands
112+
113+
# Example with 3 islands and 6 workers:
114+
# Worker 0, 3 → Island 0
115+
# Worker 1, 4 → Island 1
116+
# Worker 2, 5 → Island 2
117+
```
118+
119+
**Benefits of Worker Pinning**:
120+
- **Genetic Isolation**: Prevents accidental population mixing between islands during parallel sampling
121+
- **Consistent Evolution**: Each island maintains its distinct evolutionary trajectory
122+
- **Balanced Load**: Workers are evenly distributed across islands automatically
123+
- **Migration Integrity**: Controlled migration happens only at designated intervals, not due to race conditions
124+
125+
**Automatic Distribution**: The system handles all edge cases automatically:
126+
- **More workers than islands**: Multiple workers per island with balanced distribution
127+
- **Fewer workers than islands**: Some islands may not have dedicated workers but still participate in migration
128+
- **Single island**: All workers sample from the same population (degrades to standard evolution)
129+
130+
This architecture ensures that each island develops unique evolutionary pressures and solutions, while periodic migration allows successful innovations to spread across the population without destroying diversity.
131+
94132
## Getting Started
95133

96134
### Installation

tests/test_island_isolation.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,39 @@ def test_migration_preserves_island_structure(self):
252252

253253
# Record island populations before migration
254254
island_sizes_before = [len(island) for island in self.database.islands]
255+
original_program_count = len(self.database.programs)
255256

256257
# Verify we set up the test correctly
257258
self.assertEqual(sum(island_sizes_before), 30)
259+
self.assertEqual(original_program_count, 30)
258260

259261
# Trigger migration
260262
self.database.migrate_programs()
261263

262264
# Check islands still have programs
263265
island_sizes_after = [len(island) for island in self.database.islands]
266+
total_programs_after = len(self.database.programs)
264267

265268
# All islands should still have programs
266269
for size in island_sizes_after:
267270
self.assertGreater(size, 0)
268271

269-
# Total population should be unchanged
270-
self.assertEqual(sum(island_sizes_before), sum(island_sizes_after))
272+
# Migration creates copies, so total population should increase
273+
# With migration_rate=0.1 and 10 programs per island, expect ~1 program per island to migrate
274+
# Each program migrates to 2 adjacent islands, so we expect ~6 new programs
275+
self.assertGreater(total_programs_after, original_program_count)
276+
self.assertGreater(sum(island_sizes_after), sum(island_sizes_before))
277+
278+
# Verify that migrant programs have correct metadata
279+
migrant_count = 0
280+
for program in self.database.programs.values():
281+
if program.metadata.get("migrant", False):
282+
migrant_count += 1
283+
# Migrant should have "_migrant_" in their ID
284+
self.assertIn("_migrant_", program.id)
285+
286+
# Should have some migrant programs
287+
self.assertGreater(migrant_count, 0)
271288

272289

273290
class TestWorkerPinningEdgeCases(unittest.TestCase):

0 commit comments

Comments
 (0)