8000 Fix a bug · madprog/GeneticAlgorithmPython@03f509f · GitHub
[go: up one dir, main page]

Skip to content

Commit 03f509f

Browse files
committed
Fix a bug
1 parent 1f067d1 commit 03f509f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pygad/pygad.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,7 @@ def cal_pop_fitness(self):
17081708
# Reaching this block means that batch fitness calculation is used.
17091709

17101710
# Indices of the solutions to calculate their fitness.
1711-
solutions_indices = numpy.where(
1712-
numpy.array(pop_fitness) == "undefined")[0]
1711+
solutions_indices = [idx for idx, fit in enumerate(pop_fitness) if type(fit) is str and fit == "undefined"]
17131712
# Number of batches.
17141713
num_batches = int(numpy.ceil(len(solutions_indices) / self.fitness_batch_size))
17151714
# For each batch, get its indices and call the fitness function.

0 commit comments

Comments
 (0)
0