neuroevolution-ai / NeuroEvolution-CTRNN_new

MIT License
3 stars 3 forks source link

Bug in updating the Hall of Fame - does not get updated with best individuals #85

Open pdeubel opened 3 years ago

pdeubel commented 3 years ago

TL;DR:

Fitness of individuals is decided by their rank in their generation but not by their rank across generations

In each generation after the training episodes are done we do the following:

Lets consider an example where we have the first two generations. In the first generation we have individuals that create rewards around 10000. Then the Hall of Fame will consist of individuals that reach a reward of 10000. But if in the next generation for some reason the new individuals will only generate rewards of around 10, the Hall of Fame will be updated with these new individuals although they generated much lower reward. This is because they will still be ranked in their population and the best individual will have the same rank as the best individual of the first generation, although reaching a much lower reward. This rank is then used to update the Hall of Fame.

A simple fix would be to remove this reshaping of the fitness and just use the rewards from the environment as individual.fitness.values.


toolbox.shape_fitness(candidates) is self.shape_fitness_weighted_ranks in IOptimizer, the rest of the methods are in algorithms.py

bjuergens commented 3 years ago

The current implementation is based on the implementation from "Deep Neuroevolution: Genetic Algorithms Are a Competitive Alternative for Training Deep Neural Networks for Reinforcement Learning".

A simple fix would be to remove this reshaping of the fitness and just use the rewards from the environment

Some alternative ideas: