Department of Computer Science Lecture 6: Genetic Algorithms https://sites.google.com/site/mtsiddiquecs/ai.

Slides:



Advertisements
Similar presentations
CS6800 Advanced Theory of Computation
Advertisements

CSM6120 Introduction to Intelligent Systems Evolutionary and Genetic Algorithms.
Tuesday, May 14 Genetic Algorithms Handouts: Lecture Notes Question: when should there be an additional review session?
Genetic Algorithms Representation of Candidate Solutions GAs on primarily two types of representations: –Binary-Coded –Real-Coded Binary-Coded GAs must.
1 Wendy Williams Metaheuristic Algorithms Genetic Algorithms: A Tutorial “Genetic Algorithms are good at taking large, potentially huge search spaces and.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
Evolutionary Computational Intelligence
1 Genetic Algorithms. CS The Traditional Approach Ask an expert Adapt existing designs Trial and error.
Genetic Algorithms (GAs)
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
1 Genetic Algorithms. CS 561, Session 26 2 The Traditional Approach Ask an expert Adapt existing designs Trial and error.
Genetic Algorithms Nehaya Tayseer 1.Introduction What is a Genetic algorithm? A search technique used in computer science to find approximate solutions.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Genetic Algorithms Overview Genetic Algorithms: a gentle introduction –What are GAs –How do they work/ Why? –Critical issues Use in Data Mining –GAs.
Genetic Algorithms: A Tutorial
Heuristic Optimization Methods
Prepared by Barış GÖKÇE 1.  Search Methods  Evolutionary Algorithms (EA)  Characteristics of EAs  Genetic Programming (GP)  Evolutionary Programming.
Genetic Algorithm.
Genetic Algorithms and Ant Colony Optimisation
Evolutionary Intelligence
1 An Overview of Evolutionary Computation 조 성 배 연세대학교 컴퓨터과학과.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Intro. ANN & Fuzzy Systems Lecture 36 GENETIC ALGORITHM (1)
Genetic algorithms Prof Kang Li
Optimization in Engineering Design Georgia Institute of Technology Systems Realization Laboratory Mixed Integer Problems Most optimization algorithms deal.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
Genetic Algorithms Michael J. Watts
Warm-up Activity 1. How many frames are in a Pixar animated movie such as The Incredibles?
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
Introduction to GAs: Genetic Algorithms How to apply GAs to SNA? Thank you for all pictures and information referred.
1 Genetic Algorithms “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations.
Applying Genetic Algorithm to the Knapsack Problem Qi Su ECE 539 Spring 2001 Course Project.
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
Local Search: walksat, ant colonies, and genetic algorithms.
1 “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions.
Derivative Free Optimization G.Anuradha. Contents Genetic Algorithm Simulated Annealing Random search method Downhill simplex method.
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
A Simple Example The Traveling Salesman Problem: Find a tour of a given set of cities so that each city is visited only once the total distance traveled.
Evolution Programs (insert catchy subtitle here).
1 Genetic Algorithms and Ant Colony Optimisation.
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
Voicu Groza, 2008 SITE, HARDWARE/SOFTWARE CODESIGN OF EMBEDDED SYSTEMS 1 Hardware/Software Codesign of Embedded Systems OPTIMIZATION Voicu Groza.
Edge Assembly Crossover
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
Genetic Algorithms. 2 Overview Introduction To Genetic Algorithms (GAs) GA Operators and Parameters Genetic Algorithms To Solve The Traveling Salesman.
Evolutionary Algorithms K. Ganesh Research Scholar, Ph.D., Industrial Management Division, Humanities and Social Sciences Department, Indian Institute.
Chapter 12 FUSION OF FUZZY SYSTEM AND GENETIC ALGORITHMS Chi-Yuan Yeh.
Genetic Algorithms. The Basic Genetic Algorithm 1.[Start] Generate random population of n chromosomes (suitable solutions for the problem) 2.[Fitness]
Waqas Haider Bangyal 1. Evolutionary computing algorithms are very common and used by many researchers in their research to solve the optimization problems.
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
Introduction to GAs: Genetic Algorithms Quantitative Analysis: How to make a decision? Thank you for all pictures and information referred.
Genetic Algorithms. Underlying Concept  Charles Darwin outlined the principle of natural selection.  Natural Selection is the process by which evolution.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Genetic Algorithms. Solution Search in Problem Space.
EVOLUTIONARY SYSTEMS AND GENETIC ALGORITHMS NAME: AKSHITKUMAR PATEL STUDENT ID: GRAD POSITION PAPER.
Genetic Algorithms An Evolutionary Approach to Problem Solving.
Genetic Algorithms And other approaches for similar applications Optimization Techniques.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
Genetic Algorithms.
Introduction to Genetic Algorithm (GA)
Neuro-Computing Lecture 6
Genetic Algorithms: A Tutorial
Traveling Salesman Problem by Genetic Algorithm
Genetic Algorithm Soft Computing: use of inexact t solution to compute hard task problems. Soft computing tolerant of imprecision, uncertainty, partial.
Population Based Metaheuristics
Genetic Algorithms: A Tutorial
Presentation transcript:

Department of Computer Science Lecture 6: Genetic Algorithms

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 2 The Traditional Approach  Ask an expert  Adapt existing designs  Trial and error

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 3 Comparisons  Traditional  best guess may lead to local, not global optimum  Nature  population of guesses more likely to find a better solution

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 4 More Comparisons  Nature  not very efficient at least a 20 year wait between generations not all mating combinations possible  Genetic algorithm  efficient and fast optimization complete in a matter of minutes mating combinations governed only by “fitness”

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 5 Real-World Uses of Genetic Algorithms  A heuristic search technique used in computing and Artificial Intelligence to find optimized solutions to search problems using techniques inspired by evolutionary biology: mutation, selection, reproduction [inheritance] and recombination

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 6 Automotive Design  Using Genetic Algorithms  design composite materials and aerodynamic shapes for race carsrace cars  Design regular means of transportation (including aviation)  Return combinations of best materials and best engineering to provide faster, lighter, more fuel efficient and safer vehicles

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 7 Engineering Design  optimize the structural and operational design of buildings, factories, machines  design of heat exchangers, robot gripping arms, satellite booms, building trusses, flywheels, turbines

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 8 Robotics  optimal designs and components for each specific use  multi-purpose, learning robots

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 9 Optimized Telecommunications Routing  allow for dynamic and anticipatory routing of circuits for telecommunicati ons networkstelecommunicati ons networks  GA circuit-search

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 10 Joke and Pun Generation  JAPE (automated pun generator) inspired STANDUP program to design communications strategies for people working with children who suffer communications disabilities  GAs that search for jokes and puns.  These clever GAs will let you input a word you wish to pun or a subject you'd like to joke about, and will return a variety of solutions

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 11 Finance and Investment Strategies Gene Expression Profiling Computer-Aided Molecular Design Encryption and Code Breaking Computer Gaming Trip, Traffic and Shipment Routing

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 12 The Genetic Algorithm Approach  Define limits of variable parameters  Generate a random population of designs  Assess “fitness” of designs  Mate selection  Crossover  Mutation  Reassess fitness of new population

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 13 A “Population”

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 14 Ranking by Fitness: 14

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 15 Mate Selection: 15 Fittest are copied and replaced less-fit

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 16 Mate Selection Roulette: 16 Increasing the likelihood but not guaranteeing the fittest reproduction

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 17 Crossover: Exchanging information through some part of information (representation)

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 18 Mutation : 18 Random change of binary digits from 0 to 1 and vice versa (to avoid local minima)

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 19 Best Design

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 20 The GA Cycle 20

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 21 The Genetic Algorithm  Directed search algorithms based on the mechanics of biological evolution  Developed by John Holland, University of Michigan (1970’s)  To understand the adaptive processes of natural systems  To design artificial systems software that retains the robustness of natural systems

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 22 The Genetic Algorithm (cont.)  Provide efficient, effective techniques for optimization and machine learning applications  Widely-used today in business, scientific and engineering circles

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 23 Components of a GA A problem to solve, and...  Encoding technique (gene, chromosome)  Initialization procedure (creation)  Evaluation function (environment)  Selection of parents (reproduction)  Genetic operators (mutation, recombination)  Parameter settings (practice and art)

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 24 Simple Genetic Algorithm { initialize population; evaluate population; while TerminationCriteriaNotSatisfied { select parents for reproduction; perform recombination and mutation; evaluate population; }

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 25 The GA Cycle of Reproduction reproduction population evaluation modification discard deleted members parents children modified children evaluated children

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 26 Population Chromosomes could be:  Bit strings ( )  Real numbers ( )  Permutations of element(E11 E3 E7... E1 E15)  Lists of rules (R1 R2 R3... R22 R23)  Program elements (genetic programming) ... any data structure population

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 27 Representation (In case of TSP) Representation is an ordered list of city numbers known as an order-based GA. 1) London 3) Dunedin 5) Beijing 7) Tokyo 2) Venice 4) Singapore 6) Phoenix 8) Victoria CityList1 ( ) CityList2 ( )

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 28 Reproduction reproduction population parents children Parents are selected at random with selection chances biased in relation to chromosome evaluations.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 29 Chromosome Modification  Modifications are stochastically triggered  Operator types are:  Mutation  Crossover (recombination) modification children modified children

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 30 Mutation Mutation involves reordering of the list: * Before: ( ) After: ( )

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 31 Mutation: Local Modification  Causes movement in the search space (local or global)  Restores lost information to the population Before: ( ) After: ( ) Before: ( ) After: ( )

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 32 Crossover: Recombination P1 ( ) ( ) C1 P2 ( ) ( ) C2 Crossover is a critical feature of genetic algorithms:  It greatly accelerates search early in evolution of a population  It leads to effective combination of schemata (subsolutions on different chromosomes) *

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 33 Crossover Crossover combines inversion and recombination: * * Parent1 ( ) Parent2 ( ) Child ( ) This operator is called the Order1 crossover.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 34 Evaluation  The evaluator decodes a chromosome and assigns it a fitness measure  The evaluator is the only link between a classical GA and the problem it is solving evaluation evaluated children modified children

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 35 Deletion  Generational GA: entire populations replaced with each iteration  Steady-state GA: a few members replaced each generation population discard discarded members

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 36 An Abstract Example 36 Distribution of Individuals in Generation 0 Distribution of Individuals in Generation N

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 37 Genetic Algorithm - Example  Goal:  Find the minimum / lowest point  Red line - the best solution  Green line - other solutions

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 38 Genetic Algorithm - Example  A set of solutions (represented by chromosomes) called population  Solutions from one population are taken and used to form a new population  This is motivated by a hope, that the new population will be better than the old one  Solutions which are selected to form new solutions (offspring) are selected according to their fitness – (the more suitable they are the more chances they have to reproduce)  This is repeated until some condition (for example number of populations or improvement of the best solution) is satisfied 38

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 39 Outline of the Basic Genetic Algorithm 1. [Start] Generate random population of n chromosomes (suitable solutions for the problem) 2. [Fitness] Evaluate the fitness f(x) of each chromosome x in the population 3. [New population] Create a new population by repeating following steps until the new population is complete 1. [Selection] Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) 2. [Crossover] With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. 3. [Mutation] With a mutation probability mutate new offspring at each locus (position in chromosome). 4. [Accepting] Place new offspring in a new population 4. [Replace] Use new generated population for a further run of algorithm 5. [Test] If the end condition is satisfied, stop, and return the best solution in current population 6. [Loop] Go to step 2

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 40 A Simple Example The Traveling Salesman Problem: Find a tour of a given set of cities so that  each city is visited only once  the total distance traveled is minimized

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 41 TSP Example: 30 Cities 41

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 42 Solution i (Distance = 941) 42

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 43 Solution j (Distance = 800) 43

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 44 Solution k (Distance = 652) 44

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 45 Best Solution (Distance = 420) 45

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 46 Overview of Performance 46

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 47 Issues for GA Practitioners  Choosing basic implementation issues:  representation  population size, mutation rate,...  selection, deletion policies  crossover, mutation operators  Termination Criteria  Performance, scalability  Solution is only as good as the evaluation function (often hardest part)

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 48 Benefits of Genetic Algorithms  Concept is easy to understand  Modular, separate from application  Supports multi-objective optimization  Good for “noisy” environments  Always an answer; answer gets better with time  Inherently parallel; easily distributed

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 49 Benefits of Genetic Algorithms (cont.)  Many ways to speed up and improve a GA- based application as knowledge about problem domain is gained  Easy to exploit previous or alternate solutions  Flexible building blocks for hybrid applications  Substantial history and range of use  Good to find a region of solution including the optimal solution. But slow in giving the optimal solution

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 50 When to Use a GA  Alternate solutions are too slow or overly complicated  Need an exploratory tool to examine new approaches  Problem is similar to one that has already been successfully solved by using a GA  Want to hybridize with an existing solution  Benefits of the GA technology meet key problem requirements

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 51 Some GA Application Types

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 52 Things to concern for GA  How to create chromosomes?  What type of encoding choose?  Crossover  Mutation  How to select parents for crossover?  How to select the better parents for better offspring?

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 53 Selection  Chromosomes are selected from the population to be parents to crossover. The problem is how to select these chromosomes  Darwin's evolution theory  the best ones should survive and create new offspring  many methods how to select the best chromosomes  roulette wheel selection, Boltzman selection, tournament selection, rank selection, steady state selection

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 54 Roulette Wheel Selection  Parents are selected according to their fitness.  The better the chromosomes are, the more chances to be selected they have.  Imagine a roulette wheel where are placed all chromosomes in the population, every has its place big accordingly to its fitness function  Then a marble is thrown there and selects the chromosome. Chromosome with bigger fitness will be selected more times.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 55 Roulette Wheel Selection  [Sum] Calculate sum of all chromosome fitnesses in population - sum S.  [Select] Generate random number from interval (0,S) - r.  [Loop] Go through the population and sum fitnesses from 0 - sum s. When the sum s is greater then r, stop and return the chromosome where you are.  Of course, step 1 is performed only once for each population.  Problem: when the fitnesses differs very much  if the best chromosome fitness is 90% of all the roulette wheel then the other chromosomes will have very few chances to be selected

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 56 Rank Selection  Rank selection first ranks the population and then every chromosome receives fitness from this ranking.  The worst will have fitness1, second worst 2 etc. and the best will have fitness N (number of chromosomes in population) After this all the chromosomes have a chance to be selected. But this method can lead to slower convergence, because the best chromosomes do not differ so much from other ones.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 57 Steady-State Selection  Main idea of this selection is that big part of chromosomes should survive to next generation.  GA then works in a following way.  In every generation are selected a few (good - with high fitness) chromosomes for creating a new offspring. Then some (bad - with low fitness) chromosomes are removed and the new offspring is placed in their place.  The rest of population survives to new generation.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 58 Elitism  When creating new population by crossover and mutation, we have a big chance, that we will loose the best chromosome.  Elitism is name of method, which first copies the best chromosome (or a few best chromosomes) to new population. The rest is done in classical way.  Elitism can very rapidly increase performance of GA, because it prevents losing the best found solution.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 59 Crossover  if there is no crossover  offspring is exact copy of parents.  If there is a crossover  offspring is made from parts of parents' chromosome.  If crossover probability is 100%  then all offspring is made by crossover.  If it is 0%,  whole new generation is made from exact copies of chromosomes from old population (but this does not mean that the new generation is the same!).

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 60 Crossover  Crossover is made in hope that new chromosomes will have good parts of old chromosomes and maybe the new chromosomes will be better.  However it is good to leave some part of population survive to next generation.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 61 Mutation probability  how often will be parts of chromosome mutated  If there is no mutation  offspring is taken after crossover (or copy) without any change.  If mutation is performed,  part of chromosome is changed  If you try to increase mutation probability to 100%, GA will start to behave very strange, nearly like if the mutation probability is 0%. Do you know why?

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University % Mutation Probability  If the chromosome is mutated, normally a few bits are changed and so the solution is a bit changed.  But if all bits in chromosome are mutated (because of 100% mutation probability), then the chromosome string is in fact inverted.  Then we have inversion and no mutation, so whole population degenerates very quickly. It behaves like with no mutation because of 0% mutation probability.

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 63 Genetic Approach When applied to strings of genes, the approaches are classified as genetic algorithms (GA) When applied to pieces of executable programs, the approaches are classified as genetic programming (GP) GP operates at a higher level of abstraction than GA

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 64 Examples  Hello World  tml tml  al.ppt al.ppt  ml ml  ure=related ure=related  ample.html ample.html

© M. Tariq Siddique 2015 Depart of Computer Science | Bahria University 65 References  Wikipedia – Genetic Algorithm   03.IntroToGAs.pdf 03.IntroToGAs.pdf    guide/toc.html guide/toc.html  SolvingAI/Class9GATutorial.ppt SolvingAI/Class9GATutorial.ppt