SlideShare ist ein Scribd-Unternehmen logo
1 von 63
Genetic Algorithms

Chapter 3
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

GA Quick Overview
ïŹ
ïŹ
ïŹ

Developed: USA in the 1970’s
Early names: J. Holland, K. DeJong, D. Goldberg
Typically applied to:
–

ïŹ

Attributed features:
–
–

ïŹ

discrete optimization
not too fast
good heuristic for combinatorial problems

Special Features:
–
–

Traditionally emphasizes combining information from good
parents (crossover)
many variants, e.g., reproduction models, operators
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Genetic algorithms
ïŹ Holland’s

original GA is now known as the
simple genetic algorithm (SGA)
ïŹ Other GAs use different:
–
–
–
–

Representations
Mutations
Crossovers
Selection mechanisms
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

SGA technical summary tableau
Representation

Binary strings

Recombination

N-point or uniform

Mutation

Bitwise bit-flipping with fixed
probability

Parent selection

Fitness-Proportionate

Survivor selection

All children replace parents

Speciality

Emphasis on crossover
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Representation
Phenotype space

Genotype space =
{0,1}L

Encoding
(representation)

10010001
10010010
010001001
011101001

Decoding
(inverse representation)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

SGA reproduction cycle

1. Select parents for the mating pool
(size of mating pool = population size)
2. Shuffle the mating pool
3. For each consecutive pair apply crossover with
probability pc , otherwise copy parents
4. For each offspring apply mutation (bit-flip with
probability pm independently for each bit)
5. Replace the whole population with the resulting
offspring
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

SGA operators: 1-point crossover
ïŹ
ïŹ
ïŹ
ïŹ

Choose a random point on the two parents
Split parents at this crossover point
Create children by exchanging tails
Pc typically in range (0.6, 0.9)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

SGA operators: mutation
ïŹ
ïŹ

Alter each gene independently with a probability pm
pm is called the mutation rate
–

Typically between 1/pop_size and 1/ chromosome_length
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

SGA operators: Selection
ïŹ

Main idea: better individuals get higher chance
– Chances proportional to fitness
– Implementation: roulette wheel technique
ïŹ Assign to each individual a part of the
roulette wheel
ïŹ Spin the wheel n times to select n
individuals
1/6 = 17%

A
3/6 = 50%

B

C

2/6 = 33%

fitness(A) = 3
fitness(B) = 1
fitness(C) = 2
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

An example after Goldberg ‘89 (1)
ïŹ Simple

problem: max x2 over {0,1,
,31}
ïŹ GA approach:
–
–
–
–
–

Representation: binary code, e.g. 01101 ↔ 13
Population size: 4
1-point xover, bitwise mutation
Roulette wheel selection
Random initialisation

ïŹ We

show one generational cycle done by hand
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

x2 example: selection
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

X2 example: crossover
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

X2 example: mutation
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

The simple GA
ïŹ Has
–

been subject of many (early) studies

still often used as benchmark for novel GAs

ïŹ Shows
–
–
–
–

many shortcomings, e.g.

Representation is too restrictive
Mutation & crossovers only applicable for bit-string &
integer representations
Selection mechanism sensitive for converging
populations with close fitness values
Generational population model (step 5 in SGA repr.
cycle) can be improved with explicit survivor selection
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Alternative Crossover Operators
ïŹ

Performance with 1 Point Crossover depends on the
order that variables occur in the representation
–

more likely to keep together genes that are near
each other

–

Can never keep together genes from opposite ends
of string

–

This is known as Positional Bias

–

Can be exploited if we know about the structure of
our problem, but this is not usually the case
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

n-point crossover
ïŹ
ïŹ
ïŹ
ïŹ

Choose n random crossover points
Split along those points
Glue parts, alternating between parents
Generalisation of 1 point (still some positional bias)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Uniform crossover
ïŹ
ïŹ
ïŹ
ïŹ

Assign 'heads' to one parent, 'tails' to the other
Flip a coin for each gene of the first child
Make an inverse copy of the gene for the second child
Inheritance is independent of position
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Crossover OR mutation?
ïŹ

Decade long debate: which one is better / necessary /
main-background

ïŹ

Answer (at least, rather wide agreement):
–
–
–
–

it depends on the problem, but
in general, it is good to have both
both have another role
mutation-only-EA is possible, xover-only-EA would not work
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Crossover OR mutation? (cont’d)
Exploration: Discovering promising areas in the search
space, i.e. gaining information on the problem
Exploitation: Optimising within a promising area, i.e. using
information
There is co-operation AND competition between them
ïŹ

Crossover is explorative, it makes a big jump to an area

somewhere “in between” two (parent) areas
ïŹ

Mutation is exploitative, it creates random small

diversions, thereby staying near (in the area of ) the parent
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Crossover OR mutation? (cont’d)
ïŹ

Only crossover can combine information from two
parents

ïŹ

Only mutation can introduce new information (alleles)

ïŹ

Crossover does not change the allele frequencies of
the population (thought experiment: 50% 0’s on first
bit in the population, ?% after performing n
crossovers)

ïŹ

To hit the optimum you often need a ‘lucky’ mutation
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Other representations
ïŹ

Gray coding of integers (still binary chromosomes)
–

Gray coding is a mapping that means that small changes in
the genotype cause small changes in the phenotype (unlike
binary coding). “Smoother” genotype-phenotype mapping
makes life easier for the GA

Nowadays it is generally accepted that it is better to
encode numerical variables directly as
ïŹ

Integers

ïŹ

Floating point variables
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Integer representations
ïŹ

ïŹ

ïŹ
ïŹ

Some problems naturally have integer variables, e.g.
image processing parameters
Others take categorical values from a fixed set e.g.
{blue, green, yellow, pink}
N-point / uniform crossover operators work
Extend bit-flipping mutation to make
–
–
–

“creep” i.e. more likely to move to similar value
Random choice (esp. categorical variables)
For ordinal problems, it is hard to know correct range for
creep, so often use two mutation operators in tandem
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Real valued problems
ïŹ

ïŹ

Many problems occur as real valued problems, e.g.
continuous parameter optimisation f : ℜ n  ℜ
Illustration: Ackley’s function (often used in EC)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Mapping real values on bit strings
z ∈ [x,y] ⊆ ℜ represented by {a1,
,aL} ∈ {0,1}L
‱
∀

ïŹ
ïŹ
ïŹ

[x,y] → {0,1}L must be invertible (one phenotype per
genotype)
Γ: {0,1}L → [x,y] defines the representation

y − x L−1
Γ( a1 ,..., aL ) = x + L
⋅ ( ∑ aL− j ⋅ 2 j ) ∈ [ x, y ]
2 − 1 j =0

Only 2L values out of infinite are represented
L determines possible maximum precision of solution
High precision  long chromosomes (slow evolution)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Floating point mutations 1
General scheme of floating point mutations

â€Č
x = x1 , ..., xl → x â€Č = x1 , ..., xlâ€Č
xi , xiâ€Č ∈ [ LBi ,UBi ]
ïŹ Uniform

mutation:
xiâ€Č drawn randomly (uniform) from [ LBi ,UBi ]

ïŹ

Analogous to bit-flipping (binary) or random resetting
(integers)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Floating point mutations 2
ïŹ Non-uniform
–
–
–

–

mutations:

Many methods proposed,such as time-varying
range of change etc.
Most schemes are probabilistic but usually only
make a small change to value
Most common method is to add random deviate to
each variable separately, taken from N(0, σ)
Gaussian distribution and then curtail to range
Standard deviation σ controls amount of change
(2/3 of deviations will lie in range (- σ to + σ)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Crossover operators for real valued GAs
ïŹ Discrete:
–
–

each allele value in offspring z comes from one of its
parents (x,y) with equal probability: zi = xi or yi
Could use n-point or uniform

ïŹ Intermediate
–

exploits idea of creating children “between” parents
(hence a.k.a. arithmetic recombination)

–

zi = α xi + (1 - α) yi where α : 0 ≀ α ≀ 1.
The parameter α can be:

–

‱
‱
‱

constant: uniform arithmetical crossover
variable (e.g. depend on the age of the population)
picked at random every time
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Single arithmetic crossover
‱
‱
‱

Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ
Pick a single gene (k) at random,
child1 is: x , ..., x , α ⋅ y + (1 − α ) ⋅ x

‱

reverse for other child. e.g. with α = 0.5

1

k

k

k

, ..., xn
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Simple arithmetic crossover
‱
‱
‱

Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ
Pick random gene (k) after this point mix values
child1 is:

x , ..., x , α ⋅ y
+ (1 − α ) ⋅ x
, ..., α ⋅ y + (1 − α ) ⋅ x
1
k
k +1
k +1
n
n
‱

reverse for other child. e.g. with α = 0.5
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Whole arithmetic crossover
‱
‱
‱

Most commonly used
Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ
child1 is:

a ⋅ x + (1 − a) ⋅ y
‱

reverse for other child. e.g. with α = 0.5
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Permutation Representations
ïŹ
ïŹ

Ordering/sequencing problems form a special type
Task is (or can be solved by) arranging some objects in
a certain order
–
–

ïŹ

Example: sort algorithm: important thing is which elements
occur before others (order)
Example: Travelling Salesman Problem (TSP) : important thing
is which elements occur next to each other (adjacency)

These problems are generally expressed as a
permutation:
–

if there are n variables then the representation is as a list of n
integers, each of which occurs exactly once
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Permutation representation: TSP example
ïŹ

ïŹ

ïŹ

Problem:
‱ Given n cities
‱ Find a complete tour with
minimal length
Encoding:
‱ Label the cities 1, 2, 
 , n
‱ One complete tour is one
permutation (e.g. for n =4
[1,2,3,4], [3,4,2,1] are OK)
Search space is BIG:
for 30 cities there are 30! ≈ 1032
possible tours
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Mutation operators for permutations
ïŹ Normal

mutation operators lead to inadmissible
solutions
–
–

e.g. bit-wise mutation : let gene i have value j
changing to some other value k would mean that k
occurred twice and j no longer occurred

ïŹ Therefore

must change at least two values
ïŹ Mutation parameter now reflects the probability
that some operator is applied once to the
whole string, rather than individually in each
position
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Insert Mutation for permutations
ïŹ Pick

two allele values at random
ïŹ Move the second to follow the first, shifting the
rest along to accommodate
ïŹ Note that this preserves most of the order and
the adjacency information
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Swap mutation for permutations
ïŹ Pick

two alleles at random and swap their
positions
ïŹ Preserves most of adjacency information (4
links broken), disrupts order more
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Inversion mutation for permutations
ïŹ Pick

two alleles at random and then invert the
substring between them.
ïŹ Preserves most adjacency information (only
breaks two links) but disruptive of order
information
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Scramble mutation for permutations
ïŹ Pick

a subset of genes at random
ïŹ Randomly rearrange the alleles in those
positions

(note subset does not have to be contiguous)
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Crossover operators for permutations
ïŹ

“Normal” crossover operators will often lead to

inadmissible solutions
12345
54321
ïŹ Many

12321
54345

specialised operators have been devised
which focus on combining order or adjacency
information from the two parents
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Order 1 crossover
ïŹ
ïŹ

Idea is to preserve relative order that elements occur
Informal procedure:
1. Choose an arbitrary part from the first parent
2. Copy this part to the first child
3. Copy the numbers that are not in the first part, to
the first child:
ïŹstarting right from cut point of the copied part,
ïŹusing the order of the second parent
ïŹand wrapping around at the end
4. Analogous for the second child, with parent roles
reversed
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Order 1 crossover example
ïŹ

Copy randomly selected set from first parent

ïŹ

Copy rest from second parent in order 1,9,3,8,2
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Partially Mapped Crossover (PMX)
Informal procedure for parents P1 and P2:
1.
Choose random segment and copy it from P1
2.
Starting from the first crossover point look for elements in that
segment of P2 that have not been copied
3.
For each of these i look in the offspring to see what element j has
been copied in its place from P1
4.
Place i into the position occupied j in P2, since we know that we will
not be putting j there (as is already in offspring)
5.
If the place occupied by j in P2 has already been filled in the
offspring k, put i in the position occupied by k in P2
6.
Having dealt with the elements from the crossover segment, the
rest of the offspring can be filled from P2.
Second child is created analogously
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

PMX example
ïŹ

Step 1

ïŹ

Step 2

ïŹ

Step 3
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Cycle crossover
Basic idea:
Each allele comes from one parent together with its position.

Informal procedure:
1. Make a cycle of alleles from P1 in the following way.
(a) Start with the first allele of P1.
(b) Look at the allele at the same position in P2.
(c) Go to the position with the same allele in P1.
(d) Add this allele to the cycle.
(e) Repeat step b through d until you arrive at the first allele of P1.

2. Put the alleles of the cycle in the first child on the positions
they have in the first parent.
3. Take next cycle from second parent
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Cycle crossover example
ïŹ

Step 1: identify cycles

ïŹ

Step 2: copy alternate cycles into offspring
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Edge Recombination
ïŹ Works

by constructing a table listing which
edges are present in the two parents, if an
edge is common to both, mark with a +
ïŹ e.g. [1 2 3 4 5 6 7 8 9] and [9 3 7 8 2 6 5 1 4]
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Edge Recombination 2
Informal procedure once edge table is constructed
1. Pick an initial element at random and put it in the offspring
2. Set the variable current element = entry
3. Remove all references to current element from the table
4. Examine list for current element:
–
–
–

If there is a common edge, pick that to be next element
Otherwise pick the entry in the list which itself has the shortest list
Ties are split at random

5. In the case of reaching an empty list:
–
–

Examine the other end of the offspring is for extension
Otherwise a new element is chosen at random
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Edge Recombination example
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Multiparent recombination
ïŹ
ïŹ
ïŹ
ïŹ

Recall that we are not constricted by the practicalities
of nature
Noting that mutation uses 1 parent, and “traditional”
crossover 2, the extension to a>2 is natural to examine
Been around since 1960s, still rare but studies indicate
useful
Three main types:
–
–
–

Based on allele frequencies, e.g., p-sexual voting generalising
uniform crossover
Based on segmentation and recombination of the parents, e.g.,
diagonal crossover generalising n-point crossover
Based on numerical operations on real-valued alleles, e.g.,
center of mass crossover, generalising arithmetic
recombination operators
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Population Models
ïŹ SGA
–
–

uses a Generational model:

each individual survives for exactly one generation
the entire set of parents is replaced by the offspring

ïŹ At

the other end of the scale are Steady-State
models:
–
–

one offspring is generated per generation,
one member of population replaced,

ïŹ Generation
–
–

Gap

the proportion of the population replaced
1.0 for GGA, 1/pop_size for SSGA
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Fitness Based Competition
ïŹ Selection
–
–

Selection from current generation to take part in
mating (parent selection)
Selection from parents + offspring to go into next
generation (survivor selection)

ïŹ Selection
–

can occur in two places:

operators work on whole individual

i.e. they are representation-independent

ïŹ Distinction
–
–

between selection

operators: define selection probabilities
algorithms: define how probabilities are implemented
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Implementation example: SGA
ïŹ Expected

number of copies of an individual i
E( ni ) = ” ‱ f(i)/ 〈 fâŒȘ

(” = pop.size, f(i) = fitness of i, 〈fâŒȘ avg. fitness in pop.)
ïŹ Roulette
–

–

wheel algorithm:

Given a probability distribution, spin a 1-armed
wheel n times to make n selections
No guarantees on actual value of ni

ïŹ Baker’s

SUS algorithm:

–

n evenly spaced arms on wheel and spin once

–

Guarantees floor(E( ni ) ) ≀ ni ≀ ceil(E( ni ) )
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Fitness-Proportionate Selection
ïŹ Problems
–
–
–

One highly fit member can rapidly take over if rest of
population is much less fit: Premature Convergence
At end of runs when fitnesses are similar, lose
selection pressure
Highly susceptible to function transposition

ïŹ Scaling
–

can fix last two problems

Windowing: f’(i) = f(i) - ÎČ t
ïŹ where

–

include

ÎČ is worst fitness in this (last n) generations

Sigma Scaling: f’(i) = max( f(i) – (〈 f âŒȘ - c ‱ σf ), 0.0)
ïŹ where

c is a constant, usually 2.0
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Function transposition for FPS
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Rank – Based Selection
ïŹ Attempt

to remove problems of FPS by basing
selection probabilities on relative rather than
absolute fitness
ïŹ Rank population according to fitness and then
base selection probabilities on rank where
fittest has rank ” and worst rank 1
ïŹ This imposes a sorting overhead on the
algorithm, but this is usually negligible
compared to the fitness evaluation time
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Linear Ranking

ïŹ

ïŹ

Parameterised by factor s: 1.0 < s ≀ 2.0
– measures advantage of best individual
– in GGA this is the number of children allotted to it
Simple 3 member example
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Exponential Ranking

ïŹ Linear

Ranking is limited to selection pressure
ïŹ Exponential Ranking can allocate more than 2
copies to fittest individual
ïŹ Normalise constant factor c according to
population size
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Tournament Selection
ïŹ All

methods above rely on global population
statistics
–
–

ïŹ

Could be a bottleneck esp. on parallel machines
Relies on presence of external fitness function
which might not exist: e.g. evolving game players

Informal Procedure:
–
–

Pick k members at random then select the best of
these
Repeat to select more individuals
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Tournament Selection 2
ïŹ Probability
–
–

Rank of i
Size of sample k
ïŹ

–

higher k increases selection pressure

Whether contestants are picked with replacement
ïŹ Picking

–

ïŹ

of selecting i will depend on:

without replacement increases selection pressure

Whether fittest contestant always wins
(deterministic) or this happens with probability p

For k = 2, time for fittest individual to take over
population is the same as linear ranking with s = 2 ‱ p
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Survivor Selection
ïŹ Most

of methods above used for parent
selection
ïŹ Survivor selection can be divided into two
approaches:
–

Age-Based Selection
ïŹ e.g.

SGA
ïŹ In SSGA can implement as “delete-random” (not
recommended) or as first-in-first-out (a.k.a. delete-oldest)
–

Fitness-Based Selection
ïŹ Using

one of the methods above or
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Two Special Cases
ïŹ Elitism
–
–

Widely used in both population models (GGA,
SSGA)
Always keep at least one copy of the fittest solution
so far

ïŹ GENITOR:
–
–

a.k.a. “delete-worst”

From Whitley’s original Steady-State algorithm (he
also used linear ranking for parent selection)
Rapid takeover : use with large populations or “no
duplicates” policy
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Example application of order based GAs: JSSP
Precedence constrained job shop scheduling problem
ïŹ
ïŹ
ïŹ
ïŹ
ïŹ
ïŹ

J is a set of jobs.
O is a set of operations
M is a set of machines
Able ⊆ O × M defines which machines can perform which
operations
Pre ⊆ O × O defines which operation should precede which
Dur : ⊆ O × M → IR defines the duration of o ∈ O on m ∈ M

The goal is now to find a schedule that is:
ïŹ Complete: all jobs are scheduled
ïŹ Correct: all conditions defined by Able and Pre are satisfied
ïŹ Optimal: the total duration of the schedule is minimal
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

Precedence constrained job shop scheduling GA
ïŹ
ïŹ

Representation: individuals are permutations of operations
Permutations are decoded to schedules by a decoding procedure
–
–
–

take the first (next) operation from the individual
look up its machine (here we assume there is only one)
assign the earliest possible starting time on this machine, subject to
ïŹ
ïŹ

ïŹ

ïŹ
ïŹ
ïŹ
ïŹ

machine occupation
precedence relations holding for this operation in the schedule created so far

fitness of a permutation is the duration of the corresponding
schedule (to be minimized)
use any suitable mutation and crossover
use roulette wheel parent selection on inverse fitness
Generational GA model for survivor selection
use random initialisation
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic Algorithms

JSSP example: operator comparison

Weitere Àhnliche Inhalte

Was ist angesagt?

Intelligent system by SHAHIN ELAHI BOX
Intelligent system by SHAHIN ELAHI BOXIntelligent system by SHAHIN ELAHI BOX
Intelligent system by SHAHIN ELAHI BOX
Shahin Alam
 

Was ist angesagt? (20)

Genetic Algorithm by Example
Genetic Algorithm by ExampleGenetic Algorithm by Example
Genetic Algorithm by Example
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Introduction to deep learning
Introduction to deep learningIntroduction to deep learning
Introduction to deep learning
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Hill climbing algorithm
Hill climbing algorithmHill climbing algorithm
Hill climbing algorithm
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic Algorithm (GA) Optimization - Step-by-Step Example
Genetic Algorithm (GA) Optimization - Step-by-Step ExampleGenetic Algorithm (GA) Optimization - Step-by-Step Example
Genetic Algorithm (GA) Optimization - Step-by-Step Example
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GA
 
Introduction to Soft Computing
Introduction to Soft Computing Introduction to Soft Computing
Introduction to Soft Computing
 
Introduction to Computational Intelligent
Introduction to Computational IntelligentIntroduction to Computational Intelligent
Introduction to Computational Intelligent
 
Evolutionary Computing
Evolutionary ComputingEvolutionary Computing
Evolutionary Computing
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
 
Knowledge representation and reasoning
Knowledge representation and reasoningKnowledge representation and reasoning
Knowledge representation and reasoning
 
Evolutionary Computing - Genetic Algorithms - An Introduction
Evolutionary Computing - Genetic Algorithms - An IntroductionEvolutionary Computing - Genetic Algorithms - An Introduction
Evolutionary Computing - Genetic Algorithms - An Introduction
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
 
Neuro-Fuzzy Controller
Neuro-Fuzzy ControllerNeuro-Fuzzy Controller
Neuro-Fuzzy Controller
 
Genetic programming
Genetic programmingGenetic programming
Genetic programming
 
Intelligent system by SHAHIN ELAHI BOX
Intelligent system by SHAHIN ELAHI BOXIntelligent system by SHAHIN ELAHI BOX
Intelligent system by SHAHIN ELAHI BOX
 
LLaMA Open and Efficient Foundation Language Models - 230528.pdf
LLaMA Open and Efficient Foundation Language Models - 230528.pdfLLaMA Open and Efficient Foundation Language Models - 230528.pdf
LLaMA Open and Efficient Foundation Language Models - 230528.pdf
 

Andere mochten auch

Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
anas_elf
 
soft-computing
 soft-computing soft-computing
soft-computing
student
 
Soft computing
Soft computingSoft computing
Soft computing
ganeshpaul6
 

Andere mochten auch (14)

Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
 
Fuzzy Genetic Algorithm
Fuzzy Genetic AlgorithmFuzzy Genetic Algorithm
Fuzzy Genetic Algorithm
 
Genetic algorithm raktim
Genetic algorithm raktimGenetic algorithm raktim
Genetic algorithm raktim
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
 
Basics of Soft Computing
Basics of Soft  Computing Basics of Soft  Computing
Basics of Soft Computing
 
soft-computing
 soft-computing soft-computing
soft-computing
 
RM 701 Genetic Algorithm and Fuzzy Logic lecture
RM 701 Genetic Algorithm and Fuzzy Logic lectureRM 701 Genetic Algorithm and Fuzzy Logic lecture
RM 701 Genetic Algorithm and Fuzzy Logic lecture
 
Genetic Algorithms Made Easy
Genetic Algorithms Made EasyGenetic Algorithms Made Easy
Genetic Algorithms Made Easy
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
Soft computing
Soft computingSoft computing
Soft computing
 
Genetic Algorithms - Artificial Intelligence
Genetic Algorithms - Artificial IntelligenceGenetic Algorithms - Artificial Intelligence
Genetic Algorithms - Artificial Intelligence
 
Mutations powerpoint
Mutations powerpointMutations powerpoint
Mutations powerpoint
 

Ähnlich wie Genetic algorithms

Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
guest9938738
 
04 1 evolution
04 1 evolution04 1 evolution
04 1 evolution
Tianlu Wang
 
Evolutionary-Algorithms.ppt
Evolutionary-Algorithms.pptEvolutionary-Algorithms.ppt
Evolutionary-Algorithms.ppt
lakshmi.ec
 

Ähnlich wie Genetic algorithms (20)

Genetic_Algorithms.ppt
Genetic_Algorithms.pptGenetic_Algorithms.ppt
Genetic_Algorithms.ppt
 
Genetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .pptGenetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .ppt
 
Genetic_Algorithms.ppt
Genetic_Algorithms.pptGenetic_Algorithms.ppt
Genetic_Algorithms.ppt
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
GENETIC ALGORITHM
GENETIC ALGORITHMGENETIC ALGORITHM
GENETIC ALGORITHM
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Memetic_Algorithms in evolutionary .ppt
Memetic_Algorithms in evolutionary  .pptMemetic_Algorithms in evolutionary  .ppt
Memetic_Algorithms in evolutionary .ppt
 
evolutionary algo's.ppt
evolutionary algo's.pptevolutionary algo's.ppt
evolutionary algo's.ppt
 
chapter01.ppt
chapter01.pptchapter01.ppt
chapter01.ppt
 
1 Evolutionary computing 6_2021_02_23!01_01_01_PM.ppt
1 Evolutionary computing 6_2021_02_23!01_01_01_PM.ppt1 Evolutionary computing 6_2021_02_23!01_01_01_PM.ppt
1 Evolutionary computing 6_2021_02_23!01_01_01_PM.ppt
 
GA.pptx
GA.pptxGA.pptx
GA.pptx
 
Introduction to Evolutionary Computations. Akira Imada
Introduction to Evolutionary Computations. Akira ImadaIntroduction to Evolutionary Computations. Akira Imada
Introduction to Evolutionary Computations. Akira Imada
 
Evolutionary Algorithms
Evolutionary AlgorithmsEvolutionary Algorithms
Evolutionary Algorithms
 
04 1 evolution
04 1 evolution04 1 evolution
04 1 evolution
 
Gadoc
GadocGadoc
Gadoc
 
NNFL 15- Guru Nanak Dev Engineering College
NNFL   15- Guru Nanak Dev Engineering CollegeNNFL   15- Guru Nanak Dev Engineering College
NNFL 15- Guru Nanak Dev Engineering College
 
Evolutionary-Algorithms.ppt
Evolutionary-Algorithms.pptEvolutionary-Algorithms.ppt
Evolutionary-Algorithms.ppt
 
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real  Vijay Bhaskar SemwalGenetic algorithm (ga) binary and real  Vijay Bhaskar Semwal
Genetic algorithm (ga) binary and real Vijay Bhaskar Semwal
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Ga
GaGa
Ga
 

KĂŒrzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

KĂŒrzlich hochgeladen (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 

Genetic algorithms

  • 2. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms GA Quick Overview ïŹ ïŹ ïŹ Developed: USA in the 1970’s Early names: J. Holland, K. DeJong, D. Goldberg Typically applied to: – ïŹ Attributed features: – – ïŹ discrete optimization not too fast good heuristic for combinatorial problems Special Features: – – Traditionally emphasizes combining information from good parents (crossover) many variants, e.g., reproduction models, operators
  • 3. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Genetic algorithms ïŹ Holland’s original GA is now known as the simple genetic algorithm (SGA) ïŹ Other GAs use different: – – – – Representations Mutations Crossovers Selection mechanisms
  • 4. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms SGA technical summary tableau Representation Binary strings Recombination N-point or uniform Mutation Bitwise bit-flipping with fixed probability Parent selection Fitness-Proportionate Survivor selection All children replace parents Speciality Emphasis on crossover
  • 5. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Representation Phenotype space Genotype space = {0,1}L Encoding (representation) 10010001 10010010 010001001 011101001 Decoding (inverse representation)
  • 6. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms SGA reproduction cycle 1. Select parents for the mating pool (size of mating pool = population size) 2. Shuffle the mating pool 3. For each consecutive pair apply crossover with probability pc , otherwise copy parents 4. For each offspring apply mutation (bit-flip with probability pm independently for each bit) 5. Replace the whole population with the resulting offspring
  • 7. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms SGA operators: 1-point crossover ïŹ ïŹ ïŹ ïŹ Choose a random point on the two parents Split parents at this crossover point Create children by exchanging tails Pc typically in range (0.6, 0.9)
  • 8. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms SGA operators: mutation ïŹ ïŹ Alter each gene independently with a probability pm pm is called the mutation rate – Typically between 1/pop_size and 1/ chromosome_length
  • 9. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms SGA operators: Selection ïŹ Main idea: better individuals get higher chance – Chances proportional to fitness – Implementation: roulette wheel technique ïŹ Assign to each individual a part of the roulette wheel ïŹ Spin the wheel n times to select n individuals 1/6 = 17% A 3/6 = 50% B C 2/6 = 33% fitness(A) = 3 fitness(B) = 1 fitness(C) = 2
  • 10. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms An example after Goldberg ‘89 (1) ïŹ Simple problem: max x2 over {0,1,
,31} ïŹ GA approach: – – – – – Representation: binary code, e.g. 01101 ↔ 13 Population size: 4 1-point xover, bitwise mutation Roulette wheel selection Random initialisation ïŹ We show one generational cycle done by hand
  • 11. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms x2 example: selection
  • 12. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms X2 example: crossover
  • 13. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms X2 example: mutation
  • 14. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms The simple GA ïŹ Has – been subject of many (early) studies still often used as benchmark for novel GAs ïŹ Shows – – – – many shortcomings, e.g. Representation is too restrictive Mutation & crossovers only applicable for bit-string & integer representations Selection mechanism sensitive for converging populations with close fitness values Generational population model (step 5 in SGA repr. cycle) can be improved with explicit survivor selection
  • 15. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Alternative Crossover Operators ïŹ Performance with 1 Point Crossover depends on the order that variables occur in the representation – more likely to keep together genes that are near each other – Can never keep together genes from opposite ends of string – This is known as Positional Bias – Can be exploited if we know about the structure of our problem, but this is not usually the case
  • 16. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms n-point crossover ïŹ ïŹ ïŹ ïŹ Choose n random crossover points Split along those points Glue parts, alternating between parents Generalisation of 1 point (still some positional bias)
  • 17. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Uniform crossover ïŹ ïŹ ïŹ ïŹ Assign 'heads' to one parent, 'tails' to the other Flip a coin for each gene of the first child Make an inverse copy of the gene for the second child Inheritance is independent of position
  • 18. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Crossover OR mutation? ïŹ Decade long debate: which one is better / necessary / main-background ïŹ Answer (at least, rather wide agreement): – – – – it depends on the problem, but in general, it is good to have both both have another role mutation-only-EA is possible, xover-only-EA would not work
  • 19. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Crossover OR mutation? (cont’d) Exploration: Discovering promising areas in the search space, i.e. gaining information on the problem Exploitation: Optimising within a promising area, i.e. using information There is co-operation AND competition between them ïŹ Crossover is explorative, it makes a big jump to an area somewhere “in between” two (parent) areas ïŹ Mutation is exploitative, it creates random small diversions, thereby staying near (in the area of ) the parent
  • 20. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Crossover OR mutation? (cont’d) ïŹ Only crossover can combine information from two parents ïŹ Only mutation can introduce new information (alleles) ïŹ Crossover does not change the allele frequencies of the population (thought experiment: 50% 0’s on first bit in the population, ?% after performing n crossovers) ïŹ To hit the optimum you often need a ‘lucky’ mutation
  • 21. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Other representations ïŹ Gray coding of integers (still binary chromosomes) – Gray coding is a mapping that means that small changes in the genotype cause small changes in the phenotype (unlike binary coding). “Smoother” genotype-phenotype mapping makes life easier for the GA Nowadays it is generally accepted that it is better to encode numerical variables directly as ïŹ Integers ïŹ Floating point variables
  • 22. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Integer representations ïŹ ïŹ ïŹ ïŹ Some problems naturally have integer variables, e.g. image processing parameters Others take categorical values from a fixed set e.g. {blue, green, yellow, pink} N-point / uniform crossover operators work Extend bit-flipping mutation to make – – – “creep” i.e. more likely to move to similar value Random choice (esp. categorical variables) For ordinal problems, it is hard to know correct range for creep, so often use two mutation operators in tandem
  • 23. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Real valued problems ïŹ ïŹ Many problems occur as real valued problems, e.g. continuous parameter optimisation f : ℜ n  ℜ Illustration: Ackley’s function (often used in EC)
  • 24. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Mapping real values on bit strings z ∈ [x,y] ⊆ ℜ represented by {a1,
,aL} ∈ {0,1}L ‱ ∀ ïŹ ïŹ ïŹ [x,y] → {0,1}L must be invertible (one phenotype per genotype) Γ: {0,1}L → [x,y] defines the representation y − x L−1 Γ( a1 ,..., aL ) = x + L ⋅ ( ∑ aL− j ⋅ 2 j ) ∈ [ x, y ] 2 − 1 j =0 Only 2L values out of infinite are represented L determines possible maximum precision of solution High precision  long chromosomes (slow evolution)
  • 25. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Floating point mutations 1 General scheme of floating point mutations â€Č x = x1 , ..., xl → x â€Č = x1 , ..., xlâ€Č xi , xiâ€Č ∈ [ LBi ,UBi ] ïŹ Uniform mutation: xiâ€Č drawn randomly (uniform) from [ LBi ,UBi ] ïŹ Analogous to bit-flipping (binary) or random resetting (integers)
  • 26. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Floating point mutations 2 ïŹ Non-uniform – – – – mutations: Many methods proposed,such as time-varying range of change etc. Most schemes are probabilistic but usually only make a small change to value Most common method is to add random deviate to each variable separately, taken from N(0, σ) Gaussian distribution and then curtail to range Standard deviation σ controls amount of change (2/3 of deviations will lie in range (- σ to + σ)
  • 27. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Crossover operators for real valued GAs ïŹ Discrete: – – each allele value in offspring z comes from one of its parents (x,y) with equal probability: zi = xi or yi Could use n-point or uniform ïŹ Intermediate – exploits idea of creating children “between” parents (hence a.k.a. arithmetic recombination) – zi = α xi + (1 - α) yi where α : 0 ≀ α ≀ 1. The parameter α can be: – ‱ ‱ ‱ constant: uniform arithmetical crossover variable (e.g. depend on the age of the population) picked at random every time
  • 28. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Single arithmetic crossover ‱ ‱ ‱ Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ Pick a single gene (k) at random, child1 is: x , ..., x , α ⋅ y + (1 − α ) ⋅ x ‱ reverse for other child. e.g. with α = 0.5 1 k k k , ..., xn
  • 29. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Simple arithmetic crossover ‱ ‱ ‱ Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ Pick random gene (k) after this point mix values child1 is: x , ..., x , α ⋅ y + (1 − α ) ⋅ x , ..., α ⋅ y + (1 − α ) ⋅ x 1 k k +1 k +1 n n ‱ reverse for other child. e.g. with α = 0.5
  • 30. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Whole arithmetic crossover ‱ ‱ ‱ Most commonly used Parents: 〈x1,
,xn âŒȘ and 〈y1,
,ynâŒȘ child1 is: a ⋅ x + (1 − a) ⋅ y ‱ reverse for other child. e.g. with α = 0.5
  • 31. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Permutation Representations ïŹ ïŹ Ordering/sequencing problems form a special type Task is (or can be solved by) arranging some objects in a certain order – – ïŹ Example: sort algorithm: important thing is which elements occur before others (order) Example: Travelling Salesman Problem (TSP) : important thing is which elements occur next to each other (adjacency) These problems are generally expressed as a permutation: – if there are n variables then the representation is as a list of n integers, each of which occurs exactly once
  • 32. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Permutation representation: TSP example ïŹ ïŹ ïŹ Problem: ‱ Given n cities ‱ Find a complete tour with minimal length Encoding: ‱ Label the cities 1, 2, 
 , n ‱ One complete tour is one permutation (e.g. for n =4 [1,2,3,4], [3,4,2,1] are OK) Search space is BIG: for 30 cities there are 30! ≈ 1032 possible tours
  • 33. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Mutation operators for permutations ïŹ Normal mutation operators lead to inadmissible solutions – – e.g. bit-wise mutation : let gene i have value j changing to some other value k would mean that k occurred twice and j no longer occurred ïŹ Therefore must change at least two values ïŹ Mutation parameter now reflects the probability that some operator is applied once to the whole string, rather than individually in each position
  • 34. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Insert Mutation for permutations ïŹ Pick two allele values at random ïŹ Move the second to follow the first, shifting the rest along to accommodate ïŹ Note that this preserves most of the order and the adjacency information
  • 35. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Swap mutation for permutations ïŹ Pick two alleles at random and swap their positions ïŹ Preserves most of adjacency information (4 links broken), disrupts order more
  • 36. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Inversion mutation for permutations ïŹ Pick two alleles at random and then invert the substring between them. ïŹ Preserves most adjacency information (only breaks two links) but disruptive of order information
  • 37. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Scramble mutation for permutations ïŹ Pick a subset of genes at random ïŹ Randomly rearrange the alleles in those positions (note subset does not have to be contiguous)
  • 38. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Crossover operators for permutations ïŹ “Normal” crossover operators will often lead to inadmissible solutions 12345 54321 ïŹ Many 12321 54345 specialised operators have been devised which focus on combining order or adjacency information from the two parents
  • 39. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Order 1 crossover ïŹ ïŹ Idea is to preserve relative order that elements occur Informal procedure: 1. Choose an arbitrary part from the first parent 2. Copy this part to the first child 3. Copy the numbers that are not in the first part, to the first child: ïŹstarting right from cut point of the copied part, ïŹusing the order of the second parent ïŹand wrapping around at the end 4. Analogous for the second child, with parent roles reversed
  • 40. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Order 1 crossover example ïŹ Copy randomly selected set from first parent ïŹ Copy rest from second parent in order 1,9,3,8,2
  • 41. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Partially Mapped Crossover (PMX) Informal procedure for parents P1 and P2: 1. Choose random segment and copy it from P1 2. Starting from the first crossover point look for elements in that segment of P2 that have not been copied 3. For each of these i look in the offspring to see what element j has been copied in its place from P1 4. Place i into the position occupied j in P2, since we know that we will not be putting j there (as is already in offspring) 5. If the place occupied by j in P2 has already been filled in the offspring k, put i in the position occupied by k in P2 6. Having dealt with the elements from the crossover segment, the rest of the offspring can be filled from P2. Second child is created analogously
  • 42. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms PMX example ïŹ Step 1 ïŹ Step 2 ïŹ Step 3
  • 43. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Cycle crossover Basic idea: Each allele comes from one parent together with its position. Informal procedure: 1. Make a cycle of alleles from P1 in the following way. (a) Start with the first allele of P1. (b) Look at the allele at the same position in P2. (c) Go to the position with the same allele in P1. (d) Add this allele to the cycle. (e) Repeat step b through d until you arrive at the first allele of P1. 2. Put the alleles of the cycle in the first child on the positions they have in the first parent. 3. Take next cycle from second parent
  • 44. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Cycle crossover example ïŹ Step 1: identify cycles ïŹ Step 2: copy alternate cycles into offspring
  • 45. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Edge Recombination ïŹ Works by constructing a table listing which edges are present in the two parents, if an edge is common to both, mark with a + ïŹ e.g. [1 2 3 4 5 6 7 8 9] and [9 3 7 8 2 6 5 1 4]
  • 46. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Edge Recombination 2 Informal procedure once edge table is constructed 1. Pick an initial element at random and put it in the offspring 2. Set the variable current element = entry 3. Remove all references to current element from the table 4. Examine list for current element: – – – If there is a common edge, pick that to be next element Otherwise pick the entry in the list which itself has the shortest list Ties are split at random 5. In the case of reaching an empty list: – – Examine the other end of the offspring is for extension Otherwise a new element is chosen at random
  • 47. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Edge Recombination example
  • 48. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Multiparent recombination ïŹ ïŹ ïŹ ïŹ Recall that we are not constricted by the practicalities of nature Noting that mutation uses 1 parent, and “traditional” crossover 2, the extension to a>2 is natural to examine Been around since 1960s, still rare but studies indicate useful Three main types: – – – Based on allele frequencies, e.g., p-sexual voting generalising uniform crossover Based on segmentation and recombination of the parents, e.g., diagonal crossover generalising n-point crossover Based on numerical operations on real-valued alleles, e.g., center of mass crossover, generalising arithmetic recombination operators
  • 49. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Population Models ïŹ SGA – – uses a Generational model: each individual survives for exactly one generation the entire set of parents is replaced by the offspring ïŹ At the other end of the scale are Steady-State models: – – one offspring is generated per generation, one member of population replaced, ïŹ Generation – – Gap the proportion of the population replaced 1.0 for GGA, 1/pop_size for SSGA
  • 50. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Fitness Based Competition ïŹ Selection – – Selection from current generation to take part in mating (parent selection) Selection from parents + offspring to go into next generation (survivor selection) ïŹ Selection – can occur in two places: operators work on whole individual i.e. they are representation-independent ïŹ Distinction – – between selection operators: define selection probabilities algorithms: define how probabilities are implemented
  • 51. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Implementation example: SGA ïŹ Expected number of copies of an individual i E( ni ) = ” ‱ f(i)/ 〈 fâŒȘ (” = pop.size, f(i) = fitness of i, 〈fâŒȘ avg. fitness in pop.) ïŹ Roulette – – wheel algorithm: Given a probability distribution, spin a 1-armed wheel n times to make n selections No guarantees on actual value of ni ïŹ Baker’s SUS algorithm: – n evenly spaced arms on wheel and spin once – Guarantees floor(E( ni ) ) ≀ ni ≀ ceil(E( ni ) )
  • 52. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Fitness-Proportionate Selection ïŹ Problems – – – One highly fit member can rapidly take over if rest of population is much less fit: Premature Convergence At end of runs when fitnesses are similar, lose selection pressure Highly susceptible to function transposition ïŹ Scaling – can fix last two problems Windowing: f’(i) = f(i) - ÎČ t ïŹ where – include ÎČ is worst fitness in this (last n) generations Sigma Scaling: f’(i) = max( f(i) – (〈 f âŒȘ - c ‱ σf ), 0.0) ïŹ where c is a constant, usually 2.0
  • 53. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Function transposition for FPS
  • 54. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Rank – Based Selection ïŹ Attempt to remove problems of FPS by basing selection probabilities on relative rather than absolute fitness ïŹ Rank population according to fitness and then base selection probabilities on rank where fittest has rank ” and worst rank 1 ïŹ This imposes a sorting overhead on the algorithm, but this is usually negligible compared to the fitness evaluation time
  • 55. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Linear Ranking ïŹ ïŹ Parameterised by factor s: 1.0 < s ≀ 2.0 – measures advantage of best individual – in GGA this is the number of children allotted to it Simple 3 member example
  • 56. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Exponential Ranking ïŹ Linear Ranking is limited to selection pressure ïŹ Exponential Ranking can allocate more than 2 copies to fittest individual ïŹ Normalise constant factor c according to population size
  • 57. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Tournament Selection ïŹ All methods above rely on global population statistics – – ïŹ Could be a bottleneck esp. on parallel machines Relies on presence of external fitness function which might not exist: e.g. evolving game players Informal Procedure: – – Pick k members at random then select the best of these Repeat to select more individuals
  • 58. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Tournament Selection 2 ïŹ Probability – – Rank of i Size of sample k ïŹ – higher k increases selection pressure Whether contestants are picked with replacement ïŹ Picking – ïŹ of selecting i will depend on: without replacement increases selection pressure Whether fittest contestant always wins (deterministic) or this happens with probability p For k = 2, time for fittest individual to take over population is the same as linear ranking with s = 2 ‱ p
  • 59. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Survivor Selection ïŹ Most of methods above used for parent selection ïŹ Survivor selection can be divided into two approaches: – Age-Based Selection ïŹ e.g. SGA ïŹ In SSGA can implement as “delete-random” (not recommended) or as first-in-first-out (a.k.a. delete-oldest) – Fitness-Based Selection ïŹ Using one of the methods above or
  • 60. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Two Special Cases ïŹ Elitism – – Widely used in both population models (GGA, SSGA) Always keep at least one copy of the fittest solution so far ïŹ GENITOR: – – a.k.a. “delete-worst” From Whitley’s original Steady-State algorithm (he also used linear ranking for parent selection) Rapid takeover : use with large populations or “no duplicates” policy
  • 61. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Example application of order based GAs: JSSP Precedence constrained job shop scheduling problem ïŹ ïŹ ïŹ ïŹ ïŹ ïŹ J is a set of jobs. O is a set of operations M is a set of machines Able ⊆ O × M defines which machines can perform which operations Pre ⊆ O × O defines which operation should precede which Dur : ⊆ O × M → IR defines the duration of o ∈ O on m ∈ M The goal is now to find a schedule that is: ïŹ Complete: all jobs are scheduled ïŹ Correct: all conditions defined by Able and Pre are satisfied ïŹ Optimal: the total duration of the schedule is minimal
  • 62. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms Precedence constrained job shop scheduling GA ïŹ ïŹ Representation: individuals are permutations of operations Permutations are decoded to schedules by a decoding procedure – – – take the first (next) operation from the individual look up its machine (here we assume there is only one) assign the earliest possible starting time on this machine, subject to ïŹ ïŹ ïŹ ïŹ ïŹ ïŹ ïŹ machine occupation precedence relations holding for this operation in the schedule created so far fitness of a permutation is the duration of the corresponding schedule (to be minimized) use any suitable mutation and crossover use roulette wheel parent selection on inverse fitness Generational GA model for survivor selection use random initialisation
  • 63. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms JSSP example: operator comparison