Genetic Algorithms MITM613 (Intelligent Systems).

Slides:



Advertisements
Similar presentations
Introduction to Genetic Algorithms
Advertisements

CS6800 Advanced Theory of Computation
Introduction to Genetic Algorithms Speaker: Moch. Rif’an
Biologically Inspired AI (mostly GAs). Some Examples of Biologically Inspired Computation Neural networks Evolutionary computation (e.g., genetic algorithms)
Genetic Algorithms Representation of Candidate Solutions GAs on primarily two types of representations: –Binary-Coded –Real-Coded Binary-Coded GAs must.
Institute of Intelligent Power Electronics – IPE Page1 Introduction to Basics of Genetic Algorithms Docent Xiao-Zhi Gao Department of Electrical Engineering.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Genetic Algorithms Nehaya Tayseer 1.Introduction What is a Genetic algorithm? A search technique used in computer science to find approximate solutions.
7/2/2015Intelligent Systems and Soft Computing1 Lecture 9 Evolutionary Computation: Genetic algorithms Introduction, or can evolution be intelligent? Introduction,
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Introduction to Genetic Algorithms
Genetic Algorithm.
Evolutionary Intelligence
© Negnevitsky, Pearson Education, CSC 4510 – Machine Learning Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Evolution Strategies Evolutionary Programming Genetic Programming Michael J. Watts
Genetic algorithms Prof Kang Li
CS 484 – Artificial Intelligence1 Announcements Lab 3 due Tuesday, November 6 Homework 6 due Tuesday, November 6 Lab 4 due Thursday, November 8 Current.
Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas 363CS – Artificial Intelligence.
Genetic Algorithms by using MapReduce
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
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.
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
Soft Computing A Gentle introduction Richard P. Simpson.
© Negnevitsky, Pearson Education, Lecture 9 Evolutionary Computation: Genetic algorithms Introduction, or can evolution be intelligent? Introduction,
Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or.
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
Learning by Simulating Evolution Artificial Intelligence CSMC February 21, 2002.
 Negnevitsky, Pearson Education, Lecture 9 Evolutionary Computation: Genetic algorithms n Introduction, or can evolution be intelligent? n Simulation.
Evolution Programs (insert catchy subtitle here).
1 Genetic Algorithms and Ant Colony Optimisation.
1 Genetic Algorithms K.Ganesh Introduction GAs and Simulated Annealing The Biology of Genetics The Logic of Genetic Programmes Demo Summary.
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
Introduction to Genetic Algorithms. Genetic Algorithms We’ve covered enough material that we can write programs that use genetic algorithms! –More advanced.
Genetic Algorithms CSCI-2300 Introduction to Algorithms
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.
Chapter 12 FUSION OF FUZZY SYSTEM AND GENETIC ALGORITHMS Chi-Yuan Yeh.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
Genetic Algorithms - History
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.
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
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 algorithm. Definition The genetic algorithm is a probabilistic search algorithm that iteratively transforms a set (called a population) of mathematical.
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.
GENETIC ALGORITHM By Siti Rohajawati. Definition Genetic algorithms are sets of computational procedures that conceptually follow steps inspired by the.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
Introduction to Genetic Algorithms
Chapter 14 Genetic Algorithms.
Genetic Algorithms.
Artificial Intelligence Methods (AIM)
Introduction to Genetic Algorithm (GA)
Basics of Genetic Algorithms (MidTerm – only in RED material)
GENETIC ALGORITHMS & MACHINE LEARNING
Genetic Algorithms Chapter 3.
Basics of Genetic Algorithms
A Gentle introduction Richard P. Simpson
Genetic Algorithm Soft Computing: use of inexact t solution to compute hard task problems. Soft computing tolerant of imprecision, uncertainty, partial.
Beyond Classical Search
Presentation transcript:

Genetic Algorithms MITM613 (Intelligent Systems)

a genetic algorithm (GA) is a search heuristic that mimics the process of natural selection. This heuristic (also sometimes called a metaheuristic) is routinely used to generate useful solutions to optimization and search problems

Genetic Algorithms

Soft Computing Fuzzy Systems Neural Networks Evolutionary Computation Genetic Algorithm Genetic Programming Machine Learning

Genetic Algorithms - History Pioneered by John Holland in the 1970’s Got popular in the late 1980’s Based on ideas from Darwinian Evolution Can be used to solve a variety of problems that are not easy to solve using other techniques

Evolution in the real world Each cell of a living thing contains chromosomes - strings of DNA Each chromosome contains a set of genes - blocks of DNA Each gene determines some aspect of the organism (like eye colour) A collection of genes is sometimes called a genotype A collection of aspects (like eye colour) is sometimes called a phenotype Reproduction involves recombination of genes from parents and then small amounts of mutation (errors) in copying The fitness of an organism is how much it can reproduce before it dies Evolution based on “survival of the fittest”

(GA) Generate a set of random solutions Repeat Test each solution in the set (rank them) Remove some bad solutions from set Duplicate some good solutions make small changes to some of them Until best solution is good enough

How do you encode a solution? Obviously this depends on the problem! GA’s often encode solutions as fixed length “bitstrings” (e.g , , ) Each bit represents some aspect of the proposed solution to the problem For GA’s to work, we need to be able to “test” any string and get a “score” indicating how “good” that solution is

Silly Example - Drilling for Oil Imagine you had to drill for oil somewhere along a single 1km desert road. Problem: choose the best place on the road that produces the most oil per day. We could represent each solution as a position on the road. Say, a whole number between [ ].

Where to drill for oil? Road Solution2 = 900Solution1 = 300

Digging for Oil The set of all possible solutions [ ] is called the search space or state space In this case it’s just one number but it could be many numbers or symbols Often GA’s code numbers in binary producing a bitstring representing a solution In our example we choose 10 bits which is enough to represent

Convert to binary string In GA’s these encoded strings are sometimes called “genotypes” or “chromosomes” and the individual bits are sometimes called “genes”

Drilling for Oil Road Solution2 = 900 ( ) Solution1 = 300 ( ) O I L Location 30 5

Summary We have seen how to: represent possible solutions as a number. encoded a number into a binary string. generate a score for each number given a function of “how good” each solution is - this is often called a fitness function. Our silly oil example is really optimisation over a function f(x) where we adapt the parameter x.

Search Space For a simple function f(x) the search space is one dimensional. But by encoding several values into the chromosome many dimensions can be searched e.g. two dimensions f(x,y) Search space an be visualised as a surface or fitness landscape in which fitness dictates height Each possible genotype is a point in the space A GA tries to move the points to better places (higher fitness) in the space

Fitness landscapes

fitness landscapes or adaptive landscapes (types of Evolutionary landscapes) are used to visualize the relationship between genotypes and reproductive success. It is assumed that every genotype has a well-defined replication rate (often referred to as fitness). This fitness is the "height" of the landscape. Genotypes which are very similar are said to be "close" to each other, while those that are very different are "far" from each other. The set of all possible genotypes, their degree of similarity, and their related fitness values is then called a fitness landscape.

Search Space Obviously, the nature of the search space dictates how a GA will perform. A completely random space would be bad for a GA. Also GA’s can get stuck in local maxima if search spaces contain lots of these. Generally, spaces in which small improvements get closer to the global optimum are good

Back to the (GA) Algorithm Generate a set of random solutions Repeat Test each solution in the set (rank them) Remove some bad solutions from set Duplicate some good solutions make small changes to some of them Until best solution is good enough

Adding Sex - Crossover Although it may work for simple search spaces our algorithm is still very simple It relies on random mutation to find a good solution It has been found that by introducing “sex” into the algorithm better results are obtained This is done by selecting two parents during reproduction and combining their genes to produce offspring ( seed)

Adding Sex - Crossover Two high scoring “parent” bit strings (chromosomes) are selected and with some probability (crossover rate) combined Producing two new offspring (bit strings) Each offspring may then be changed randomly (mutation)

Selecting Parents Many schemes are possible so long as better scoring chromosomes more likely selected Score is often termed the fitness “Roulette Wheel” selection can be used: –Add up the fitness's of all chromosomes –Generate a random number R in that range –Select the first chromosome in the population that - when all previous fitness’s are added - gives you at least the value R

Example population No.ChromosomeFitness

Roulette Wheel Selection Rnd[0..18] = 7 Chromosome4 Parent1 Rnd[0..18] = 12 Chromosome6 Parent2

Crossover - Recombination Crossover single point - random Parent1 Parent2 Offspring1 Offspring2 With some high probability (crossover rate) apply crossover to the parents. (typical values are 0.8 to 0.95)

Mutation Offspring1 Offspring Offspring1 Offspring2 With some small probability (the mutation rate) flip each bit in the offspring (typical values between 0.1 and 0.001) mutate Original offspring Mutated offspring

Back to the (GA) Algorithm Generate a population of random chromosomes Repeat (each generation) Calculate fitness of each chromosome Repeat Use roulette selection to select pairs of parents Generate offspring with crossover and mutation Until a new population has been produced Until best solution is good enough

GA algorithms/example-function-minimum.phphttp:// algorithms/example-function-minimum.php

Many parameters to set Any GA implementation needs to decide on a number of parameters: Population size (N), mutation rate (m), crossover rate (c) Often these have to be “tuned” based on results obtained - no general theory to deduce good values Typical values might be: N = 50, m = 0.05, c = 0.9

Why does crossover work? A lot of theory about this and some controversy (debate). Holland introduced “Schema” theory The idea is that crossover preserves “good bits” from different parents, combining them to produce better solutions A good encoding scheme would therefore try to preserve “good bits” during crossover and mutation

Genetic Programming When the chromosome encodes an entire program or function itself this is called genetic programming (GP) In order to make this work encoding is often done in the form of a tree representation Crossover entials swaping subtrees between parents

Genetic Programming It is possible to evolve whole programs like this but only small ones. Large programs with complex functions present big problems

GA

Implicit fitness functions Most GA’s use explicit and static fitness function (as in our “oil” example) Some GA’s (such as in Artificial Life or Evolutionary Robotics) use dynamic and implicit fitness functions - like “how many obstacles (barriers) did I avoid” In these latter examples other chromosomes (robots) effect the fitness function

Problem In the Travelling Salesman Problem (TSP) a salesman has to find the shortest distance journey that visits a set of cities Assume we know the distance between each city This is known to be a hard problem to solve because the number of possible routes is N! where N = the number of cities There is no simple algorithm that gives the best answer quickly

Problem Design a chromosome encoding, a mutation operation and a crossover function for the Travelling Salesman Problem (TSP) Assume number of cities N = 10 After all operations the produced chromosomes should always represent valid possible journeys (visit each city once only) There is no single answer to this, many different schemes have been used previously

fitness functions A fitness function is a particular type of objective function that is used to summarise, as a single figure of merit, how close a given design solution is to achieving the set aims. functions is in terms of a fitness landscape, which shows the fitness for each possible chromosome.

fitness functions In genetic algorithm, fitness is used to allocate reproductive traits to the individuals in the population and thus act as some measure of goodness to be maximized. This means that individuals with higher fitness value will have higher probability of being selected as candidates for further examination.

Example Suppose a genetic algorithm uses chromosomes of the form x = abcdefgh.with a fixed length of eight genes. Each gene can be any digit between 0 and 9. Let the fitness of individual x be calculated as: f(x) = (a + b) - (c + d) + (e + f) - (g + h),

and let the initial population consist of four individuals with the following chromosomes: X1= X2= X3= X4=  Evaluate the fitness of each individual, showing all your workings arrange them in order with the fittest first and the least fit last.  The order ???

Cross the fittest two individuals using one–point crossover at the middle point. Cross the second and third fittest individuals using a two–point crossover (points b and f). Cross the first and third fittest individuals (ranked 1st and 3rd) using a uniform crossover. uniform crossover means just a random exchange of genes between two parents. For example, we may swap genes at positions a, d and f of parents

Suppose the new population consists of the six o ff spring individuals received by the crossover operations in the above questions. Evaluate the fitness of the new population, showing all your workings. Has the overall fitness improved? By looking at the fitness function and considering that genes can only be digits between 0 and 9 find the chromosome representing the optimal solution (i.e. with the maximum fitness). Find the value of the maximum fitness. By looking at the initial population of the algorithm can you say whether it will be able to reach the optimal solution without the mutation operator?