Last active
October 3, 2019 07:03
-
-
Save fyr91/18c8587c693c3ddc47c5e31bf244932a to your computer and use it in GitHub Desktop.
dummpy ga
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 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