lecture 8: 24/5/1435 genetic algorithms lecturer/ kawther abas [email protected] 363cs –...

14
Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas [email protected] 363CS – Artificial Intelligence

Upload: maximillian-stanley

Post on 31-Dec-2015

238 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Lecture 8: 24/5/1435

Genetic Algorithms

Lecturer/ Kawther [email protected]

363CS – Artificial Intelligence

Page 2: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Genetic Algorithm

Developed: USA in the 1970’sGenetic Algorithms have been

applied successfully to a variety of AI applications

For example, they have been used to learn collections of rules for robot control.

Genetic Algorithms and genetic programming are called Evolutionary Computation

Page 3: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Genetic Algorithms (GAs) andGenetic Programming (GP)

Genetic Algorithms◦Optimising parameters for problem solving◦Represent the parameters in the solution(s)

As a “bit” string normally, but often something else

◦Evolve answers in this representationGenetic Programming

◦Representation of solutions is richer in general

◦Solutions can be interpreted as programs◦Evolutionary process is very similar

Page 4: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

GA

Genetic algorithms provide an AI

method by an analogy of biological

evolution

It constructs a population of evolving

solutions to solve the problem

Page 5: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Genetic AlgorithmsWhat are they?

◦ Evolutionary algorithms that make use of operations like mutation, recombination, and selection

Uses?◦ Difficult search problems◦ Optimization problems◦ Machine learning◦ Adaptive rule-bases

Page 6: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Classical GAsRepresentation of parameters is a bit string

◦ Solutions to a problem represented in binary◦ 101010010011101010101

Start with a population (fairly large set)◦ Of possible solutions known as individuals

Combine possible solutions by swapping material◦ Choose the “best” solutions to swap material

between and kill off the worse solutions◦ This generates a new set of possible solutions

Requires a notion of “fitness” of the individual◦ Base on an evaluation function with respect to

the problem

Page 7: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Genetic Algorithm

Page 8: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Genotype space = {0,1}L

Phenotype space

Encoding (representation)

Decoding(inverse representation)

011101001

010001001

10010010

10010001

Representation

Page 9: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

GA RepresentationGenetic algorithms are

represented as geneEach population consists of a

whole set of genesUsing biological reproduction,

new population is created from old one.

Page 10: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

The Initial PopulationRepresent solutions to problems

◦As a bit string of length LChoose an initial population size

◦Generate length L strings of 1s & 0s randomly

Strings are sometimes called chromosomes◦Letters in the string are called

“genes”◦We call the bit-string “individuals”

Page 11: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Initialization

Initial population must be a

representative sample of the

search space

Random initialization can be a

good idea (if the sample is large

enough)

Page 12: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

The geneEach gene in the population is

represented by bit strings.

001 10 10Outlook Wind play tennis

0011010

Page 13: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

Gene ExampleThe idea is to use a bit string to

describe the value of attributeThe attribute Outlook has 3

values (sunny, overcast, raining)So we use 3 bit length to

represent attribute outlook010 represent the outlook =

overcast

Page 14: Lecture 8: 24/5/1435 Genetic Algorithms Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence

GA

The fitness function evaluates

each solution and decide it will be

in next generation of solutions