Fixed to explain

This commit is contained in:
danielwilczak101
2020-09-23 20:29:50 -04:00
parent 70bb03bc96
commit eaa90ecd2a

View File

@ -4,30 +4,14 @@ import EasyGA
# Create the Genetic algorithm
ga = EasyGA.GA()
# Makes a new gene
new_gene = ga.make_gene("HelloWorld")
# Makes a chromosome to store genes in
new_chromosome = ga.make_chromosome()
# Makes a Population to store chromosomes in
new_population = ga.make_population()
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())
ga.initialize()
print(ga.population)