From ba91919cde6b2eba52feb4643b00f7c310ad6a2d Mon Sep 17 00:00:00 2001 From: Jakob Jordan Date: Tue, 6 Dec 2022 15:59:11 +0100 Subject: [PATCH] Make sure all individuals (parents and offspring) are assigned a valid, unique index --- cgp/ea/mu_plus_lambda.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cgp/ea/mu_plus_lambda.py b/cgp/ea/mu_plus_lambda.py index 913f2ac3..411b5d5d 100644 --- a/cgp/ea/mu_plus_lambda.py +++ b/cgp/ea/mu_plus_lambda.py @@ -142,6 +142,8 @@ def step( # concatenating the parent population to the offspring # population instead of the other way around combined = offsprings + pop.parents + assert all(ind.idx is not None for ind in combined) + assert len(set(ind.idx for ind in combined)) == len(combined) # we follow a two-step process for selection of new parents: # we first determine the fitness for all individuals, then, if