Skip to content

Instantly share code, notes, and snippets.

@Shaashwat05
Last active June 8, 2020 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shaashwat05/876d61bc9dd5d4dbfe1ea1e70f9997df to your computer and use it in GitHub Desktop.
Save Shaashwat05/876d61bc9dd5d4dbfe1ea1e70f9997df to your computer and use it in GitHub Desktop.
evolution
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