From 0f2658805ea276b51082ff1b07479b91590e2690 Mon Sep 17 00:00:00 2001 From: Ahmed Gad Date: Tue, 7 Nov 2023 17:10:59 -0500 Subject: [PATCH] Test parallel processing --- pygad/pygad.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pygad/pygad.py b/pygad/pygad.py index 5d175a6..d86a0dd 100644 --- a/pygad/pygad.py +++ b/pygad/pygad.py @@ -1803,9 +1803,13 @@ def cal_pop_fitness(self): solutions_to_submit = [] for sol_idx, sol in enumerate(self.population): # The "undefined" value means that the fitness of this solution must be calculated. - if pop_fitness[sol_idx] == "undefined": - solutions_to_submit.append(sol.copy()) - solutions_to_submit_indices.append(sol_idx) + if type(pop_fitness[sol_idx]) is str: + if pop_fitness[sol_idx] == "undefined": + solutions_to_submit.append(sol.copy()) + solutions_to_submit_indices.append(sol_idx) + elif type(pop_fitness[sol_idx]) in [list, tuple, numpy.ndarray]: + # This is a multi-objective problem. + pass # Check if batch processing is used. If not, then calculate the fitness value for individual solutions. if self.fitness_batch_size in [1, None]: