630 likes | 770 Views
Artificial Intelligence Search Methodologies. Dr Rong Qu School of Computer Science University of Nottingham Nottingham, NG8 1BB, UK rxq@cs.nott.ac.uk Population Based Algorithms. Optimisation Problems : Methods. Meta-heuristics
E N D
Artificial Intelligence Search Methodologies Dr Rong Qu School of Computer Science University of Nottingham Nottingham, NG8 1BB, UK rxq@cs.nott.ac.uk Population Based Algorithms
Optimisation Problems: Methods • Meta-heuristics • Guide an underlying heuristic/search to escape from being trapped in a local optima and to explore better areas of the solution space • Single solution approaches • Simulated Annealing, Tabu Search, Variable Neighbourhood Search, etc.; • Population based approaches • Genetic algorithm, Memetic algorithm, Ant Algorithms, Particle Swarm Intelligence, etc.; AI Search Algorithms – Population Based
Population Based Algorithms • Local search • Concerning only one solution at a particular time during the search • Search is very much restricted to local regions, so called local • Population based algorithms • concern a population of solutions at a time AI Search Algorithms – Population Based
Charles Darwin 1809 - 1882 Genetic algorithms AI Search Algorithms – Population Based
GA Algorithm – basic idea • Based on survival of the fittest • Algorithm uses terms from genetics: population, chromosome and gene • Developed extensively by John Holland in mid 70’s • Three modules • the evaluation module, the population module and the reproduction module • Solutions (individuals) often coded as bit strings AI Search Algorithms – Population Based
GA Algorithm – basic idea Charles Darwin 1859 Origin of the Species Survival of the Fittest AI Search Algorithms – Population Based
GA Algorithm – basic idea John Holland 1975 Genetic Algorithms Artificial Survival of the Fittest AI Search Algorithms – Population Based
GA Algorithm – basic idea David Goldberg 1989 Genetic Algorithms Foundations and Applications AI Search Algorithms – Population Based
GA Algorithm – basic steps • Initial population • Evaluations on individuals • Breeding • Choose suitable parents (proportion to evaluation rating) • Produce two offspring (Probability of breeding) • Mutation Domain knowledge – evaluation function AI Search Algorithms – Population Based
GA Algorithm – basic steps 1. Initialise a population of chromosomes Ci 2. Evaluate each Ci (individual) in the population Create new C by using Ci in the current population (using crossover and mutation) Delete members of the existing population to make way for the new members Evaluate the new members and insert them into the population Repeat (evolve) until some termination condition is reached (normally based on time or number of populations produced) 3. Return the best Ci as the solution AI Search Algorithms – Population Based
Generate Initial Population n = 1 Population Generation 'n' Crossover Population Mutate Population Final Population n = n + 1 GA Algorithm – basic steps Selection n<20? AI Search Algorithms – Population Based
5 1 4 2 3 4 1 GA Algorithm – encoding The decision variables of a problem are normally encoded into a finite length string This could be a binary string or a list of integers For example : or 0 1 1 0 1 1 0 1 0 We could also represent numbers as coloured boxes AI Search Algorithms – Population Based
Evaluation Module • Responsible for evaluating a chromosome • Only part of the GA that has domain knowledge. The rest of the GA modules are simply operating on (typically) bit strings with no information about the problem • A different evaluation module is needed for each problem AI Search Algorithms – Population Based
Population Module • Responsible for maintaining the population • Initialization • Random • Known Solutions • Heuristics • Population Size • Elitism AI Search Algorithms – Population Based
Population Module • Deletion • Delete-All : replaces all the members of the current population by the same number of chromosomes created • Steady-State : replaces n old members by n new members.But: replace the worst, random or the parents individuals? • Steady-State-No-Duplicates : Same as steady-state but also checks that no duplicate chromosomes are added to the population. AI Search Algorithms – Population Based
Reproduction Module • Parent selection • Fitness techniques • Crossover & mutation AI Search Algorithms – Population Based
Parent Selection • Roulette Wheel Selection • Select the parents with a probability in proportion to their fitness • Tournament • Select two individuals at random. The individual with the highest evaluation becomes the parent. Repeat to find a second parent AI Search Algorithms – Population Based
Fitness Techniques • Fitness-Is-Evaluation : Simply use the fitness of the chromosome equal to its evaluation • Linear Normalization : The chromosomes are sorted by decreasing the evaluation value. Then the chromosomes are assigned a fitness value that starts with a constant value and decreases linearly. The initial value and the decrement are parameters to the techniques AI Search Algorithms – Population Based
Crossover Operators Order based crossover Cycle crossover Partially matched crossover AI Search Algorithms – Population Based
Mutation • A method of ensuring premature convergence does not occur • Usually set to a small value • Dynamic mutation and crossover rates AI Search Algorithms – Population Based
Example I • Crossover probability, PC = 1.0 • Mutation probability, PM = 0.0 • Maximise f(x) = x3 - 60 * x2 + 900 * x +100 • 0 <= x >= 31 • x can be represented using five binary digits AI Search Algorithms – Population Based
Example I • Generate random initial individuals Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 (0 <= x <= 31) AI Search Algorithms – Population Based
P3 P4 P2 P2 0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 C1 C3 C2 C4 Example I • Choose Parents, using roulette wheel selection • Crossover point, 1, is chosen randomly AI Search Algorithms – Population Based
Example I New generation Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 (0 <= x <= 31) AI Search Algorithms – Population Based
Example I what chance is there of finding the global optimum? Two generations Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 (0 <= x <= 31) Mutation What problem do you see with the populations? AI Search Algorithms – Population Based
GA - performance • There are a number of factors which affect the performance of a genetic algorithm • The size of the population • The initial population • Selection pressure (elitism, tournament) • The cross-over probability • The mutation probability • Defining convergence • Local optimisation AI Search Algorithms – Population Based
GA - applications • Combinatorial optimisation problems • Cutting and packing problems • vehicle routing problems • job shop scheduling AI Search Algorithms – Population Based
GA - applications • Combinatorial optimisation problems • portfolio optimization • multimedia multicast routing • knapsack problem AI Search Algorithms – Population Based
Ant algorithms Ants are practically blind but they still manage to find their way to and from food. How do they do it? AI Search Algorithms – Population Based
Ant Algorithms • 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 AI Search Algorithms – Population Based
H B G F E D A C Ant Algorithms AI Search Algorithms – Population Based
F d=1 D d=1 d=0.5 C E d=0.5 d=1 B d=1 A Ant Algorithms AI Search Algorithms – Population Based
Ant Algorithms • Time, t, is discrete • At each time unit an ant moves a distance, d of 1 • Once an ant moved, it lays down 1 unit of pheromone • At t = 0, there is no pheromone on any edge AI Search Algorithms – Population Based
F 1 1 D 0.5 C E 0.5 1 B 1 A Ant Algorithms At t=1 there will be 16 ants at B and 16 ants at D. At t=2 there will be 8 ants at D and 8 ants at B. There will be 16 ants at E The intensities on the edges will be as followsFD = 16, AB = 16, BE = 8, ED = 8, BC = 16 and CD = 16 16 ants are moving from A - F and another 16 are moving from F - A AI Search Algorithms – Population Based
Ant Algorithms • We need to allow the ants to explore paths and follow the best paths with some probabilityin 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 sub-optimal (and probably very sub-optimal) solution AI Search Algorithms – Population Based
Ant Algorithms • 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” AI Search Algorithms – Population Based
Ant Algorithms – initial ideas • Dorigo (1996) • 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. AI Search Algorithms – Population Based
Ant Algorithms – initial ideas • Dorigo (1996) • 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. AI Search Algorithms – Population Based
Ant Algorithms – initial ideas • Dorigo (1996) • 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. AI Search Algorithms – Population Based
Ant Algorithms – initial ideas • Dorigo (1996) • 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. AI Search Algorithms – Population Based
Ant Algorithms AI Search Algorithms – Population Based
Ant Algorithms - TSP • At the start of the algorithm, one ant is placed in each city • Time, t, is discrete. t(0) marks the start of the algorithm. At t+1 every ant will have moved to a new city • Assuming that the TSP is represented as a fully connected graph, each edge has an intensity of trailon it. This represents the pheromone trail laid by the ants • Let Ti,j(t) represent the intensity of trail edge (i,j) at time t Variations have been tested by Dorigo AI Search Algorithms – Population Based
Ant Algorithms - TSP • An ant decides which town to move to next, with a probability that is based on the distanceto that city AND the amount of trail intensityon the connecting edge • The distance to the next town, is known as the visibility, nij, defined as 1/dij, dij is the distance between cities i and j. • At each time unit evaporation takes place, at a rate p, a value between 0 and 1 Variations have been tested by Dorigo AI Search Algorithms – Population Based
Ant Algorithms - TSP • In order to stop ants visiting the same city in the same tour a data structure, Tabu, is maintained • Tabuk is defined as the list for the kth ant and it holds the cities that have already been visited Variations have been tested by Dorigo AI Search Algorithms – Population Based
Ant Algorithms - TSP After each ant tour the trail intensity on edge (i,j) is updated using the following formula Tij (t + n) = p . Tij(t) + ΔTij Q is a constant Lk is the tour length of the kth ant p is the evaporation coefficient AI Search Algorithms – Population Based
Ant Algorithms - TSP Transition Probability where and are control parameters that control the relative importance of trail versus visibility AI Search Algorithms – Population Based
Ant Algorithms - TSP Left: Trail distribution at the beginning; Right: Trail distribution after 100 cycles. (Dorigo et al., 1996) AI Search Algorithms – Population Based
Ant Algorithms - Applications • Travelling Salesman Problem (TSP) • Facility Layout Problem • Vehicle Routing • Stock Cutting • … • Marco Dorigo maintains a page devoted to the subject at • http://iridia.ulb.ac.be/~mdorigo/ACO/ACO.html • contains information about ant algorithms as well as links to the main papers published on the subject AI Search Algorithms – Population Based
appendix Examples of Genetic Algorithms AI Search Algorithms – Population Based
Genetic Algorithm Example II • Traveling Salesman Problem • a number of cities • costs of traveling between cities • a traveling sales man needs to visit all these cities exactly once and return to the starting city • What’s the cheapest route? AI Search Algorithms – Population Based