Domain update

Can set the domain to either a range or a list of values.
This commit is contained in:
SimpleArt
2020-09-24 23:51:21 -04:00
parent 4daec6574d
commit 5c5d6920b2
5 changed files with 18 additions and 30 deletions

View File

@ -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(chromosome_length,population_size,gene_function):
def random_initialization(chromosome_length, population_size, gene_function, domain):
# Create the population object
population = create_population()
# Fill the population with chromosomes
@ -11,6 +11,6 @@ def random_initialization(chromosome_length,population_size,gene_function):
chromosome = create_chromosome()
#Fill the Chromosome with genes
for j in range(chromosome_length):
chromosome.add_gene(create_gene(gene_function()))
chromosome.add_gene(create_gene(gene_function(domain)))
population.add_chromosome(chromosome)
return population