diff --git a/pygad/utils/mutation.py b/pygad/utils/mutation.py index 6a9f6a9c..a5648479 100644 --- a/pygad/utils/mutation.py +++ b/pygad/utils/mutation.py @@ -476,6 +476,9 @@ def adaptive_mutation_population_fitness(self, offspring): if self.fitness_batch_size in [1, None]: # Calculate the fitness for each individual solution. for idx in range(first_idx, last_idx): + # We cannot return the index of the solution within the population. + # Because the new solution (offspring) does not yet exist in the population. + # The user should handle this situation if the solution index is used anywhere. fitness[idx] = self.fitness_func(self, temp_population[idx], None) @@ -495,6 +498,9 @@ def adaptive_mutation_population_fitness(self, offspring): batch_last_index = first_idx + (batch_idx + 1) * self.fitness_batch_size # Calculate the fitness values for the batch. + # We cannot return the index/indices of the solution(s) within the population. + # Because the new solution(s) (offspring) do(es) not yet exist in the population. + # The user should handle this situation if the solution index is used anywhere. fitness_temp = self.fitness_func(self, temp_population[batch_first_index:batch_last_index], None)