From db93235642e6b24b759f8f191a7e6ed5c984292a Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Mon, 12 Oct 2020 22:02:18 -0400 Subject: [PATCH] Cleaned it a bit more to match mutation methods --- src/initialization/initialization_methods.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/initialization/initialization_methods.py b/src/initialization/initialization_methods.py index ecd3991..3963f37 100644 --- a/src/initialization/initialization_methods.py +++ b/src/initialization/initialization_methods.py @@ -1,8 +1,3 @@ -# Import the data structure -from .population_structure.population import Population as create_population -from .chromosome_structure.chromosome import Chromosome as create_chromosome -from .gene_structure.gene import Gene as create_gene - class Initialization_Methods: """Initialization examples that are used as defaults and examples""" @@ -15,18 +10,18 @@ class Initialization_Methods: # Using the chromosome_impl to set every index inside of the chromosome if ga.chromosome_impl != None: - return create_population([ - create_chromosome([ - create_gene(ga.chromosome_impl(j)) + return ga.make_population([ + ga.make_chromosome([ + ga.make_gene(ga.chromosome_impl(j)) for j in range(ga.chromosome_length)]) for i in range(ga.population_size)]) # Using the gene_impl to set every gene to be the same elif ga.gene_impl != None: function = ga.gene_impl[0] - return create_population([ - create_chromosome([ - create_gene(function(*ga.gene_impl[1:])) + return ga.make_population([ + ga.make_chromosome([ + ga.make_gene(function(*ga.gene_impl[1:])) for j in range(ga.chromosome_length)]) for i in range(ga.population_size)])