Merge branch 'Dans_devel' into Jack_domain

This commit is contained in:
danielwilczak101
2020-09-25 16:56:59 -04:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

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

View File

@ -1,5 +1,6 @@
import EasyGA
import random
# Create the Genetic algorithm
ga = EasyGA.GA()
@ -22,3 +23,4 @@ ga.domain = user_gene_domain
ga.initialize()
#ga.population.print_all()