G5BAIM Genetic Algorithms G5BAIM Artificial Intelligence Methods Dr. Rong Qu Finally.. So that s why we ve been getting pictures of ants all this time!!!! Guy Theraulaz Ants are practically blind but they still manage to find their way to and from food. How do they do it? These observations inspired a new type of algorithm called ant algorithms (or ant systems) These algorithms are very new (Dorigo, 996) and is still very much a research area Ant systems are a population based approach. In this respect it is similar to genetic algorithms There is a population of ants, with each ant finding a solution and then communicating with the other ants Ant Colonies for the Traveling Salesman Problem (Dorigo M. & L.M. Gambardella (997). Ant Colonies for the Traveling Salesman Problem. BioSystems, 43:73-8. (Also Tecnical Report TR/IRIDIA/996-3, IRIDIA, Université Libre de Bruxelles.) The Ant System: Optimization by a Colony of Cooperating Agents (Dorigo M., V. Maniezzo & A. Colorni (996). The Ant System: Optimization by a Colony of Cooperating Agents. IEEE Transactions on Systems, Man, and Cybernetics-Part B, 26():29-4). An Introduction to (Dorigo M. and Colorni A. The Ant System: Optimization by a colony of cooperating agents, IEEE Transactions on Systems, Man, and Cybernetics- Part B, 26(), 996, pp -3). B A G E H C F D
E F D d=0.5 C d=0.5 B A Time, t, is discrete At each time unit an ant moves a distance, d, of Once an ant has moved it lays down unit of pheromone At t=0, there is no pheromone on any edge F D 0.5 E C B 0.5 A 6 ants are moving from A - F and another 6 are moving from F - A At t= there will be 6 ants at B and 6 ants at D. At t=2 there will be 8 ants at D and 8 ants at B. There will be 6 ants at E The intensities on the edges will be as follows FD = 6, AB = 6, BE = 8, ED = 8, BC = 6 and CD = 6 We are interested in exploring the search space, rather than simply plotting a route We need to allow the ants to explore paths and follow the best paths with some probability in proportion to the intensity of the pheromone trail We do not want them simply to follow the route with the highest amount of pheromone on it, else our search will quickly settle on a suboptimal (and probably very sub-optimal) solution The probability of an ant following a certain route is a function, not only of the pheromone intensity but also a function of what the ant can see (visibility) The pheromone trail must not build unbounded. Therefore, we need evaporation initial ideas Dorigo (996) Based on real world phenomena Ants, despite almost blind, are able to find their way to the food source using the shortest route If an obstacle is placed, ants have to decide which way to take around the obstacle. 2
initial ideas Dorigo (996) Initially there is a 50-50 probability as to which way they will turn Assume one route is shorter than the other Ants taking the shorter route will arrive at a point on the other side of the obstacle before the ants which take the longer route. initial ideas Dorigo (996) As ants walk they deposit pheromone trail. Ants have taken shorter route will have already laid trail So ants from the other direction are more likely to follow that route with deposit of pheromone. initial ideas Dorigo (996) Over a period of time, the shortest route will have high levels of pheromone. The quantity of pheromones accumulates faster on the shorter path than on the longer one There is positive feedback which reinforces that behaviors so that the more ants follow a particular route, the more desirable it becomes. and the TSP At the start of the algorithm one ant is placed in each city Variations have been tested by Dorigo and the TSP Time, t, is discrete. t(0) marks the start of the algorithm. At t+ every ant will have moved to a new city Assuming that the TSP is being represented as a fully connected graph, each edge has an intensity of trail on it. This represents the pheromone trail laid by the ants Let T i,j (t) represent the intensity of trail edge (i,j) at time t 3
and the TSP When an ant decides which town to move to next, it does so with a probability that is based on the distance to that city and the amount of trail intensity on the connecting edge The distance to the next town, is known as the visibility, n ij, and is defined as /d ij, where, d, is the distance between cities i and j. and the TSP At each time unit evaporation takes place The amount of evaporation, p, is a value between 0 and and the TSP In order to stop ants visiting the same city in the same tour a data structure, Tabu, is maintained This stops ants visiting cities they have previously visited Tabu k is defined as the list for the k th ant and it holds the cities that have already been visited and the TSP After each ant tour the trail intensity on each edge is updated using the following formula T ij (t + n) = p. T ij (t) + T ij k T ij Q Lk = 0 if the kth ant uses edge( i, j) ( between time t and t + n) otherwise in its tour Q is a constant and L k is the tour length of the k th ant and the TSP T ij (t + n) = p. T ij (t) + T ij Q is a constant and L k is the tour length of the kth ant P is the evaporation coefficient By using this rule, the probability increases that forthcoming ants will use edge (i, j) k p ij and the TSP Transition Probability α β [ Tij( t)].[ nij] ( t) = k allowedk Tik [ ( t)] 0 α. [ nik] β if j allowedk otherwise where α and β are control parameters that control the relative importance of trail versus visibility 4
Numerator Denominator Mo ve A to A TRUE.73 0.00 Visibility A to A.00 0.00.73 0.00 Mo ve A to A FALSE.73.73 Visibility A to A.00.00.73.73 Mo ve A to B FALSE.73.73 Visibility A to B 0.89 0.89.55.55 Tr ail Edg e Co nstan t 0. 5 Visib ility Co nstan t 0. 5 and the TSP and the TSP If you are interested (and willing to do some work) there is a spreadsheet that implements some of the above formula Mo ve A to B FALSE.73.73 Visibility A to B 0.89 0.89.55.55 Distance T able Mo ve A to C FALSE.73.73 Visibility A to C 0.93 0.93.62.62 A A B B C D E Mo ve A to D FALSE.73.73 Visibility A to D 0.99 0.99.72.72 A.00 Mo ve A to E FALSE.73.73 Visibility A to E 0.77 0.77.33.33 A.00 Mo ve A to F FALSE.73.73 Visibility A to F 0.79 0.79.37.37 B 0.80 Mo ve A to F FALSE.73.73 Visibility A to F 0.79 0.79.37.37 B 0.80 Mo ve A to G FALSE.73.73 Visibility A to G 0.88 0.88.52.52 C 0.87 Mo ve A to H FALSE.73.73 Visibility A to H 0.98 0.98.70.70 D 0.99 Mo ve A to H FALSE.73.73 Visibility A to H 0.98 0.98.70.70 E 0.59 Mo ve A to I FALSE.73.73 Visibility A to I 0.97 0.97.69.69 F 0.63 F 0.63 SUM's 22.52 20.78.88 0.88 20.58 8.854898738 G 0.77 H 0.96 H 0.96 Probability A to A 0. 00 00 0 I 0.95 Probability A to A 0. 09 8 8 Probability A to B 0. 08 2 8 Tr ail Edg e Table Probability A to B 0. 08 2 8 A A B B C D E Probability A to C 0. 08 57 0 A 3.00 Probability A to D 0. 09 4 2 A 3.00 Probability A to E 0. 07 05 7 B 3.00 Probability A to F 0. 07 29 3 B 3.00 Probability A to F 0. 07 29 3 C 3.00 Probability A to G 0. 08 06 2 D 3.00 Probability A to H 0. 09 00 2 E 3.00 Probability A to H 0. 09 00 2 F 3.00 Probability A to I 0. 08 95 5 F 3.00 G 3.00 H 3.00 This spreadsheet m o de l s t h e t ra ns i tion probability shown in the paper [ref2] H 3.00 See notes, if necessary I 3.00 Trail distribution at the beginning (Dorigo et al., 996) and the TSP - Applications Travelling Salesman Problem (TSP) Facility Layout Problem - which can be shown to be a Quadratic Assignment Problem (QAP) Vehicle Routing Trail distribution after 00 cycles. (Dorigo et al., 996) Stock Cutting (at Nottingham) - Applications Marco Dorigo, who did the seminal work on ant algorithms, maintains a WWW page devoted to this subject http://iridia.ulb.ac.be/~mdorigo/aco/aco.html This site contains information about ant algorithms as well as links to the main papers published on the subject. Summary Ant algorithms are inspired by real ant colony Probability of ant following certain route is a function Pheromone intensity Visibility Evaporation Ant algorithms in TSP (Dorigo, 996) 5
G5BAIM Artificial Intelligence Methods Dr. Rong Qu End of 6