+ All Categories
Transcript
Page 1: Genetic Algorithms (GAs)

Genetic Algorithms (GAs)

By Mutaz Flmban

Page 2: Genetic Algorithms (GAs)

Outline

• History of Genetic Algorithm

• What is the Genetic Algorithm

• Biological Background

• Basic Genetic Algorithm

• Genetic Algorithm Operators

• Benefits of Genetic Algorithm

• Some Genetic Algorithm Applications Types

Page 3: Genetic Algorithms (GAs)

History of GAs

• As early as 1962, John Holland's work on adaptive systems laid the foundation for later developments.

• By the 1975, the publication of the book Adaptation in Natural and Artificial Systems, by Holland and his students and colleagues.

Page 4: Genetic Algorithms (GAs)

History of GAs

• early to mid-1980s, genetic algorithms were being applied to a broad range of subjects.

• In 1992 John Koza has used genetic algorithm to evolve programs to perform certain tasks. He called his method "genetic programming" (GP).

Page 5: Genetic Algorithms (GAs)

What is GA

• A genetic algorithm (or GA) is a search technique used in computing to find true or approximate solutions to optimization and search problems.

• (GA)s are categorized as global search heuristics.

• (GA)s are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover (also called recombination).

Page 6: Genetic Algorithms (GAs)

What is GA

• The evolution usually starts from a population of randomly generated individuals and happens in generations.

• In each generation, the fitness of every individual in the population is evaluated, multiple individuals are selected from the current population (based on their fitness), and modified to form a new population.

Page 7: Genetic Algorithms (GAs)

What is GA

• The new population is used in the next iteration of the algorithm.

• The algorithm terminates when either a maximum number of generations has been produced, or a satisfactory fitness level has been reached for the population.

Page 8: Genetic Algorithms (GAs)

Vocabulary• Individual - Any possible solution • Population - Group of all individuals • Trait - Possible aspect (features) of an individual• Allele - Possible settings of trait (black, blond,

etc.)• Locus - The position of a gene on the

chromosome • Genome - Collection of all chromosomes for an

individual.

Page 9: Genetic Algorithms (GAs)

Biological Background “The cell”

• Every animal cell is a complex of many small “factories” working together.

• The nucleus in the center of the cell.

• The nucleus contains the genetic information

Page 10: Genetic Algorithms (GAs)

• Genetic information is stored in the chromosomes

• Each chromosome is build of DNA

• Chromosomes in humans form pairs.

• There are 23 pairs.

• The chromosome is divided in parts: genes

• Genes code for properties

• Every gene has an unique

position on the chromosome:

locus

Biological Background “Chromosomes”

Page 11: Genetic Algorithms (GAs)

• The entire combination of genes is called genotype

• A genotype develops to a phenotype

• Alleles can be either dominant or recessive

• Dominant alleles will always express from the genotype to the phenotype.

• Recessive alleles can

survive in the population

for many generations,

without being expressed.

Biological Background “Genetics”

Page 12: Genetic Algorithms (GAs)

• Reproduction of genetical information• Mitosis

• Meiosis

• Mitosis is copying the same

genetic information to new

offspring: there is no

exchange of information

• Mitosis is the normal way of

growing of multicell structures,

like organs.

Biological Background “Reproduction ”

Page 13: Genetic Algorithms (GAs)

• Meiosis is the basis of sexual reproduction

• After meiotic division 2 gametes

appear in the process

• In reproduction two gametes

conjugate to a zygote wich

will become the new individual

• Hence genetic information

is shared between the parents

in order to create new offspring

Biological Background Reproduction

Page 14: Genetic Algorithms (GAs)

Biological Background

“Reproduction ”

• During reproduction “errors” occur

• Due to these “errors” genetic variation exists

• Most important “errors” are:

•Recombination (cross-over)

•Mutation

Page 15: Genetic Algorithms (GAs)

Biological Background

“Natural selection”

• The origin of species: “Preservation of favourable variations and rejection of unfavourable variations.”

• There are more individuals born than can survive, so there is a continuous struggle for life.

• Individuals with an advantage have a greater chance for survive: so survival of the fittest.

Page 16: Genetic Algorithms (GAs)

Biological Background

“Natural selection”

• Important aspects in natural selection are:

• adaptation to the environment

• isolation of populations in different groups which cannot mutually mate

• If small changes in the genotypes of individuals are expressed easily, especially in small populations, we speak of genetic drift

• Mathematical expresses as fitness: success in life

Page 17: Genetic Algorithms (GAs)

Basic Genetic Algorithm• Start with a large “population” of randomly generated

“attempted solutions” to a problem

• Repeatedly do the following:

– Evaluate each of the attempted solutions

– Keep a subset of these solutions (the “best” ones)

– Use these solutions to generate a new population

• Quit when you have a satisfactory solution (or you run out of time)

Page 18: Genetic Algorithms (GAs)

• Methods of representation

• Methods of selection

• Methods of Reproduction

GA Operators

Page 19: Genetic Algorithms (GAs)

Methods of Representation

• Encode solutions as binary strings: sequences of 1's and 0's, where the digit at each position represents the value of some aspect of the solution.

• Second approach is encode solutions as arrays of integers or decimal numbers.

• A third approach is to represent individuals in a GA as strings of letters, where each letter again stands for a specific aspect of the solution.

Page 20: Genetic Algorithms (GAs)

There are many different techniques which a genetic algorithm can use to

select the individuals to be copied over into the next generation

Methods of Selection

Page 21: Genetic Algorithms (GAs)

Methods of Selection

• Roulette-wheel selection.

• Elitist selection.

• Fitness-proportionate selection.

• Scaling selection.

• Rank selection.

• Generational selection.

• Hierarchical selection.

Page 22: Genetic Algorithms (GAs)

Methods of selection• Roulette-wheel selection: the fitter is the

solution with the most chances to be chosen

HOW IT WORKS ?

Page 23: Genetic Algorithms (GAs)

• Conceptually, this can be represented as a game of roulette - each individual gets a slice of the wheel, but more fit ones get larger slices than less fit ones.

Roulette wheel selection

Page 24: Genetic Algorithms (GAs)

Roulette wheel selection

No. String Fitness % Of Total

1 01101 169 14.4

2 11000 576 49.2

3 01000 64 5.5

4 10011 361 30.9

Total 1170 100.0

Page 25: Genetic Algorithms (GAs)

Roulette wheel selection

Page 26: Genetic Algorithms (GAs)

• Elitist selection:

The most fit members of each generation are guaranteed to be selected.

• Rank selection:

Each individual in the population is assigned a numerical rank based on fitness, and selection is based on this ranking.

Another methods of selection

Page 27: Genetic Algorithms (GAs)

Once selection has chosen fit individuals, they must be randomly altered in hopes of

improving their fitness for the next generation.

Methods of Reproduction

Page 28: Genetic Algorithms (GAs)

• There are two basic strategies to accomplish this:

–Crossover

–Mutation

Methods of Reproduction

Page 29: Genetic Algorithms (GAs)

• Crossover– Two parents produce two offspring

– There is a chance that the chromosomes of the two parents are copied unmodified as offspring

– There is a chance that the chromosomes of the two parents are randomly recombined (crossover) to form offspring

Methods of Reproduction

Page 30: Genetic Algorithms (GAs)

Methods of Reproduction

• Crossover– Generating offspring from two selected parents

• Single point crossover

• Two point crossover (Multi point crossover)

• Uniform crossover

Page 31: Genetic Algorithms (GAs)

One-point crossover• Randomly one position in the chromosomes is chosen

• Child 1 is head of chromosome of parent 1 with tail of chromosome of parent 2

• Child 2 is head of 2 with tail of 1

Parents: 1010001110 0011010010

Offspring: 0101010010 0011001110

Page 32: Genetic Algorithms (GAs)

Parents: 1010001110 0011010010

Offspring: 0101010010 0011001110

Two-point crossover• Randomly two positions in the chromosomes

are chosen• Avoids that genes at the head and genes at

the tail of a chromosome are always split when recombined

Page 33: Genetic Algorithms (GAs)

Crossover• Single point crossover

• Two point crossover (Multi point crossover)Cross point

Page 34: Genetic Algorithms (GAs)

Uniform crossover• A random mask is generated

• The mask determines which bits are copied from one parent and which from the other parent

• Bit density in mask determines how much material is taken from the other parent (takeover parameter)Mask: 0110011000 (Randomly generated)

Parents: 1010001110 0011010010

Offspring: 0011001010 1010010110

Page 35: Genetic Algorithms (GAs)

Methods of Reproduction

• Mutation:

– Generating new offspring from single parent

Page 36: Genetic Algorithms (GAs)

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

Page 37: Genetic Algorithms (GAs)

Representation

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 (3 5 7 2 1 6 4 8)

CityList2 (2 5 7 6 8 1 3 4)

Page 38: Genetic Algorithms (GAs)

Crossover combines inversion and recombination: * *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.

Crossover

Page 39: Genetic Algorithms (GAs)

Mutation involves reordering of the list:

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

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

Mutation

Page 40: Genetic Algorithms (GAs)

TSP Example: 30 Cities

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

Page 41: Genetic Algorithms (GAs)

Solution i (Distance = 941)

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 (Performance = 941)

Page 42: Genetic Algorithms (GAs)

Solution j(Distance = 800)

Page 43: Genetic Algorithms (GAs)

Solution k(Distance = 652)

0

20

40

60

80

100

120

0 10 20 30 40 50 60 70 80 90 100

y

x

TSP30 (Performance = 652)

Page 44: Genetic Algorithms (GAs)

Best Solution (Distance = 420)

Page 45: Genetic Algorithms (GAs)

Benefits of Genetic Algorithms

• Concept is easy to understand

• Modular, separate from application

• Supports multi-objective optimization

• Always an answer; answer gets better with time.

• Easy to exploit previous or alternate solutions

• Flexible building blocks for hybrid applications.

Page 46: Genetic Algorithms (GAs)

GA Applications

Page 47: Genetic Algorithms (GAs)

references

• http://en.wikipedia.org/wiki/Genetic_algorithm

• http://www.obitko.com/tutorials/genetic-algorithms/index.php

• http://www.talkorigins.org/faqs/genalg/genalg.html#examples:systems

Page 48: Genetic Algorithms (GAs)

Questions

Q1) give three methods of selection and explain one of them?.

A1) a) Roulette-wheel selection.

B) Elitist selection.

C) Rank selection.

Q2) what are the genetic algorithm operators?.

A2) a) Methods of representation

b) Methods of selection

c) Methods of Reproduction


Top Related