First generation now only does initialization stuff
First generation now only does initialization stuff
This commit is contained in:
@ -58,15 +58,15 @@ class GA:
|
|||||||
self.initialize_population()
|
self.initialize_population()
|
||||||
self.set_all_fitness(self.population.chromosome_list)
|
self.set_all_fitness(self.population.chromosome_list)
|
||||||
self.population.set_all_chromosomes(self.sort_by_best_fitness())
|
self.population.set_all_chromosomes(self.sort_by_best_fitness())
|
||||||
|
else:
|
||||||
self.parent_selection_impl(self)
|
self.parent_selection_impl(self)
|
||||||
next_population = self.crossover_impl(self)
|
next_population = self.crossover_impl(self)
|
||||||
next_population = self.survivor_selection_impl(self, next_population)
|
next_population = self.survivor_selection_impl(self, next_population)
|
||||||
next_population.set_all_chromosomes(self.mutation_impl(self, next_population.get_all_chromosomes()))
|
next_population.set_all_chromosomes(self.mutation_impl(self, next_population.get_all_chromosomes()))
|
||||||
|
|
||||||
self.population = next_population
|
self.population = next_population
|
||||||
self.set_all_fitness(self.population.chromosome_list)
|
self.set_all_fitness(self.population.chromosome_list)
|
||||||
self.population.set_all_chromosomes(self.sort_by_best_fitness())
|
self.population.set_all_chromosomes(self.sort_by_best_fitness())
|
||||||
|
|
||||||
number_of_generations -= 1
|
number_of_generations -= 1
|
||||||
self.current_generation += 1
|
self.current_generation += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user