Closed alfjesus3 closed 4 years ago
Something is not right with the global variable, because the mutation step doesn't seem to change with generations. It registers as 1 at the first step of evolution and keeps that value through all generations:
I fixed this issue by using the recommended approach here - https://stackoverflow.com/questions/58990269/deap-make-mutation-probability-depend-on-generation-number Plus, it might look confusing but the mutation function is called per individual that's why there are several prints per generation.
@Serafim179 and @alfjesus3 I've modified the code to make it fit with how I've implemented the statistics and other convenience functions in PR #12.
The 2 major changes:
to use the built-in algorithms.eaSimple()
function to run the EA. This has the identical steps to what André had implemented, but comes with a lot of great support code for doing stats, saving best runs, etc.
to not replace the evaluate
function (which is now in another module), but instead to wrap it in a simple function that ignores the non-controller weights in the genome*.
This is what it looks like:
def evaluation_wrapper(individual: [float]) -> [float]:
"""Custom fitness function wrapper for the
adaptive mutation technique.
"""
# Only first half of genome is evaluated (control weights)
control_weights = individual[0:int(len(individual)/2)]
# Use the evoman evaluation function we've defined
fitness = evo_utils.evaluate(control_weights,
player_controller=nn_controller,
experiment_name=EXPERIMENT_DIRECTORY)
return fitness
NOTE: This branch is also merged into the branch for PR #15 .
NOTE: This branch is also merged into the branch for PR #15 .
Different mutation strategies may provide a substantial boost towards the population evolution. Here we explore their effects by implementing on of the two methods proposed by A.E. Eiben et.al. - http://www.few.vu.nl/~gks290/papers/SigmaAdaptationComparison.pdf