Added more structure methods and some quality of life changes
Overall cleaned up a lot of comments. EasyGA: - Code cleanup. Population: - Added sort_by_best_fitness - Added parent/mating pool methods. - Renamed some methods for consistency. Chromosome: - Added get_gene(index). Parent Selection: - Improved selection methods to use the ga.selection_probability so that the roulette selection actually works well. - Added stochastic selection. Survivor Selection: - Added fill_in_random and fill_in_parents_then_random. Crossover/Mutation: - Cleaned up code.
This commit is contained in:
@ -24,9 +24,15 @@ class Chromosome:
|
||||
|
||||
|
||||
def remove_gene(self, index):
|
||||
"""Removes the gene at the given index"""
|
||||
del self.gene_list[index]
|
||||
|
||||
|
||||
def get_gene(self, index):
|
||||
"""Returns the gene at the given index"""
|
||||
return gene_list[index]
|
||||
|
||||
|
||||
def get_gene_list(self):
|
||||
return self.gene_list
|
||||
|
||||
|
||||
Reference in New Issue
Block a user