Skip to content

Commit e767267

Browse files
committed
Comment on reference points
1 parent ef58ef2 commit e767267

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pygad/utils/engine.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,13 @@ def run(self):
533533
elif type(self.last_generation_fitness[0]) in [list, tuple, numpy.ndarray]:
534534
# Multi-objective problem.
535535
if self.parent_selection_type in ('nsga3', 'tournament_nsga3'):
536+
# The reference points are created before starting the evolution and after the initial fitness is calculated.
537+
# The number of reference points is determined based on:
538+
# 1) The number of divisions (passed by the user).
539+
# 2) The number of objectives (only known after the fitness is calculated).
540+
# In PyGAD, the number of objectives are known only from the length of the returned result of the fitness function.
541+
# This is how NSGA-III knows the number of objectives from the calculated fitness.
542+
# It is time to build the reference points.
536543
self._bootstrap_nsga3_reference_points()
537544

538545
best_solution, best_solution_fitness, best_match_idx = self.best_solution(pop_fitness=self.last_generation_fitness)

0 commit comments

Comments
 (0)