Skip to main content

Posts

Showing posts from November, 2020

Genetic Algorithm - Travelling Salesman with Julia

  Genetic Algorithm Genetic algorithm (GA) is a type of algorithm inspired by the process of natural selection to generate high-quality solutions to problems, which otherwise would be too difficult to solve. Travelling Salesman Problem Travelling Salesman Problem or TSP for short, is a infamous problem where a travelling sales person has to travel various cities with known distance and return to the origin city in the shortest time/path possible. Like below, each circle is a city and blue line is a route, visiting them. Why not brute-force ?? Okay, lets try to brute force to solve the problem. for starters lets take 5 cities, i.e., we have to calculate 5! , i.e., 120 routes to ensure we got the shortest path. Now, if we are to do that for 50 cities, 5! = 120 10! = 3628800 15! = 1307674368000 20! = 2432902008176640000 50! = 30414093201713378043612608166064768844377641568960512000000000000 We can see how brute forcing our way is ...