From 159506824a2b1eac02455f5d7d2bd34efc3d9636 Mon Sep 17 00:00:00 2001 From: RyleyGG Date: Mon, 12 Oct 2020 16:15:26 -0400 Subject: [PATCH] parent selection commenting parent selection commenting --- src/parent_selection/parent_selection_methods.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parent_selection/parent_selection_methods.py b/src/parent_selection/parent_selection_methods.py index d331f2f..1cf0f87 100644 --- a/src/parent_selection/parent_selection_methods.py +++ b/src/parent_selection/parent_selection_methods.py @@ -7,6 +7,11 @@ from initialization.chromosome_structure.chromosome import Chromosome class Parent_Selection: class Tournament: def with_replacement(ga): + """ + Will make tournaments of size tournament_size and choose the winner (best fitness) from the tournament and use it as a parent for the next generation + The total number of parents selected is determined by parent_ratio, an attribute to the GA object. + """ + tournament_size = int(len(ga.population.get_all_chromosomes())*ga.tournament_size_ratio) if tournament_size < 5: tournament_size = 5