1 / 52

Ant colonies for the traveling salesman problem

Ant colonies for the traveling salesman problem. Eliran Natan. Seminar in Bioinformatics ( 236818 ) – Spring 2013 Computer Science Department Technion - Israel Institute of Technology. Content. Pheromone trails. Ant Colony Optimization algorithms. Travelling Salesman Problem

nira
Télécharger la présentation

Ant colonies for the traveling salesman problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ant colonies for the traveling salesman problem Eliran Natan Seminar in Bioinformatics (236818) – Spring 2013 Computer Science Department Technion - Israel Institute of Technology

  2. Content • Pheromone trails • Ant Colony Optimization algorithms • Travelling Salesman Problem • And its ACS solution

  3. Content • Pheromone trails • Ant Colony Optimization algorithms • Travelling Salesman Problem • And its ACS solution

  4. Content • Pheromone trails • Ant Colony Optimization algorithms • Travelling Salesman Problem • And its ACS solution

  5. Content • Pheromone trails • Ant Colony Optimization algorithms • Travelling Salesman Problem • And its ACS solution

  6. Pheromone trails It is well known that the primary means for ants to form and maintain the line is a pheromone trail. Ants deposit a certain amount of pheromone while walking, and each ant probabilistically prefers to follow a direction rich in pheromone.

  7. Pheromone trails Shortest path around an obstacle This elementary behavior of real ants can be used to explain how they can find the shortest path that reconnects a broken line after the sudden appearance of an unexpected obstacle has interrupted the initial path. Let us consider the following scenario: Ants are moving on a straight line that connects a food source to their nest.

  8. Pheromone trails Shortest path around an obstacle This elementary behavior of real ants can be used to explain how they can find the shortest path that reconnects a broken line after the sudden appearance of an unexpected obstacle has interrupted the initial path. An obstacle appears on the path.

  9. Pheromone trails Shortest path around an obstacle This elementary behavior of real ants can be used to explain how they can find the shortest path that reconnects a broken line after the sudden appearance of an unexpected obstacle has interrupted the initial path. Those ants which are just in front of the obstacle cannot continue to follow the pheromone trail and therefore they have to choose between turning right or left. In this situation we can expect half the ants to choose to turn right and the other half to turn left.

  10. Pheromone trails Shortest path around an obstacle This elementary behavior of real ants can be used to explain how they can find the shortest path that reconnects a broken line after the sudden appearance of an unexpected obstacle has interrupted the initial path. Those ants which choose, by chance, the shorter path around the obstacle will more rapidly reconstitute the interrupted pheromone trail compared to those which choose the longer path. Thus, the shorter path will receive a greater amount of pheromone per time unit and in turn a larger number of ants will choose the shorterpath.

  11. Pheromone trails Shortest path around an obstacle This elementary behavior of real ants can be used to explain how they can find the shortest path that reconnects a broken line after the sudden appearance of an unexpected obstacle has interrupted the initial path. Shortest path is being obtained.

  12. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. Let us describe the algorithm: A small amount of ants travel randomly around the nest. N

  13. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. One of the ants find food source. N S

  14. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. When ant finds food, it returns to the nest while laying down pheromones trail. N S

  15. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. When other ants find a pheromone trail, they are likely not to keep travelling at random, but to instead follow the trail. N S

  16. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. If an ant eventually find food by following a pheromone trail, it returning to the nest while reinforcing the trail with more pheromones. N S

  17. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. Due to their stochastic behavior, some ants are not following the pheromone trails, and thus uncover more possible paths. N S

  18. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. Over time, however, the pheromones trails starts to evaporate, thus reducing its attractive strength. N S

  19. Pheromone trails Shortest path from the nest to the food source Ants are able, without using any spatial Information, to identify a sudden appearance of a food source around their nest, and to find the shortest available path to it. Shortest path is being obtained. N S

  20. Pheromone trails Shortest path from the nest to the food source An Intuitive proof of correctness • The more time it takes for an ant to travel down the path and back again, the more time the pheromones have to evaporate. Thus, • A short path, by comparison, get marched over more frequently, and thus its pheromone density becomes higher on shorter paths than longer ones. Pheromone evaporation also has the advantage of avoiding the convergence to a locally optimal solution. If there were no evaporation at all, all paths chosen by the first ants would tend to be excessively attractive to the following ones. In that case, the exploration of the solution space would be constrained. Thus, when one ant finds a short path from the colony to a food source, other ants are more likely to follow that path, and positive feedback eventually leads all the ants following a single path.

  21. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Set partition problem Deciding whether a given multiset of positive integers can be partitioned into two subsets A and B such that the sum of the numbers in A equals the sum of the numbers in B.

  22. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Job – Shop problems Given a number of jobs have to be done and every job consists of using a number of machines for a certain amount of time. Find the best planning to do all the jobs on all the different machines in the shortest period of time.

  23. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Multiple knapsack problem Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.

  24. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Protein folding The process by which a proteinstructure assumes its functional shape or conformation.

  25. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Data mining the computational process of discovering patterns in large data sets.

  26. Ant Colony Optimization algorithms Ant Colony Optimization (ACO) studies artificial systems that take inspiration from the behavior of real ant colonies and which are used to solve discrete optimization problems. Some applications: Travelling salesman problem Given a list of cities and the distances between each pair of cities, determine the shortest possible route that visits each city exactly once and returns to the origin city.

  27. Travelling Salesman Problem For a complete undirected weighted graphs Definitions • Undirected graph is complete if for every pear of vertexes there exist an edge • Path in is a Hamiltonian path if visits each vertex exactly once. Problem Given a complete undirected weighted graph , find the minimal Hamiltonian cycle in . Complexity class NP–Hard

  28. Travelling Salesman Problem For an undirected complete weighted graphs Algorithms for deterministic solution • Brute force search • Dynamic programming • Greedy algorithm Compute all possible cycles and get the minimal path. Time complexity: Exact solution Recursive algorithms such as the Held–Karp algorithm. Time complexity: Exact solution Such as thenearest neighbor (NN) algorithm. Time complexity: Approximate solution

  29. Travelling Salesman Problem ACS solution The Ant Colony System (ACS) is one of the ACO algorithms, which gives a non – deterministic approximate solution to the TSP problem with a time complexity of , where is a constant.

  30. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes.

  31. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . Ant endowed with a working memory , which is used to memorize vertexes already visited. At initialization, for every , and when ant arrives to vertex , vertex is being added to .

  32. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . An ant in city chooses the city to move to among those which do not belong to its working memory by applying the following probabilistic formula: - Amount of pheromone trail on edge - Aheuristic function which was chosen to be the inverse of the distance between iiiiiiiiiiiiiiivertexes and . - A parameter which weighs the relative importance of pheromone trail and of iiiiiiiiiiiiiiicloseness.

  33. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . An ant in city chooses the city to move to among those which do not belong to its working memory by applying the following probabilistic formula: - A value chosen randomly with uniform probability in . - A parameter in .

  34. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . An ant in city chooses the city to move to among those which do not belong to its working memory by applying the following probabilistic formula: - A random variable selected according to the following probability distribution, which IIIIIfavorsedges which are shorter and have a higher level of pheromone trail:

  35. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . While traveling, each ant applies the local update rule for each visited edge. Every time an edge is chosen by an ant, its amount of pheromone is changed according to the following formula: - Parameters • Local updating is intended to avoid a very strong edge being chosen by all the ants. • Local trail updating is also motivated by trail evaporation in real ants.

  36. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . While traveling, each ant applies the local update rule for each visited edge. Once ants have completed their tours, apply the global update rule. Update the weight of each edge that belongs to the shortest tour, according to the following formula: - The length of the shortest tour. • Global updating is intended to reward edges belonging to shorter tours. • The amount of weight deposited on each edge is inversely proportional to the length of the tour: The shorter the tour the greater the amount of weight deposited on edges.

  37. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . While traveling, each ant applies the local update rule for each visited edge. Once ants have completed their tours, apply the global update rule. Update the weight of each edge that belongs to the shortest tour, according to the following formula: - The length of the shortest tour. • Global updating is intended to emulate the property of differential pheromone trail accumulation, which in the case of real ants was due to the interplay between length of the path and continuity of time.

  38. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . While traveling, each ant applies the local update rule for each visited edge. Once ants have completed their tours, apply the global update rule. times

  39. Travelling Salesman Problem ACS solution ACS Algorithm description Given a complete undirected weighted graph : Place ants in a randomly chosen vertexes. Each ant preforms a Hamiltonian cycle according to the navigation function . While traveling, each ant applies the local update rule for each visited edge. Once ants have completed their tours, apply the global update rule. times Return shortest tour.

  40. Travelling Salesman Problem For an undirected complete weighted graphs Algorithm – Initialization A Choose constant between 1 and to be the number of ants. E B C D

  41. Travelling Salesman Problem For an undirected complete weighted graphs Algorithm – Initialization Place each ant in a randomly chosen city. A E B C D

  42. Travelling Salesman Problem For an undirected complete weighted graphs Algorithm – Step 1 Each ant preforms a Hamiltonian cycle according to the navigation function , while applying the local update rule for each visited edge. A E B C D

  43. Travelling Salesman Problem For an undirected complete weighted graphs Algorithm – Step 2 Apply the Global Update Rule. A E B C D

  44. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms • Comparison of ACS tour length on a TSP problem with 50 vertexeswith the following nature-inspired algorithms: • SA – Simulated Annealing • EN –Elastic Net • SOM – Self Organizing Map • FI – Farthest Insertion Heuristic

  45. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms Test A Best 6.06 6.03 5.98 5.88 5.86 SOM SA FI EN ACS

  46. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms Test B Best 6.28 6.25 6.05 6.03 6.01 SOM SA FI EN ACS

  47. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms Test C Best 5.96 5.87 5.86 5.81 5.7 SOM SA FI EN ACS

  48. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms Test D Best 6.71 6.49 6.7 6.33 6.17 SOM SA FI EN ACS

  49. Travelling Salesman Problem For an undirected complete weighted graphs Comparison with other algorithms Test E Best 6.28 6.25 6.05 6.03 6.01 SOM SA FI EN ACS

  50. Travelling Salesman Problem For an undirected complete weighted graphs Number of ants ACS runtime on a TSP problem with 10 vertexesfor , where is the number of ants. 0.23 0.22 0.2 0.18 0.16 0.15 0.13 0.1 0.05 4 7 1 5 6 8 9 2 3

More Related