Changed names of impl
This commit is contained in:
@ -3,7 +3,7 @@ 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
|
||||
|
||||
def random_initialization(population_size, chromosome_length, domain, new_range):
|
||||
def random_initialization(population_size, chromosome_length, chromosome_impl, gene_impl):
|
||||
# Create the population object
|
||||
population = create_population()
|
||||
# Fill the population with chromosomes
|
||||
@ -11,14 +11,14 @@ def random_initialization(population_size, chromosome_length, domain, new_range)
|
||||
chromosome = create_chromosome()
|
||||
#Fill the Chromosome with genes
|
||||
for j in range(chromosome_length):
|
||||
if domain != None:
|
||||
if chromosome_impl != None:
|
||||
# Each chromosome location is specified with its own function
|
||||
chromosome.add_gene(create_gene(domain(j)))
|
||||
chromosome.add_gene(create_gene(chromosome_impl(j)))
|
||||
# Will break if chromosome_length != lists in domain
|
||||
elif new_range != None:
|
||||
# new_rnage = [range function,lowerbound,upperbound]
|
||||
function = new_range[0]
|
||||
chromosome.add_gene(create_gene(function(new_range[1],new_range[2])))
|
||||
elif gene_impl != None:
|
||||
# gene_impl = [range function,lowerbound,upperbound]
|
||||
function = gene_impl[0]
|
||||
chromosome.add_gene(create_gene(function(gene_impl[1],gene_impl[2])))
|
||||
else:
|
||||
#Exit because either were not specified
|
||||
print("Your domain or range were not specified")
|
||||
|
||||
Reference in New Issue
Block a user