Skip to content

Instantly share code, notes, and snippets.

@fyr91
Last active October 3, 2019 07:03
Show Gist options
  • Save fyr91/18c8587c693c3ddc47c5e31bf244932a to your computer and use it in GitHub Desktop.
Save fyr91/18c8587c693c3ddc47c5e31bf244932a to your computer and use it in GitHub Desktop.
dummpy ga
def select(lineups, elite_rate=0.1):
num_elite = int(len(lineups)*0.1)
# sort lineups according to score
scores = [lineup.score for lineup in lineups]
order = np.argsort(scores)
sorted_lineups = [lineups[i] for i in order]
# get 10% elite and 80% mutation pool
elite = sorted_lineups[len(lineups)-num_elite:]
mutation_pool = sorted_lineups[num_elite:len(lineups)-num_elite]
return elite, mutation_pool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment