Skip to content

Commit

Permalink
Test parallel processing
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedfgad committed Nov 7, 2023
1 parent c4b1378 commit 0f26588
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pygad/pygad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 0f26588

Please sign in to comment.