This commit is contained in:
Daniel Wilczak
2020-09-23 18:23:29 -04:00
parent b0b502c697
commit 70bb03bc96
2 changed files with 26 additions and 3 deletions

View File

@ -53,4 +53,7 @@ class GA:
return create_gene(value)
def make_chromosome(self):
pass
return create_chromosome()
def make_population(self):
return create_population()

View File

@ -4,12 +4,32 @@ import EasyGA
# Create the Genetic algorithm
ga = EasyGA.GA()
# Start the population
ga.initialize()
def user_initialize():
population_size = 1
chromosome_length = 3
population = ga.make_population()
# Fill the population with chromosomes
for i in range(population_size):
chromosome = ga.make_chromosome()
#Fill the Chromosome with genes
for j in range(chromosome_length):
chromosome.add_gene(ga.make_gene("hello"))
population.add_chromosome(chromosome)
return population
# Start the population
ga.initialization_impl = user_initialize()
#make gene
new_gene = ga.make_gene("Hello")
print(new_gene.get_value())
print(new_gene.get_fitness())
print(ga.population)
for chromosome in ga.population.chromosomes:
print(chromosome.genes[0].__dict__)