This commit is contained in:
SimpleArt
2020-09-27 17:29:40 -04:00

View File

@ -4,6 +4,8 @@ from .chromosome_structure.chromosome import chromosome as create_chromosome
from .gene_structure.gene import gene as create_gene from .gene_structure.gene import gene as create_gene
def random_initialization(population_size, chromosome_length, chromosome_impl, gene_impl): def random_initialization(population_size, chromosome_length, chromosome_impl, gene_impl):
"""Takes the initialization inputs and choregraphs them to output the type of population
with the given parameters."""
# Create the population object # Create the population object
population = create_population() population = create_population()
# Fill the population with chromosomes # Fill the population with chromosomes
@ -14,7 +16,7 @@ def random_initialization(population_size, chromosome_length, chromosome_impl, g
if chromosome_impl != None: if chromosome_impl != None:
# Each chromosome location is specified with its own function # Each chromosome location is specified with its own function
chromosome.add_gene(create_gene(chromosome_impl(j))) chromosome.add_gene(create_gene(chromosome_impl(j)))
# Will break if chromosome_length != lists in domain # Will break if chromosome_length != len(lists) in domain
elif gene_impl != None: elif gene_impl != None:
# gene_impl = [range function,lowerbound,upperbound] # gene_impl = [range function,lowerbound,upperbound]
function = gene_impl[0] function = gene_impl[0]