Skip to content

MohammadAsadolahi/Solving-TSP-with-Evolutionary-Genetic-Algorithm-Heuristic-Python

Repository files navigation

Solving-TSP-with-Evolutionary-Genetic-Algorithm-Heuristic-Python

solving TSP (traveling sales man) using genetic algorithm in python
using heuristic algorithm to solve high dimensional tsp problem
Cities are included in "Cities List.txt" in repo to add or remove cities you've got to include or exclude cities in every line like: "1 909 649"
First number is city index and next two numbers are city euclidean coordinates: x,y which are set to 0 to 1000 but you can change the range to any range The distance between cities are calculated by Euclidean Distance which is:
Euclidean Distance

I look forward to you questions about the project!
sample route found by algorithm(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 too 1000 ):
Best solution found at 180 iterations
Average plot of all generations:
Average chromosome(routes) costs among all generations All best route of genereations
Elite chromosome(routes) cost among all generations

route at iteration of 0(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 0 solution

route found by algorithm at iteration of 20(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 20 solution

route found by algorithm at iteration of 40(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 40 solution

route found by algorithm at iteration of 60(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 60 solution

route found by algorithm at iteration of 80(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 80 solution

route found by algorithm at iteration of 100(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 100 solution

route found by algorithm at iteration of 120(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 120 solution

route found by algorithm at iteration of 140(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 140 solution

route found by algorithm at iteration of 160(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 160 solution

route found by algorithm at iteration of 180(feeding algorithm with list of 20 city euclidean coordinates: x,y from 0 to 1000 ):

iteration 180 solution

About

solving TSP (traveling sales man) using genetic algorithm in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages