File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,21 +447,11 @@ def sample_from_island(
447447 parent = self ._sample_from_island_weighted (island_id )
448448 sampling_mode = "weighted"
449449
450- # Select inspirations from the same island
450+ # Select inspirations from the same island using the same strategy as sample()
451451 if num_inspirations is None :
452452 num_inspirations = 5 # Default for backward compatibility
453453
454- # Get other programs from the island for inspirations
455- other_programs = [pid for pid in island_programs if pid != parent .id ]
456-
457- if len (other_programs ) < num_inspirations :
458- # Not enough programs in island, use what we have
459- inspiration_ids = other_programs
460- else :
461- # Sample inspirations
462- inspiration_ids = random .sample (other_programs , num_inspirations )
463-
464- inspirations = [self .programs [pid ] for pid in inspiration_ids if pid in self .programs ]
454+ inspirations = self ._sample_inspirations (parent , n = num_inspirations )
465455
466456 logger .debug (
467457 f"Sampled parent { parent .id } and { len (inspirations )} inspirations from island { island_id } "
You can’t perform that action at this time.
0 commit comments