Top Banner
Profr. Rubén Machucho Cadena
46
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Topicos i artificial

Profr. Rubén Machucho Cadena

Page 2: Topicos i artificial
Page 3: Topicos i artificial

Edward A. FeigenbaumPadre de los Sistemas Expertos.

Desarrolló Dendral, un sistema experto para el análisis de

compuestos químicos.

Page 4: Topicos i artificial
Page 5: Topicos i artificial

Genetic algorithms are a class of heuristic search methods and

computational models of adaptation and evolution based on natural selection. In nature,

the search for beneficial adaptations to a continually changing environment (i.e.

evolution) is fostered by the cumulative evolutionary

knowledge that each species possesses of its forebears. This knowledge, which is encoded in

the chromosomes of each member of a species, is passed from one generation to the next

by a mating process in which the chromosomes of "parents"

produce "offspring" chromosomes.

Page 6: Topicos i artificial

“Genetic Algorithms are good at taking large,

potentially huge search spaces and navigating

them, looking for optimal combinations of

things, solutions you might not otherwise find

in a lifetime.”

- Salvatore Mangano

Computer Design, May 1995

Page 7: Topicos i artificial

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

Page 8: Topicos i artificial

Provide efficient, effective techniques for optimization and machine learning applications

Widely-used today in business, scientific and engineering circles

Page 9: Topicos i artificial

F inonacc i N ew ton

D irect m ethods Indirec t m ethods

C alcu lus-based techn iques

E volu tionary s trategies

C entra l ized D is tr ibuted

Para l le l

S teady-s ta te G enera tiona l

S equentia l

G ene tic a lgori thm s

E volutionary a lgori thm s S im u lated annealing

G uided random search techniques

D ynam ic program m ing

E num erative techn iques

S earch techniques

Page 10: Topicos i artificial

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)

Page 11: Topicos i artificial

{

initialize population;evaluate population;while TerminationCriteriaNotSatisfied{

select parents for reproduction;perform recombination and mutation;evaluate population;

}}

Page 12: Topicos i artificial

reproduction

population evaluation

modification

discard

deleted members

parents

children

modifiedchildren

evaluated children

Page 13: Topicos i artificial

Chromosomes could be:◦ Bit strings (0101 ...

1100)◦ Real numbers (43.2 -33.1 ... 0.0 89.2) ◦ Permutations of element (E11 E3 E7 ... E1 E15)◦ Lists of rules (R1 R2 R3 ... R22 R23)◦ Program elements (genetic

programming)◦ ... any data structure ...

population

Page 14: Topicos i artificial

reproduction

population

parents

children

Parents are selected at random with selection chances biased in relation to chromosome evaluations.

Page 15: Topicos i artificial

Modifications are stochastically triggered Operator types are:

◦ Mutation◦ Crossover (recombination)

modificationchildren

modified children

Page 16: Topicos i artificial

Causes movement in the search space(local or global)

Restores lost information to the population

Before: (1 0 1 1 0 1 1 0)

After: (0 1 1 0 0 1 1 0)

Before: (1.38 -69.4 326.44 0.1)

After: (1.38 -67.5 326.44 0.1)

Page 17: Topicos i artificial

P1 (0 1 1 0 1 0 0 0) (0 1 0 0 1 0 0 0) C1

P2 (1 1 0 1 1 0 1 0) (1 1 1 1 1 0 1 0) C2

Crossover is a critical feature of geneticalgorithms:

◦ It greatly accelerates search early in evolution of a population

◦ It leads to effective combination of schemata (subsolutions on different chromosomes)

*

Page 18: Topicos i artificial

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

evaluatedchildren

modifiedchildren

Page 19: Topicos i artificial

Generational GA:entire populations replaced with each iteration

Steady-state GA:a few members replaced each generation

population

discard

discarded members

Page 20: Topicos i artificial

Distribution of Individuals in Generation 0

Distribution of Individuals in Generation N

Page 21: Topicos i artificial

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

Page 22: Topicos i artificial

Representation is an ordered list of citynumbers known as an order-based GA.

1) London 3) Dunedin 5) Beijing 7) Tokyo2) Venice 4) Singapore 6) Phoenix 8)

Victoria

CityList1 (3 5 7 2 1 6 4 8)CityList2 (2 5 7 6 8 1 3 4)

Page 23: Topicos i artificial

Crossover combines inversion andrecombination: * *Parent1 (3 5 7 2 1 6 4 8)Parent2 (2 5 7 6 8 1 3 4)

Child (5 8 7 2 1 6 3 4)

This operator is called the Order1 crossover.

Page 24: Topicos i artificial

Mutation involves reordering of the list:

* *Before: (5 8 7 2 1 6 3 4)

After: (5 8 6 2 1 7 3 4)

Page 25: Topicos i artificial

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

Page 26: Topicos i artificial

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 (Performance = 941)

Page 27: Topicos i artificial

44626967786462544250404038213567606040425099

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 (Performance = 800)

Page 28: Topicos i artificial

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 (Performance = 652)

Page 29: Topicos i artificial

423835262135327

3846445860697678716967628494

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 Solution (Performance = 420)

Page 30: Topicos i artificial

0

200

400

600

800

1000

1200

1400

1600

1800

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31

Dis

tan

ce

Generations (1000)

TSP30 - Overview of Performance

Best

Worst

Average

Page 31: Topicos i artificial

Crossover and Mutation Introduction Crossover and mutation are two basic operators of GA. Performance of GA very depends on them. Type and implementation of operators depends on encoding and also on a problem.

Binary Encoding Crossover

Single point crossover - one crossover point is selected, binary string from beginning of chromosome to the crossover point is copied from one parent, the rest is copied from the second parent

                                                                                           

11001011+11011111 = 11001111

Page 32: Topicos i artificial

Two point crossover - two crossover point are selected, binary string from beginning of chromosome to the first crossover point is copied from one parent, the part from the first to the second crossover point is copied from the second parent and the rest is copied from the first parent

                                                                                                                                      

                                                                                                                                               

11001011 + 11011111 = 11011111Uniform crossover - bits are randomly copied from the first or from the second parent

                                                                                                                                      

                                                        11001011 + 11011101 = 11011111

Arithmetic crossover - some arithmetic operation is performed to make a new offspring

                                                                                                                                      

                                           11001011 + 11011111 = 11001001 (AND)

Page 33: Topicos i artificial

Mutation Bit inversion - selected bits are inverted

                                                                                                                                                     

 11001001 =>  10001001

Page 34: Topicos i artificial

Crossover

Single point crossover - one crossover point is selected, till this point the permutation is copied from the first parent, then the second parent is scanned and if the number is not yet in the offspring it is addedNote: there are more ways how to produce the rest after crossover point

(1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7)

Mutation Order changing - two numbers are selected and exchanged

(1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7)

Value Encoding Crossover All crossovers from binary encoding can be used

Mutation

Adding a small number (for real value encoding) - to selected values is added (or subtracted) a small number

(1.29  5.68  2.86  4.11  5.55) => (1.29  5.68  2.73  4.22  5.55)

Permutation Encoding

Page 35: Topicos i artificial

Tree Encoding Crossover

Tree crossover - in both parent one crossover point is selected, parents are divided in that point and exchange part below crossover point to produce new offspring

                                                                            

                                                                                                                                                                                                           

Mutation Changing operator, number - selected nodes are changed

Page 36: Topicos i artificial

Binary Encoding Binary encoding is the most common, mainly because first works about GA used this type of encoding

In binary encoding every chromosome is a string of bits, 0 or 1

.

. Example of chromosomes with binary encoding

Binary encoding gives many possible chromosomes even with a small number of alleles. On the other hand, this encoding is often not natural for many problems and sometimes corrections must be made after crossover and/or mutation.

EncodingIntroduction Encoding of chromosomes is one of the problems, when you are starting to solve problem with GA. Encoding very depends on the problem. In this chapter will be introduced some encodings, which have been already used with some success.

Chromosome A 101100101100101011100101

Chromosome B 111111100000110000011111

Page 37: Topicos i artificial

                                                                                                                                          Example of Problem: Knapsack problemThe problem: There are things with given value and size. The knapsack has given capacity. Select things to maximize the value of things in knapsack, but do not extend knapsack capacity.Encoding: Each bit says, if the corresponding thing is in knapsack.                                                                                                                                           

Page 38: Topicos i artificial

Permutation Encoding

Chromosome A 1  5  3  2  6  4  7  9  8Chromosome B 8  5  6  7  2  3  1  4  9

Permutation encoding can be used in ordering problems, such as travelling salesman problem or task ordering problem. In permutation encoding, every chromosome is a string of numbers, which represents number in a sequence.

Example of chromosomes with permutation encoding

Permutation encoding is only useful for ordering problems. Even for this problems for some types of crossover and mutation corrections must be made to leave the chromosome consistent (i.e. have real sequence in it).

                                                                                                                                          Example of Problem: Travelling salesman problem (TSP)The problem: There are cities and given distances between them.Travelling salesman has to visit all of them, but he does not to travel very much. Find a sequence of cities to minimize travelled distance. Encoding: Chromosome says order of cities, in which salesman will visit them.

Page 39: Topicos i artificial

Value Encoding Direct value encoding can be used in problems, where some complicated value, such as real numbers, are used. Use of binary encoding for this type of problems would be very difficult. In value encoding, every chromosome is a string of some values. Values can be anything connected to problem, form numbers, real numbers or chars to some complicated objects.

Chromosome A 1.2324  5.3243  0.4556  2.3293  2.4545Chromosome B ABDJEIFJDHDIERJFDLDFLFEGTChromosome C (back), (back), (right), (forward), (left)

Example of chromosomes with value encoding

Value encoding is very good for some special problems. On the other hand, for this encoding is often necessary to develop some new crossover and mutation specific for the problem.

Example of Problem: Finding weights for neural networkThe problem: There is some neural network with given architecture. Find weights for inputs of neurons to train the network for wanted output.Encoding: Real values in chromosomes represent corresponding weights for inputs.                                                                                                                                           

Page 40: Topicos i artificial

Tree Encoding Tree encoding is used mainly for evolving programs or expressions, for genetic programming. In tree encoding every chromosome is a tree of some objects, such as functions or commands in programming language.                                   

Chromosome A Chromosome B

( +  x  ( /  5  y ) ) ( do_until  step  wall )

Example of chromosomes with tree encoding Tree encoding is good for evolving programs. Programing language LISP is often used to this, because programs in it are represented in this form and can be easily parsed as a tree, so the crossover and mutation can be done relatively easily. Example of Problem: Finding a function from given valuesThe problem: Some input and output values are given. Task is to find a function, which will give the best (closest to wanted) output to all inputs.Encoding: Chromosome are functions represented in a tree.

Page 41: Topicos i artificial
Page 42: Topicos i artificial

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)

Page 43: Topicos i artificial

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

Page 44: Topicos i artificial

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

Page 45: Topicos i artificial

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

Page 46: Topicos i artificial

Domain Application Types

Control gas pipeline, pole balancing, missile evasion, pursuit

Design semiconductor layout, aircraft design, keyboardconfiguration, communication networks

Scheduling manufacturing, facility scheduling, resource allocation

Robotics trajectory planning

Machine Learning designing neural networks, improving classificationalgorithms, classifier systems

Signal Processing filter design

Game Playing poker, checkers, prisoner’s dilemma

CombinatorialOptimization

set covering, travelling salesman, routing, bin packing,graph colouring and partitioning