Closed schrum2 closed 2 years ago
It does seem to be working. Here's a screenshot of at least 12 out of the 15 elites, which is what is the number I chose as the number of fitness elites. Further down the population of 30 which is what I was testing had a few more that looked like this too. It has done this quite a few times already so I think it works.
Seems to be working as it should be even when the NUM_FITNESS_ELITES is small like 2. The population starts to look like the one from above very quickly.
I've further confirmed that elitism works. I ran this command
python main.py --FITNESS_FUNCTION=type_target --KEEP_WORLD_ON_EXIT=True --SAVE_POPULATION=True --BASE_DIR=test --EXPERIMENT_PREFIX=target --INTERACTIVE_EVOLUTION=False --RANDOM_SEED=1 --DESIRED_BLOCK_COUNT=100 --POTENTIAL_BLOCK_SET=machine --DESIRED_BLOCK=REDSTONE_BLOCK --USE_ELITISM=True
This outputs a CSV file with fitness that looks like this:
Basically, when elitism is on, it should be impossible for the line to ever go down
I'm looking for ways to solve the challenge in issue #46 so here is a new proposal. Currently, the USE_ELITISM option only applies to interactive evolution. Elitism means that the highest scoring individuals in the population are copied directly into the next generation unchanged. With interactive evolution, we change the number of elite individuals to copy to equal all the individuals the user selects. However, for typical fitness based evolution you just set a specific number of top individuals to copy each time. So, add an additional NUM_FITNESS_ELITES parameter that is only for fitness-based evolution (this gets around needing to specify the value in the NEAT config files where it is typically defined).
For fitness based evolution, the number of elites should be specified once at the start of evolution (somewhere in the
fitness_cppn_evolution.py
file). The value is set via the config file. Here is an example of how it is done for interactive evolution.