Skip to content

Instantly share code, notes, and snippets.

@gkhayes
Last active March 3, 2019 04:31
Show Gist options
  • Select an option

  • Save gkhayes/baf9b72c04c3ce1f2c42382468acf1c8 to your computer and use it in GitHub Desktop.

Select an option

Save gkhayes/baf9b72c04c3ce1f2c42382468acf1c8 to your computer and use it in GitHub Desktop.
TSP Optimization Using a Genetic Algorithm - Attempt 2
# Solve problem using the genetic algorithm
best_state, best_fitness = mlrose.genetic_alg(problem_fit, mutation_prob = 0.2,
max_attempts = 100, random_state = 2)
print('The best state found is: ', best_state)
print('The fitness at the best state is: ', best_fitness)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment