I put elitist to True in my mutation step, but it did not work when looking at the source code it looks like it will not work.
elite_fitness = self.current_best if elitist else None for individual in self.individuals: if elite_fitness is None or individual.fitness != elite_fitness: individual.mutate(mutate_function, probability=probability, **kwargs) return self
elite_fitness is set as an 'individual' object, then in the if statement it is compared to the floating point fitness instead of the actual object. Therefore individual.fitness will never equal elite_fitness and the current_best is not skipped over like it should be.
I put elitist to True in my mutation step, but it did not work when looking at the source code it looks like it will not work.
elite_fitness = self.current_best if elitist else None for individual in self.individuals: if elite_fitness is None or individual.fitness != elite_fitness: individual.mutate(mutate_function, probability=probability, **kwargs) return self
elite_fitness is set as an 'individual' object, then in the if statement it is compared to the floating point fitness instead of the actual object. Therefore individual.fitness will never equal elite_fitness and the current_best is not skipped over like it should be.