700 likes | 736 Views
Explore the framework, operators, and examples of Genetic Algorithms as Evolutionary Computing methodologies in Artificial Intelligence. Learn about population evolution, genetic operators, and problem-solving applications like the Traveling Salesman Problem.
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 Evolutionary Computation
EAs - framework • Based on the idea of evolution Selection Population Parents Reproduction Replacement Offsprings Metaheuristics – From Design to Implementation pp. 199 (Talbi, 2009) Dr. R Qu G54STA/G54SDA – Evolutionary Computing
EAs - framework • Template of an evolutionary algorithm Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms Charles Darwin 1809 - 1882 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms Charles Darwin 1859 Origin of the Species Survival of the Fittest Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms John Holland 1975 Genetic Algorithms Artificial Survival of the Fittest Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms David Goldberg 1989 Genetic Algorithms Foundations and Applications Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms • Compared to exhaustive tree search techniques, modern heuristic algorithms quickly converge to sub-optimal solutions by searching a small fraction of the search space • Simulates the Darwinian evolution process in computer programs. • Populationsevolve by selective pressures, mating between individuals, and alterations such as mutations. • Genetic operators evolve solutions in the current population to create a new population Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Generate Initial Population n = 1 Population Generation 'n' Crossover Population Mutate Population Final Population n = n + 1 Genetic Algorithms Flowchart (20 generations) Selection n<20? Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithms • Evolution of population(a set of solutions) into a new population, using operators: reproduction, mutationandcrossover • Can be implemented as three modules: the evaluation, the populationand the reproductionmodules Dr. R Qu G54STA/G54SDA – Evolutionary Computing
1 1 2 2 Genetic Algorithm Operators Crossover A percentage of the population is selected for breeding and assigned random mates. A random crossover point is selected and a pair of new solutions are produced Adapted from Prof Graham Kendall’s G5BAIM lecture example
Genetic Algorithm Operators Mutation In a small percentage of the population random changes are made. May be designed to conduct more complex operations (local search) accordingly. Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Crossover probability, PC = 1.0 Mutation probability, PM = 0.0 x can be represented using five binary digits Adapted from Dr Graham Kendall’s G5BAIM lecture example Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Generating random initial population Dr. R Qu G54STA/G54SDA – Evolutionary Computing
P3 P4 P2 P2 1 0 0 0 0 1 0 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 C1 C3 C2 C4 Genetic Algorithm Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Choose two parents (roulette selection) One point crossover (random position 1) Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 New generation Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example I • Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 • 0 <= x <= 31 • Two generations • Mutation • What problem do you see with the populations? Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example II • Traveling Salesman Problem (TSP) • 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? Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example II Traveling Salesman Problem Dr. R Qu G54STA/G54SDA – Evolutionary Computing
P1 P2 5 9 9 8 84 78 81 1 11 8 16 32 36 7 27 1 27 7 44 24 … … … 54 24 19 … 67 … … P30 Genetic Algorithm Example II Initial generation 6.5 7.8 … 6.0 Any idea of other ways to generate the initial population? Dr. R Qu G54STA/G54SDA – Evolutionary Computing
P2 C2 8 9 9 9 9 78 78 8 1 1 81 16 16 11 11 81 7 36 27 7 27 7 7 36 … … 44 24 24 … … 44 … … 19 24 … … 19 24 P30 C1 Genetic Algorithm Example II Choose pairs of parents 6.0 7.8 Crossover 13 5.9 6.2 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
P30 P2 78 7 9 5 9 8 11 8 1 10 16 81 7 27 76 7 36 2 24 … 4 … 44 … 24 … … … 19 79 P1 Genetic Algorithm Example II Next generation 5.9 6.2 … 6.0 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example II • Traveling Salesman Problem • No. of cities: 100 • Population size: 30 Cost: 6.37 Generation: 88 Cost: 6.34 Generation: 1100 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example III Applying Genetic Algorithms to Personnel Scheduling Personnel scheduling in healthcare is usually a very complex operation which has a profound effect upon the efficient usage of expensive resources. E.K. Burke, T. Curtois, R. Qu and G. Vanden Berghe. "A Time Predefined Variable Depth Search for Nurse Rostering". INFORMS Journal on Computing, 2012. doi: 10.1287/ijoc.1120.0510 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Genetic Algorithm Example III • shift coverage • one shift per day • resting time • workload per month • consecutive shifts • working weekends • … A number of nurses A number of shifts each day A set of constraints
Genetic Algorithm Example III • Genetic Algorithm • Initial population • construct rosters • repair infeasible ones Dr. R Qu G54SAI – Evolutionary Algorithms
Genetic Algorithm Example III • Genetic Algorithm • Select parents • Recombine rows in the two rosters • repair infeasible ones +
Genetic Algorithm Example III • Genetic Algorithm • Mutation • Local optimiser Dr. R Qu G54SAI – Evolutionary Algorithms
Genetic Algorithm Example III Population Size Crossover Probability Mutation Probability Local Optimiser 50 0.7 0.001 ON Dr. R Qu G54STA/G54SDA – Evolutionary Computing
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 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
GA - Conclusions • Survival of the fittest, the most fit of a particular generation (the best possible answer) are used as parents for the next generation. • GAs are a very powerful tool, allowing searching for solutions when there are no other feasible means to do so. • More advanced evolutionary algorithms emerged in the last two decades. Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Evolutionary Algorithms • Evaluation is responsible for evaluating the fitness of individuals in the population • It is the only part of the GA that has any knowledge about the specific problem. The rest of the GA modules are simply operating on chromosomes with no information about the problem. • A different evaluation module is needed for each problem. Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Evolutionary Algorithms • Conceivable solutions are represented, the 'fittest' will have the greatest chance of reproducing. • Successful properties will therefore be favourably represented within the population of solutions. • The population is successively 'optimised' after a number of generations. Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Evolutionary Algorithms • Representation • Population • Objective function • Selection • Replacement • Stopping Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Estimation of Distribution Algorithms (EDA) Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Initial Population Generation n = 1 Build probability model Final Population n = n + 1 EDA Flowchart (20 generations) Selection of better individuals Sample model to generate new individuals New Population n<20? Dr. R Qu G54STA/G54SDA – Evolutionary Computing
EDA • A recent class of population based metaheuristics • Uses probability distribution of the population • Statistical information extracted from the population used to generate the next population • Probability model (vector) • Replaces the genetic operators to evolve the population Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Template of an EDA Adapted from Metaheuristics – From Design to Implementation pp. 223 (Talbi, 2009) Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Template of a PBIL Adapted from Metaheuristics – From Design to Implementation pp. 224 (Talbi, 2009) Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 x represented using 5 binary digits Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Generating initial population based on Evaluate the population Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Update the PV based on Xbest D = (1-α)D + αXbest Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example I Maximise f(x) = x^3 - 60 * x^2 + 900 * x +100 0 <= x <= 31 Generating new population based on D = (1-α)D + αXbest Mutation in GA vs. Randomness in PBIL Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example II • Portfolio Selection Problem • Given a set of assets (stocks, etc.) and their associated return and risk • What’s the best investmentplan (i.e. which assets tochoose to achieve the highestreturn and lowest risk)? Mathworks
PBIL Example II • Portfolio Selection Problem • Modern Portfolio Theory • Nobel memorial prize winner Harry Markowitz • Diversification: “don’tput all your eggs intoone basket” • Which assets to choose? • How much to invest toeach asset? • Real world constraints Asset Allocation and Portfolio Optimization, Mathworks
PBIL Example II • Portfolio Selection Problem • Which assets to choose? • A binary vector of size nn: number of assets • How much to invest to each asset? • A real vector of size n, n: number of assets • Additional constraints • Cardinality: a limited number of assets • Boundary: a lower and upper bound of investment to the assets K. Lwin, R. Qu. "Hybrid Algorithm for Constrained Portfolio Selection Problem". Applied Intelligence, 39(2): 251-266, 2013. doi: 10.1007/s10489-012-0411-7 Dr. R Qu G54STA/G54SDA – Evolutionary Computing
PBIL Example II • Portfolio Selection Problem • Evaluation function • Return: combined return based on historical data • Risk: combined risk (variance of return) of all chosen assets • Constraint handling • Cardinality • Boundaries Dr. R Qu G54STA/G54SDA – Evolutionary Computing
Evolutionary Algorithm Applications Combinatorial optimisation problems • bin packing problems • vehicle routing problems • job shop scheduling
Evolutionary Algorithm Applications Combinatorial optimisation problems • portfolio optimization • multimedia multicast routing • knapsack problem
appendix Other Evolutionary Algorithms Dr. R Qu G54STA/G54SDA – Evolutionary Computing