Optimizations/updates
1. Deleted duplicate functions in EasyGA 2. Added new index-dependent fitness example 3. GA now auto-sorts by best fitness immediately after the fitness is calculated across the board 4. Removed 'selected' status flag from the Chromosome flag 5. Added mating_pool attribute to the population 6. Changed other code to be in line with 4 and 5 7. Optimized tournament selection method
This commit is contained in:
@ -6,7 +6,6 @@ class Chromosome:
|
||||
else:
|
||||
self.gene_list = genes
|
||||
self.fitness = None
|
||||
self.selected = False
|
||||
|
||||
def add_gene(self, gene, index = -1):
|
||||
if index == -1:
|
||||
|
||||
@ -7,6 +7,7 @@ class Population:
|
||||
else:
|
||||
self.chromosome_list = chromosomes
|
||||
self.fitness = None
|
||||
self.mating_pool = []
|
||||
|
||||
def get_closet_fitness(self,value):
|
||||
# Get the chomosome that has the closets fitness to the value defined
|
||||
|
||||
Reference in New Issue
Block a user