Sei sulla pagina 1di 31

Evolutionary Computation

Lecture 1
January, 2007
Ivan Garibay
igaribay@cs.ucf.edu
Lecture 1
• What is Evolutionary Computation?
– Evolution, Genetics, DNA
– Historical Perspective
• Genetic Algorithm Components
– Individuals, Populations
– Fitness
– Selection
– Genetic Operators
• Example
1/15/2007 University of Central Florida, 2
School of EECS
Introduction

Motivation: learn from nature


• Nature evolve
strikingly complex
organisms in
response to complex
environmental
adaptation problems
with apparent ease
• Localize and extract
principles from nature
• Apply them to design
algorithms
1/15/2007 University of Central Florida, 3
School of EECS
Evolution
• Charles Darwin (1859): “On the origin of species
by means of natural selection”
• Reproduction does not produce a perfect copy,
always minor variations (mutations)
• Some variations are advantageous some are not
• Individuals with advantageous variations are
more likely to survive and reproduce (natural
selection, or the survival of the fittest)
• The variations and inheritable
• Species are continuously adapting to their
environment
1/15/2007 University of Central Florida, 4
School of EECS
Genetics
• Science of heredity
• Gregor Mendel (1865): units of
inheritance: Genes (“traits”)
• Organisms form by cells
• Each cell has information
necessary to construct a new
organism = genome
• Genome = set of chromosomes
• Chromosome = set of genes
• Genes are DNA segments
associated with a characteristic
(i.e. eye color)
• Allele is a particular gene value
(blue, black, etc)
1/15/2007 University of Central Florida, 5
School of EECS
Rethinking Evolutionary Computation

DNA: Information
• DNA molecule is an information
structure:
– Store information digitally
(chain of nucleotides)
– Nucleotide = deoxyribose
sugar + phosphate +
Nitrogenous base
– Nitrogenous bases: Adenine,
Thymine, Cytosine, Guanine
• DNA is an amazingly efficient,
highly specialized structure for
information storage, replication,
expression and evolution

1/15/2007 University of Central Florida, 6


School of EECS
Historical perspective

Evolutionary Computation

Evolutionary Strategies Evolutionary Programming Genetic Algorithms

•Rechenberg, 1965 •Fogel, Owens, and Walsh, •Holland, 1975


•Population of two 1966 •Population based
•Only mutation •Only mutation •Crossover and mutation
•Real value parameter •Evolving Finite State •Study adaptation
optimization Machines •Schema Theorem

1/15/2007 University of Central Florida, 7


School of EECS
GA terminology: from biology
Chromosome (string)

gene
Population
individual

Fitness based
Selection

Crossover
Mutation

Genetic Operators

Generation i Generation i+1


1/15/2007 University of Central Florida, 8
School of EECS
Simple Genetic Algorithm
procedure GA
begin
initialize population;
while termination condition not satisfied do
begin
evaluate current population members;
select parents from current population;
apply genetic operators to selected parents;
set offspring equal to current population;
end
end

1/15/2007 University of Central Florida, 9


School of EECS
Genetic Algorithm Components
• Population of individuals
• Fitness Function
• Selection Function
• Genetic Operators

1/15/2007 University of Central Florida, 10


School of EECS
Individuals

allele gene

0 1 0 0 01 1 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1

• Each individual represent a candidate solution


• String of ‘1’s and ‘0’ (binary representation)
• Could take any other form (tree, integers, etc)
• Needs to be decoded to have meaning:
Genotype to Phenotype

1/15/2007 University of Central Florida, 11


School of EECS
Rethinking Evolutionary Computation

Problem Representation
• Problem specific
Genotype to Phenotype • Different representations
are different problems for
Genome (DNA) Organisms a GA
Computational Instance of • Map a string (structure)
Evolutionary Problem
Structure Solution
into a instance of a
solution
Bit String Ordering of
cities for TSP • Representation is very
important
Logo instructions Antena
– Define the space to be
explored
– Define the space structure:
variations are meaningful
1/15/2007 University of Central Florida, 12
School of EECS
Binary Representation

• Example: encoding 4 parameters


• Param1 value = 1000 = 8
• Param2 value = 1011 = 11
• Etc.,

1/15/2007 University of Central Florida, 13


School of EECS
Fitness function
• Problem specific component
• Function takes as input an individual
(chromosome)
• Function return a numerical value that
determines how good the individual is
• Natural Selection: fitness function = environment
• Genetic Algorithm: fitness function is user
defined
• Typically higher is better

1/15/2007 University of Central Florida, 14


School of EECS
Selection
• Survival of the fittest
• Select the best individuals
• Based on fitness function
• Drives exploitation: exploit good genes
found so far
• Multiple Types
– Proportional
– Rank
– Tournament (most used)
1/15/2007 University of Central Florida, 15
School of EECS
Fitness proportional Selection
• Holland, 1975.
• Expected number of times an individual is
selected to reproduce is proportional to its
fitness relative to the total population fitness.
Ps(i) = f(i) / fsum

– where f(i) is the fitness of individual i and f is


the sum of fitness of all individuals in a pop.
• Actual number of offspring may be far from
expected number

1/15/2007 University of Central Florida, 16


School of EECS
Rank Selection
• Similar to Proportional
• Proportional to their rank instead
Ps(i) = r(i) / rsum

• Rank selection is weaker than proportional


in diverse populations
• Rank is stronger than proportional in
converged populations
1/15/2007 University of Central Florida, 17
School of EECS
Tournament Selection
1. Select two individuals
2. Generate a random number, r, 0 ≤ r ≤ 1
3. If r < k, select the better of the 2 individuals
else, select the worse of the 2 individuals

where k is a parameter.

• Computationally efficient.
– Previous methods require 2 passes:
• Compute sum
• Calculate expected number of offspring.
– Rank selection also requires a sort.
1/15/2007 University of Central Florida, 18
School of EECS
Genetic Operators
• Crossover
– Biologically inspired
– Combine genes from two individuals to form
an off-spring (sexual reproduction)
• Mutation
– Biologically inspired
– DNA is copied with errors = mutations
– Most of the time mutation = problem
– Some times = advantage

1/15/2007 University of Central Florida, 19


School of EECS
One-point Crossover
• Simplest form of crossover
• Advantage: Fairly large change in
individuals with very little disruption of
information
Parent 1: 11011100 11000110Offspring 1
Parent 2: 01100110 01111100Offspring 2

Crossover point

1/15/2007 University of Central Florida, 20


School of EECS
Other Crossover Ops
• Two point: select two points and exchange
middles
• Uniform: with probability px exchange or
not each bit

1/15/2007 University of Central Florida, 21


School of EECS
Mutation
• Single parent operator
11011100 11011000
• Mutation rate (M) is per bit
– Mutation rate per individual = M * L (individual
length)
– As a start: M = 1/L per bit
• Issues
– Low mutation rate: minimal exploration
– High mutation rate: too disruptive
1/15/2007 University of Central Florida, 22
School of EECS
Initialization
• Initial Populations are randomly generated
• Binary case are all randomly generated
binary strings

1/15/2007 University of Central Florida, 23


School of EECS
GA Convergence

1/15/2007 University of Central Florida, 24


School of EECS
Termination Criteria
• Found solution
• Number of generations
• Stagnation – no more fitness improvement

1/15/2007 University of Central Florida, 25


School of EECS
A GA by hand

Onemax problem: Maximize the number of ones

Population (0) Fitness

(0) 11001111 [6]


(1) 00100010 [2]
(2) 11100100 [4]
(3) 10011000 [3]
(4) 01100100 [3]
(5) 00001001 [2]

20/6 = 3.33

1/15/2007 University of Central Florida, 26


School of EECS
A GA by hand

Onemax problem: Maximize the number of ones

Population Fitness Selected parents

(0) 11001111 [6] (2) 11100100 [4]


(1) 00100010 [2] (0) 11001111 [6]
(2) 11100100 [4] (0) 11001111 [6]
(3) 10011000 [3] (4) 01100100 [3]
(4) 01100100 [3] (0) 11001111 [6]
(5) 00001001 [2] (1) 00100010 [2]

1/15/2007 University of Central Florida, 27


School of EECS
A GA by hand

Onemax problem: Maximize the number of ones

Selected parents X After crossover M

(2) 11100100 [4] 3 11101111 7


(0) 11001111 [6] 11000100 3
(0) 11001111 [6] 6 11001100 -
(4) 01100100 [3] 01100111 2
(0) 11001111 [6] 5 11001010 5
(1) 00100010 [2] 00100111 0

1/15/2007 University of Central Florida, 28


School of EECS
A GA by hand

Onemax problem: Maximize the number of ones

After crossover M After mutation Fitness

11101111 7 11101110 [6]


11000100 3 11010100 [4]
11001100 - 11001100 [4]
01100111 2 01000111 [4]
11001010 5 11001110 [5]
00100111 0 10100111 [5]

28/6 = 4.67

1/15/2007 University of Central Florida, 29


School of EECS
A GA by hand

Onemax problem: Maximize the number of ones

Population (0) Fitness Population (1) Fitness

(0) 11001111 [6] 11101110 [6]


(1) 00100010 [2] 11010100 [4]
(2) 11100100 [4] 11001100 [4]
(3) 10011000 [3] 01000111 [4]
(4) 01100100 [3] 11001110 [5]
(5) 00001001 [2] 10100111 [5]

20/6 = 3.33 28/6 = 4.67

1/15/2007 University of Central Florida, 30


School of EECS
Questions?

1/15/2007 University of Central Florida, 31


School of EECS

Potrebbero piacerti anche