Lecture 15: Genetic Algorithms

Similar documents
Lecture 9 Evolutionary Computation: Genetic algorithms

Lecture 22. Introduction to Genetic Algorithms

Computational statistics

Chapter 8: Introduction to Evolutionary Computation

Fall 2003 BMI 226 / CS 426 LIMITED VALIDITY STRUCTURES

CSC 4510 Machine Learning

Evolutionary Computation: introduction

Scaling Up. So far, we have considered methods that systematically explore the full search space, possibly using principled pruning (A* etc.).

Local Search & Optimization

Crossover Techniques in GAs

Stochastic Search: Part 2. Genetic Algorithms. Vincent A. Cicirello. Robotics Institute. Carnegie Mellon University

Methods for finding optimal configurations

Artificial Intelligence Methods (G5BAIM) - Examination

Adaptive Generalized Crowding for Genetic Algorithms

Fundamentals of Genetic Algorithms

Genetic Algorithms & Modeling

Genetic Algorithms. Donald Richards Penn State University

Local Beam Search. CS 331: Artificial Intelligence Local Search II. Local Beam Search Example. Local Beam Search Example. Local Beam Search Example

Intelligens Számítási Módszerek Genetikus algoritmusok, gradiens mentes optimálási módszerek

Evolutionary Computation

how should the GA proceed?

Development. biologically-inspired computing. lecture 16. Informatics luis rocha x x x. Syntactic Operations. biologically Inspired computing

Genetic Algorithm. Outline

Evolutionary computation

Matt Heavner CSE710 Fall 2009

Search. Search is a key component of intelligent problem solving. Get closer to the goal if time is not enough

Local Search & Optimization

Genetic Algorithm approach to Solve Shortest Path and Travelling Salesman Problem

Havrda and Charvat Entropy Based Genetic Algorithm for Traveling Salesman Problem

I N N O V A T I O N L E C T U R E S (I N N O l E C) Petr Kuzmič, Ph.D. BioKin, Ltd. WATERTOWN, MASSACHUSETTS, U.S.A.

DETECTING THE FAULT FROM SPECTROGRAMS BY USING GENETIC ALGORITHM TECHNIQUES

Genetic Algorithms: Basic Principles and Applications

Artificial Intelligence Methods (G5BAIM) - Examination

TUTORIAL: HYPER-HEURISTICS AND COMPUTATIONAL INTELLIGENCE

Evolutionary computation

What is Natural Selection? Natural & Artificial Selection. Answer: Answer: What are Directional, Stabilizing, Disruptive Natural Selection?

Genetic Algorithm for Solving the Economic Load Dispatch

Genes and DNA. 1) Natural Selection. 2) Mutations. Darwin knew this

CS 331: Artificial Intelligence Local Search 1. Tough real-world problems

V. Evolutionary Computing. Read Flake, ch. 20. Genetic Algorithms. Part 5A: Genetic Algorithms 4/10/17. A. Genetic Algorithms

[Read Chapter 9] [Exercises 9.1, 9.2, 9.3, 9.4]

Evolutionary Design I

Biology 11 UNIT 1: EVOLUTION LESSON 2: HOW EVOLUTION?? (MICRO-EVOLUTION AND POPULATIONS)

GENETIC ALGORITHM FOR CELL DESIGN UNDER SINGLE AND MULTIPLE PERIODS

The two questions we re trying to answer today: 1) How did life on Earth form? 2) How did life on Earth become so diverse?

Parallel Genetic Algorithms

Evolutionary Algorithms: Introduction. Department of Cybernetics, CTU Prague.

Data Structures in Java

Evolutionary Algorithms: Introduction. The Czech Institute of Informatics, Robotics and Cybernetics CTU Prague

The Role of Crossover in Genetic Algorithms to Solve Optimization of a Function Problem Falih Hassan

1.1.4 A Little Biology

APES C4L2 HOW DOES THE EARTH S LIFE CHANGE OVER TIME? Textbook pages 85 88

V. Evolutionary Computing. Read Flake, ch. 20. Assumptions. Genetic Algorithms. Fitness-Biased Selection. Outline of Simplified GA

Multi-objective genetic algorithm

IV. Evolutionary Computing. Read Flake, ch. 20. Assumptions. Genetic Algorithms. Fitness-Biased Selection. Outline of Simplified GA

Chapter 5 Evolution of Biodiversity

Genetic Algorithms and Genetic Programming Lecture 17

Evolutionary Algorithms

Metaheuristics and Local Search

Efficiency Improvement of PM Disc Motor Using Genetic Algorithm

arxiv:cs/ v1 [cs.ne] 4 Mar 2004

Metaheuristics and Local Search. Discrete optimization problems. Solution approaches

22c:145 Artificial Intelligence

Reproduction- passing genetic information to the next generation

4. Identify one bird that would most likely compete for food with the large tree finch. Support your answer. [1]

Cellular automata are idealized models of complex systems Large network of simple components Limited communication among components No central

Intro to Contemporary Math

Overview. Optimization. Easy optimization problems. Monte Carlo for Optimization. 1. Survey MC ideas for optimization: (a) Multistart

First go to

Evolutionary Computation. DEIS-Cesena Alma Mater Studiorum Università di Bologna Cesena (Italia)

Local search algorithms. Chapter 4, Sections 3 4 1

Finding optimal configurations ( combinatorial optimization)

Other Organisms (Part 3)

Genetic Changes Lesson 2 HW

Sexual and Asexual Reproduction. Cell Reproduction TEST Friday, 11/13

Introduction to population genetics & evolution

Local Search (Greedy Descent): Maintain an assignment of a value to each variable. Repeat:

Available online at ScienceDirect. Procedia Computer Science 20 (2013 ) 90 95

True or False? Lamarck s Theory of Evolution. Jean-Baptiste Pierre Antoine de Monet, Chevalier de Lamarck

Regents Biology REVIEW 6: EVOLUTION. 1. Define evolution:

Reinforcement Learning: Part 3 Evolution

Local and Stochastic Search

Unit 1A: Computational Complexity

Science Home Learning Task. Year 9. Adaptation and Inheritance

Genetic Algorithms. Seth Bacon. 4/25/2005 Seth Bacon 1

Lesson 10 Study Guide

CSC 421: Algorithm Design & Analysis. Spring 2018

2. Overproduction: More species are produced than can possibly survive

Evolution Unit: What is Evolution?

Genetic Engineering and Creative Design

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

A.I.: Beyond Classical Search

EXPLORING THE RELATIONSHIP OF THE CLOSENESS OF A GENETIC ALGORITHM S CHROMOSOME ENCODING TO ITS PROBLEM SPACE

Learning Objectives:

Outline of lectures 3-6

Mechanisms of Evolution

Parallel Genetic Algorithms. Master s Thesis Laurens Jan Pit 30/08/95 Department of Computer Science Leiden University

Warm-up Find the shortest trip (total distance) starting and ending in Chicago and visiting each other city once.

DO NOW. Each PAIR should take one white cloth and one cup of beans from the back desk. Make sure you have 20 white beans and 20 brown beans.

INVARIANT SUBSETS OF THE SEARCH SPACE AND THE UNIVERSALITY OF A GENERALIZED GENETIC ALGORITHM

Transcription:

Lecture 15: Genetic Algorithms Dr Roman V Belavkin BIS3226 Contents 1 Combinatorial Problems 1 2 Natural Selection 2 3 Genetic Algorithms 3 31 Individuals and Population 3 32 Fitness Functions 3 33 Encoding Genes of an Individual 4 34 Selection, Crossover and Mutation 5 35 GA Algorithm 6 4 Discussion 6 5 Problem Example 7 1 Combinatorial Problems The Travelling Salesman Problem A salesman goes on a tour around several cities visited only once What is the shortest tour? Each city has to be The problem becomes harder if we increase the number of cities (n = 4, 5, ) 2 Moscow 2? Hong-Kong Hong-Kong Hong-Kong Remark 1 Mathematicians calculated that for n cities the number of possible tours is: (n 1)! (eg for n = 10, (10 1)! = 9! = 362, 880) 1

The Timetabling Problem Problem of balancing the resources (teachers, rooms) so that all teaching is done and students can take sensible combinations of courses The input variables are teachers, rooms and time slots There are many more objectives: Teachers can only be at one place at one time Rooms can only be used by one teacher Each teacher can only teach certain subjects Subject clashes must be minimal Rooms must be big enough for all students All subjects must be taught to all registered students Summary There are problems for which there are no clear methods of finding an optimal (best) solution Some problems seem to have only one way of finding a solution: by random search These are so-called combinatorial problems The difficulty is that many tasks have so many possible combinations, that it is simply impossible to try all of them Various search methods and heuristics have been developed to tackle such problems Genetic Algorithms is one of such techniques that was inspired by the laws of natural evolution 2 Natural Selection Natural Selection Living organisms are fighting the forces of nature to survive Those who are the fittest (ie strongest, fastest, biggest) are more likely to survive Charles Darwin 2

Those who survive (the fittest) mate and reproduce (selection) Children are similar (inheritance), but not exactly like the parents because of cross-fertilisation and mutation Thus, children can be either less or more fit than their parents Children repeat the path of their parents After several generations the organisms become much fitter than at the beginning 3 Genetic Algorithms 31 Individuals and Population Solutions as Individuals in Population Suppose that there are many possible solutions for the problem: x 1, x 2,,x n The main idea of GA is to view each solution x i of the problem as an individual living organism The number of all possible solutions for the problem can be incredibly large (more than atoms in the universe) So, we consider only a relatively small number m n of them We shall call a collection of m solutions at the current time moment a population P (t) = {x t 1,, x t m} With time the individuals (like organisms) and the whole population will be evolving So, time t here simply describes the generation of the population and its individuals 32 Fitness Functions Fitness Function Fitness function is simply another word for the utility function f : X R It is needed to compare different solutions (individuals) and choose the better ones As with utility, it returns a number such that f(x 1 ) f(x 2 ) if and only if x 1 is preferable to x 2 (x 1 is fitter ) Fitness f(x) x 1 x 4 Maximum fitness x 2 x 5 x 6 Population P (t) = {x t 1,, xt 6 } x 3 Individuals x i 3

Example We can choose the tours by comparing their lengths Hong-Kong Thus, fitness is f(x) = length(x) and x 2 2 Hong-Kong x 1 length(x 1 ) < length(x 2 ) f(x 1 ) > f(x 2 ) So, we choose x 1 GA and the Choice Problem Problems, solved by GA (eg TSP, timetable, etc), are the choice problems (Indeed, we have preference between different solutions, there is a fitness function, which acts as a utility) The GA problems, however, usually have astronomically large choice sets It is not clear how to find the optimal solution other then by searching through all possible combinations GA is a very sophisticated parallel search algorithm that uses a special representation of solutions (encoding), a mixture of stochastic (random mutation) and deterministic (crosover and inheritance) variations of solutions Result: it saves time 33 Encoding Genes of an Individual Encoding Genes of an Individual Before we can start GA we need to represent each individual by its genes This is probably the biggest challenge in GA Identify the simplest elements (building blocks) of which a solution may consist, and assign a letter (or a number) to each element We shall call each letter a gene The number of these simplest elements (and hence the genes) is finite and not very large For example, in DNA there are only four kinds of genes: A, G, T and C We shall call the collection of all these letters an alphabet of the algorithm This way a solution x i is represented by a string of genes We shall call this string a chromosome of an individual 4

Example: TSP For the Travelling Salesman Problem the genes may represent different cities, and the chromosomes represent different routes: L C H Hong-Kong T 2 Hong-Kong Hong-Kong x 1 = LCHT L x 2 = LCT HL Example: Timetabling We can assign numbers to a teacher, to a time slot and to a room: Number Teacher Time Room 1 Prof Newell 9:00am Room B48 2 Dr Ritter 11:00am Room C52 3 Prof Wood 1:00pm Each gene will be a sequence of three numbers, such as 132 means Prof TeacherTime Room Gene Newell teaches at 1:00pm in Room C52 Chromosome 34 Selection, Crossover and Mutation Selection After the fitness of the individuals of the whole population has been calculated, we should pick some of them for reproduction This process is called selection There are several strategies for selction For example a roulette wheel selection, when individuals are selected randomly with probability proportional to their fitness Ranked selction is when we select only the few fittest individuals If the size of the population remains the same in all generations, then not all individuals will be allowed to reproduce This is because usually the fitter reproduce more 5

Crossover The selcted parents are grouped in pairs in order to produce their offspring (children) Crossover is an operation of replacing some genes in one parent by the corresponding genes of the other Thus, each child becomes an offsring of two parents There are many ways to do the crossover, such as the one-point crossover For example, one-point crossover at point 3: P 1 = 1 0 1 0 0 1 0 P 2 = 0 1 1 1 0 0 1 O 1 = 1 0 1 1 0 0 1 O 2 = 0 1 1 0 0 1 0 Mutation A randomly chosen gene (or several genes) is changed to some other gene (mutate) For example, mutation of genes 3 and 5 in the offspring O 1 will give: O 1 = 1 0 1 1 0 0 1 O 1 = 1 0 0 1 1 0 1 Mutation helps to add diversity to the population It works as a random experimentation Mutation can help the population to avoid local maximum The process of mutation may occure at variable rate Some problems cannot be solved at all without mutation 35 GA Algorithm Summary of Genetic Algorithm After the crossover and mutation operations the new generation may have individuals which are even fitter than their parents (ie better solutions of the problem) The process is repeated for several generations untill a good enough solutions is found 1 Define fitness function; 2 Encode solutions; 3 Choose initial (random) population; 4 Repeat Evaluate fitnesses of all the individuals in the population; Select the best individuals for reproduction; Create new generation by mutation and crossover; 5 Until the optimal or a sufficiently good solution is found 6

4 Discussion Why GA Work? In each generation we check several solutions at once Thus GA is a kind of a parallel search Fitness and selection filter out bad solutions from good ones Offspring inherit properties of mostly good solutions Variations in GA Different selection strategies: selection roulette wheel, ranked, tournament Different forms of the crossover operator: two-point, uniform Static or variable population size Variable mutation rates Some good parts of the chromosomes may be kept intact usually called schemas They are Some very good individuals may survive for several generations (elitism) Application of GA Transport scheduling Timetabling Circuit design Route optimisation (TSP) Remark 2 For some classes of problems there are other specific methods that can perform better than GA on these problems However, when no special method is known for your problem, then try GA and see if it can give you a good result GA are easily programmable and can be applied to a wide range of problems 7

5 Problem Example Problem Example Consider a GA with chromosomes consisting of six genes x i = abcdef, and each gene is a number between 0 and 9 Suppose we have the following population of four chromosomes: x 1 = 4 3 5 2 1 6 x 2 = 1 7 3 9 6 5 x 3 = 2 4 8 0 1 2 x 4 = 9 0 8 1 2 3 and let the fitness function be f(x) = (a + c + e) (b + d + f) 1 Sort the chromosomes by their fitness 2 Do one-point crossover in the middle between the 1st and 2nd fittest, and two-points crossover (points 2, 4) for the 2nd and 3rd 3 Calculate the fitness of all the offspring Solution 1 Apply the fitness function f(x) = (a + c + e) (b + d + f): So, the order is x 4, x 3, x 1 and x 2 f(x 1 ) = (4 + 5 + 1) (3 + 2 + 6) = 1 f(x 2 ) = (1 + 3 + 6) (7 + 9 + 5) = 11 f(x 3 ) = (2 + 8 + 1) (4 + 0 + 2) = 5 f(x 4 ) = (9 + 8 + 2) (0 + 1 + 3) = 15 Solution 2 One-point crossover in the middle between x 4 and x 3 : x 4 = 9 0 8 1 2 3 x 3 = 2 4 8 0 1 2 O 1 = 9 0 8 0 1 2 O 2 = 2 4 8 1 2 3 Two-point crossover at points 2 and 4 between x 3 and x 1 : x 3 = 2 4 8 0 1 2 x 1 = 4 3 5 2 1 6 O 3 = 2 4 5 2 1 2 O 4 = 4 3 8 0 1 6 Solution 3 Again, apply the fitness function f(x) = (a + c + e) (b + d + f): f(o 1 ) = (9 + 8 + 1) (0 + 0 + 2) = 16 f(o 2 ) = (2 + 8 + 2) (4 + 1 + 3) = 4 f(o 3 ) = (2 + 5 + 1) (4 + 2 + 2) = 0 f(o 4 ) = (4 + 8 + 1) (3 + 0 + 6) = 4 Has the fitness of the new population improved? 8