Skip to content

Commit 46a7483

Browse files
authored
Merge pull request #354 from lyx1237/fix-issue-351
Fix island population counting per child program
2 parents f596d6d + e2852bb commit 46a7483

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

openevolve/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ class DatabaseConfig:
288288
population_size: int = 1000
289289
archive_size: int = 100
290290
num_islands: int = 5
291-
programs_per_island: Optional[int] = None
292291

293292
# Selection parameters
294293
elite_selection_ratio: float = 0.1

openevolve/process_parallel.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,6 @@ async def run_evolution(
445445
next_iteration = current_iteration
446446
completed_iterations = 0
447447

448-
# Island management
449-
programs_per_island = self.config.database.programs_per_island or max(
450-
1, max_iterations // (self.config.database.num_islands * 10)
451-
)
452-
current_island_counter = 0
453-
454448
# Early stopping tracking
455449
early_stopping_enabled = self.config.early_stopping_patience is not None
456450
if early_stopping_enabled:
@@ -543,16 +537,12 @@ async def run_evolution(
543537
)
544538

545539
# Island management
546-
if (
547-
completed_iteration > start_iteration
548-
and current_island_counter >= programs_per_island
549-
):
550-
self.database.next_island()
551-
current_island_counter = 0
552-
logger.debug(f"Switched to island {self.database.current_island}")
553-
554-
current_island_counter += 1
555-
self.database.increment_island_generation()
540+
# get current program island id
541+
island_id = child_program.metadata.get(
542+
"island", self.database.current_island
543+
)
544+
#use this to increment island generation
545+
self.database.increment_island_generation(island_idx=island_id)
556546

557547
# Check migration
558548
if self.database.should_migrate():

0 commit comments

Comments
 (0)