Last active
June 8, 2020 08:55
-
-
Save Shaashwat05/876d61bc9dd5d4dbfe1ea1e70f9997df to your computer and use it in GitHub Desktop.
evolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def evolve(individuals, fitness): | |
sorted_y_idx_list = sorted(range(len(fitness)),key=lambda x:fitness[x]) | |
individuals = [individuals[i] for i in sorted_y_idx_list ] | |
individuals.reverse() | |
new_individuals = crossover(individuals) | |
return new_individuals |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment