Example #1
0
 def exchange_chromosome(self, cellmates):
     individuals = self.genome_storage
     parents = selection(self.parameter, individuals)
     cross_pop = crossover(self.parameter, parents)
     new_pop = mutation(self.parameter, cross_pop)
     new_pop = evaluate_fitness(new_pop, self.parameter)
     individuals = replacement(self.parameter, new_pop, individuals)
     individuals.sort(reverse=True)
     self.individual = [individuals[0]]
     self.genome_storage = []
Example #2
0
 def exchange_chromosome(self, ):
     """Perform genetic operations."""
     # print('from exchange', self.name)
     individuals = self.genome_storage
     parents = selection(self.parameter, individuals)
     cross_pop = crossover(self.parameter, parents)
     new_pop = mutation(self.parameter, cross_pop)
     new_pop = evaluate_fitness(new_pop, self.parameter)
     individuals = replacement(self.parameter, new_pop, individuals)
     individuals.sort(reverse=False)
     self.individual = [individuals[0]]
     self.individual[0].fitness = 0
     self.genome_storage = []