Skip to content

Instantly share code, notes, and snippets.

@mohdabdin
Created July 19, 2021 10:17
Show Gist options
  • Save mohdabdin/5372a5d322c9a2bc6c71987f4a045372 to your computer and use it in GitHub Desktop.
Save mohdabdin/5372a5d322c9a2bc6c71987f4a045372 to your computer and use it in GitHub Desktop.
if __name__=='__main__':
#initialize population
agents = []
for _ in range(POP_SIZE):
agent = Policy(obs_dim=NUM_STATES, act_dim=NUM_ACTIONS)
agents.append(agent)
fitness_list = evaluate_agents(env, agents)
population = pd.DataFrame({'agents': agents,
'fitness': fitness_list})
# Sort population dataframe descending by fitness (highest fitness at row 0)
population = population.sort_values('fitness', ascending=False, ignore_index=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment