Selected Topics in CI I Ant Colony Optimization

  • Slides: 37
Download presentation
Selected Topics in CI I Ant Colony Optimization Dr. Widodo Budiharto 2015

Selected Topics in CI I Ant Colony Optimization Dr. Widodo Budiharto 2015

Agenda • • Introduction to Ant Colony Optimization Ant Algorithm Demo Exercise Bina Nusantara

Agenda • • Introduction to Ant Colony Optimization Ant Algorithm Demo Exercise Bina Nusantara University 2

Implementation of ACO • Shortest route Bina Nusantara University 3

Implementation of ACO • Shortest route Bina Nusantara University 3

Introduction • An Ant Colony Optimization(ACO) algorithm is an artificial intelligence technique based on

Introduction • An Ant Colony Optimization(ACO) algorithm is an artificial intelligence technique based on the pheromonelaying behavior of ants • It can be used to find solutions to exceedingly complex problems that seek the optimal path through a graph. Bina Nusantara University 4

Introduction • Ants are social insects, living in colonies of 30 to millions of

Introduction • Ants are social insects, living in colonies of 30 to millions of individuals. Ants are not the only social insects living in colonies. The complex behaviors that emerge from colonies of ants have intrigued humans, and there have been many studies of ant colonies aimed at a better understanding of these collective behaviors. • One of the first behaviors studied by entomologists was the ability of ants to find the shortest path between their nest and a food source. Bina Nusantara University 5

Pheromones • Pheromones are chemicals ants place on their trails; they attract other ants.

Pheromones • Pheromones are chemicals ants place on their trails; they attract other ants. • More ants will travel on a shorter trail to a food source— and deposit more pheromones—than on longer trails. The pheromones slowly evaporate over time. Bina Nusantara University 6

Foraging Behavior of Ants • How do ants find the shortest path between their

Foraging Behavior of Ants • How do ants find the shortest path between their nest and food source, without any visible, central, active coordination mechanisms? Studies of the foraging behavior of several species of real ants revealed an initial random or chaotic activity pattern in the search for food. • As soon as a food source is located, activity patterns become more organized with more and more ants following the same path to the food source. “Automagically”, soon all ants follow the same, shortest path. Bina Nusantara University 7

Foraging Behavior of Ants • The recruitment mechanism differs for different species, and can

Foraging Behavior of Ants • The recruitment mechanism differs for different species, and can either be in the form of direct contact, or indirect “communication. ” Most ant species use the latter form of recruitment, where communication is via pheromone trails. • When an ant locates a food source, it carries a food item to the nest and lays pheromone along the trail. Bina Nusantara University 8

Introduction • ACO is a meta-heuristic, meaning that it’s a general framework that can

Introduction • ACO is a meta-heuristic, meaning that it’s a general framework that can be used to create a specific algorithm to solve a specific graph path problem. Although ACO was proposed in a 1991 doctoral thesis by M. Dorigo, the first detailed description of the algorithm is generally attributed to a 1996 follow-up paper by M. Dorigo, V. Maniezzo and A. Colorni. • Since then, ACO has been widely studied and modified, but, somewhat curiously, very few complete and correct implementations are available online. Bina Nusantara University 9

Binary Bridge Experiment • Forager ants decide which path to follow based on the

Binary Bridge Experiment • Forager ants decide which path to follow based on the pheromone concentrations on the different paths. Paths with a larger pheromone concentration have a higher probability of being selected. Bina Nusantara University 10

Binary Bridge Experiment • Initially, both branches were free of any pheromones. After a

Binary Bridge Experiment • Initially, both branches were free of any pheromones. After a finite time period, one of the branches was selected, with most of the ants following the path, even with both branches being of the same length. • The selection of one of the branches is due to random fluctuations in path selection, causing higher concentrations on the one path. • From this experiment, referred to as the binary bridge experiment , a simple formal model was developed to characterize the path selection process. Bina Nusantara University 11

 • Let n. A(t) and n. B(t) denote the number of ants on

• Let n. A(t) and n. B(t) denote the number of ants on paths A and B respectively at time step t. Pasteels et al. found empirically that the probability of the next ant to choose path A at time step t + 1 is given as: • where c quantifies the degree of attraction of an unexplored branch, and α is the bias to using pheromone deposits in the decision process. Bina Nusantara University 12

Introduction Bina Nusantara University 13

Introduction Bina Nusantara University 13

 • The larger the value of c, the more pheromone deposits are required

• The larger the value of c, the more pheromone deposits are required to make the choice of path non-random. It was found empirically that α ≈ 2 and c ≈ 20 provide a best fit to the experimentally observed behavior. • Using the probability defined in equation (17. 1), the decision rule of an ant that arrives at the binary bridge is expressed as follows: if U(0, 1) ≤ PA(t+1) then follow path A otherwise follow path B. Bina Nusantara University 14

 • Goss et al. found that the probability of selecting the shorter path

• Goss et al. found that the probability of selecting the shorter path increases with the length ratio between the two paths. This has been referred to as the differential path length effect by Dorigo et al. • Although an ant colony exhibits complex adaptive behavior, a single ant follows very simple behaviors. An ant can be seen as a stimulus–response agent [629]: the ant observes pheromone concentrations and produces an action based on the pheromonestimulus. • An ant can therefore abstractly be considered as a simple computational agent. Bina Nuantara University 15

Artificial Ant Decision Process • The algorithm is executed at each point where the

Artificial Ant Decision Process • The algorithm is executed at each point where the ant needs to make a decision. Bina Nusantara University 16

Stigmergy and Artificial Pheromone • Stigmergy is a class of mechanisms that mediate animalto-animal

Stigmergy and Artificial Pheromone • Stigmergy is a class of mechanisms that mediate animalto-animal interactions. The term stigmergy was formally defined by Grass´e as a form of indirect communication mediated by modifications of the environment. • This definition originated from observations of the nestbuilding behavior of the termite species Bellicositermes natalensis and Cubitermes. • Grass´e observed that coordination and regulation of nest-building activities are not on an individual level, but achieved by the current nest structure. Bina Nusantara University 17

 • The word stigmergy is aptly constructed from the two Greek words •

• The word stigmergy is aptly constructed from the two Greek words • stigma, which means sign, and • ergon, which means work. • Ant algorithms are population-based systems inspired by observations of real ant colonies. Cooperation among individuals in an ant algorithm is achieved by exploiting the stigmergic communication mechanisms observed in real ant colonies. Bina Nusantara University 18

 • Individuals observe signals, which trigger a specific response or action. The action

• Individuals observe signals, which trigger a specific response or action. The action may reinforce or modify signals to influence the actions of other individuals. • Two forms of stigmergy have been defined: sematectonic and signbased. • Sematectonic stigmergy refers to communication via changes in the physical characteristics of the environment. Example activities that are accomplished through sematectonic stigmergy include nest building, nest cleaning, and brood sorting. Bina Nusantara University 19

Simple Ant Colony Optimization • The first ant algorithm developed was the ant system,

Simple Ant Colony Optimization • The first ant algorithm developed was the ant system, and since then several improvements of the ant system have been devised. These algorithms have somewhat more complex decision processes than that illustrated in Algorithm 17. 1. • To provide a gentle, didactic introduction to ant algorithms, this section breaks the chronological order in which ant algorithms have been developed to first present the simple ACO (SACO). Bina Nusantara University 20

Simple Ant Colony Optimization • The general problem of finding the shortest path between

Simple Ant Colony Optimization • The general problem of finding the shortest path between two nodes on a graph, G = (V, E), where V is the set of vertices (nodes) and E is a matrix representing the connections between nodes. The graph has n. G = |V | nodes. The length, Lk, of the path constructed by ant k is calculated as the number of hops in the path from the origin to the destination node. Bina Nusantara University 21

 • Any of a number of termination criteria can be used in Algorithm

• Any of a number of termination criteria can be used in Algorithm 17. 2 (and for the rest of the ant algorithms discussed later), for example, • terminate when a maximum number of iterations, nt, has been exceeded; • terminate when an acceptable solution has been found, with • terminate when all ants (or most of the ants) follow the same path. Bina Nusantara University 22

 • If ant k is currently located at node i, it selects the

• If ant k is currently located at node i, it selects the next node based on the transition probability • Where is the set of feasible nodes connected to node i, with respect to ant k. If, for any node i and ant k, = ∅, then the predecessor to node i is included in • Note that this may cause loops to occur within constructed paths. These loops are removed once the destination node has been reached. Bina Nusantara University 23

ACO Algorithm Bina Nusantara University 24

ACO Algorithm Bina Nusantara University 24

 • In this case, the demo is solving an instance of the TSP

• In this case, the demo is solving an instance of the TSP with the goal of finding the shortest path that visits each of 60 cities exactly once. • The demo program uses four ants; each ant represents a potential solution. ACO requires the specification of several parameters such as the pheromone influence factor (alpha) and the pheromone evaporation coefficient (rho). • The four ants are initialized to random trails through the 60 cities; after initialization, the best ant has a shortest trail length of 245. 0 units. Bina Nusantara University 25

 • The main processing loop alternates between updating the ant trails based on

• The main processing loop alternates between updating the ant trails based on the current pheromone values and updating the pheromones based on the new ant trails. After the maximum number of times (1, 000) through the main processing loop, the program displays the best trail found and its corresponding length (61. 0 units). Bina Nusantara University 26

 • The 60 -city graph is artificially constructed. There’s no easy way to

• The 60 -city graph is artificially constructed. There’s no easy way to solve the TSP. With 60 cities, assuming you can start at any city and go either forward or backward, and that all cities are connected, there a total of (60 1)! / 2 = 69, 341, 559, 272, 844, 917, 868, 969, 509, 860, 194, 703, 172, 951, 438, 386, 343, 716, 270, 410, 647, 470, 080, 000, 000 possible solutions. 2. 2 * 1063 years !!! Bina Nusantara University 27

Make a graph distance static int[][] Make. Graph. Distances(int num. Cities) { int[][] dists

Make a graph distance static int[][] Make. Graph. Distances(int num. Cities) { int[][] dists = new int[num. Cities][]; for (int i = 0; i < dists. Length; ++i) dists[i] = new int[num. Cities]; for (int i = 0; i < num. Cities; ++i) for (int j = i + 1; j < num. Cities; ++j) { int d = random. Next(1, 9); // [1, 8] dists[i][j] = d; dists[j][i] = d; } return dists; } Bina Nusantara University 28

 • Pheromones are chemicals ants place on their trails; they attract other ants.

• Pheromones are chemicals ants place on their trails; they attract other ants. • More ants will travel on a shorter trail to a food source— and deposit more pheromones—than on longer trails. The pheromones slowly evaporate over time. Here’s method Bina Nusantara University 29

example • The trail starts at city 1, then goes to city 3, and

example • The trail starts at city 1, then goes to city 3, and the update algorithm is determining the next city. Now suppose the pheromone and distance information is as shown in the image. • The first step in determining the next city is constructing an array I’ve called “taueta” (because the original research paper used the Greek letters tau and eta). • The taueta value is the value of the pheromone on the edge raised to the alpha power, times one over the distance value raised to the beta power. Bina Nusantara University 30

 • Recall that alpha and beta are global constants that must be specified.

• Recall that alpha and beta are global constants that must be specified. Here I’ll assume that alpha is 3 and beta is 2. The taueta values for city 1 and city 3 aren’t computed because they’re already in the current trail. Notice that larger values of the pheromone increase taueta, but larger distances decrease taueta. • After all the taueta values have been computed, the next step is to convert those values to probabilities and place them in an array I’ve labeled probs. • The algorithm sums the taueta values, getting 82. 26 in this example, and then divides each taueta value by the sum. Bina Nusantara University 31

 • City 0 has a probability of 0. 09 of being selected and

• City 0 has a probability of 0. 09 of being selected and so on. Next, the algorithm needs to select the next city based on the computed probabilities. The ACO algorithm I’m presenting in this article uses a neat technique called roulette wheel selection. The size of the augmented array is one greater than the probs array, and cell [0] is seeded with 0. 0. • Each cell in cumul is the cumulative sum of the probabilities. After the cumul array has been constructed, a random number p between 0. 0 and 1. 0 is generated. Suppose p = 0. 538 as shown. • That p value falls between the values at [2] and [3] in the cumul array, which means that [2], or city 2, is selected as the next city. Bina Nusantara University 32

Bina Nusantara University 33

Bina Nusantara University 33

 • Updating pheromone information is much easier than updating the ant trail information.

• Updating pheromone information is much easier than updating the ant trail information. The key lines of code in method Update. Phermones are: double length = Length(ants[k], dists); double decrease = (1. 0 - rho) * pheromones[i][j]; double increase = 0. 0; if (Edge. In. Trail(i, j, ants[k]) == true) increase = (Q / length); pheromones[i][j] = decrease + increase; Bina Nusantara University 34

Bina Nusantara University 35

Bina Nusantara University 35

Presentation (each 15 minutes) • Ant colonies for the traveling salesman problem WAWAN YOGI

Presentation (each 15 minutes) • Ant colonies for the traveling salesman problem WAWAN YOGI Bina Nusantara University 36

 • Ant colony Optimization: A Solution of Load balancing in Cloud Adrian Ayu

• Ant colony Optimization: A Solution of Load balancing in Cloud Adrian Ayu Bina Nusantara University 37