Created
January 31, 2021 16:18
-
-
Save rocreguant/4e0ec9c16847b44b9a05b3e04f656985 to your computer and use it in GitHub Desktop.
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
# First step: Create the first population set | |
def genesis(city_list, n_population): | |
population_set = [] | |
for i in range(n_population): | |
#Randomly generating a new solution | |
sol_i = city_list[np.random.choice(list(range(n_cities)), n_cities, replace=False)] | |
population_set.append(sol_i) | |
return np.array(population_set) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment