Guest User

Untitled

a guest
Aug 19th, 2019
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def select(lineups, elite_rate=0.1):
  2. num_elite = int(len(lineups)*0.1)
  3.  
  4. # sort lineups according to score
  5. scores = [lineup.score for lineup in lineups]
  6. order = np.argsort(scores)
  7. sorted_lineups = [lineups[i] for i in order]
  8.  
  9. # get 10% elite and 80% mutation pool
  10. elite = sorted_lineups[len(lineups)-num_elite:]
  11. mutation_pool = sorted_lineups[num_elite:len(lineups)-num_elite]
  12.  
  13. return elite, mutation_pool
RAW Paste Data