+ All Categories
Home > Documents > Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j....

Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j....

Date post: 11-Jan-2016
Category:
Upload: megan-fox
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
57
Kuban State University Krasnodar, Russia Genetic algorithms: an Genetic algorithms: an introduction introduction Artem Eremin, j. researcher, IMMI KSU
Transcript
Page 1: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Kuban State UniversityKrasnodar, Russia

Genetic algorithms: an Genetic algorithms: an introductionintroduction

Artem Eremin,

j. researcher, IMMI KSU

Page 2: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Motivation

Page 3: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Motivation

Page 4: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Motivation

Material properties (Cij) - ???

• Doppler laservibrometry for measuring

out-of-plane velocities

experimental data

• Time-of-Flight (TOF) with wavelet

transform

TOF

Wavelet transform

g

dc

TOF

min ?ijC

F 2, ,

1

: ( )pN

g j g jj

F c c

Page 5: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Optimization

“Optimization is the process of making something better”

Every day we subconsciouslysolve some optimization problems!

Page 6: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Optimization

Page 7: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Minimum-seeking algorithms

1. Exhaustive Search = Brute Force

2. Analytical Optimization

3. Nelder-Mead downhill Simplex Method

4. Optimization based on Line Minimization (the coordinate search method, the steepest descent algorithm, Newton’s method, Davidon-Fletcher-Powell (DFP) algorithm, etc …)

2

( ) 0, ?f

fx

x

Page 8: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Minimum-seeking algorithms

1 – 4 can converge to a local minimum!

Natural optimization methodsNot the panacea, but …

Genetic algorithms(Holland, 1975)

Simulated annealing(Kirkpatrick et al., 1983)

Particle swarm optimization(Parsopoulos and Vrahatis, 2002)

Evolutionary algorithms(Schwefel, 1995)

No derivatives, large search spaces, “nature-based”

Page 9: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Biological background (Cell and Chromosomes)• Every animal cell is a complex of many small “factories” working

together; the center of this all is the cell nucleus; the nucleus contains the genetic information in chromosomes - strings of DNA

• Each chromosome contains a set of genes - blocks of DNA

• Each gene determines some aspect of the organism (like eye colour)

• A collection of genes is sometimes called a genotype

• A collection of aspects (like eye colour) is sometimes called a phenotype

Page 10: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Biological background (Reproduction)Organisms produce a number of offspring similar to themselves but can have variations due to:

– Mutations (random changes)

– Sexual reproduction (offspring have combinations of features inherited from each parent)

+

Page 11: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

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: survival of the fittest.

• Important aspects in natural selection are: adaptation to the environment and isolation of populations in different groups which cannot mutually mate

Page 12: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Genetic algorithms (GA)

GA were initially developed by John Holland, University of Michigan (1970’s)

Popularized by his student David Goldberg (solved some very complex engineering problems, 1989)

Based on ideas from Darwinian Evolution

Provide efficient techniques for optimization and machine learning applications; widely used in business, science and engineering

Page 13: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

GA main features

• Optimizes with continuous or discrete variables

• Doesn’t require derivative information

• Simultaneously searches from a wide sampling of the cost surface

• Deals with a large number of variables

• Is well suited for parallel computers

• Optimizes variables with extremely complex cost surfaces (they can jump out of a local minimum)

• Provides a list of optimum variables, not just a single solution

• May encode the variables so that the optimization is done with the encoded variables

• Works with numerically generated data, experimental data, or analytical functions.

Page 14: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

To start with…

Genotype space = {0,1}L

Phenotype space

Encoding (representation)

Decoding(inverse representation)

011101001

010001001

10010010

10010001

( , ) sin 4 1.1 sin 2

0 , 10

f x y y x x y

x y

x

y

0 10

10

Page 15: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

To start with…

Gene – a single encoding of part of the solution space, i.e. either single bits or short blocks of adjacent bits that encode an element of the candidate solution

1 0 0 1 4.1

xChromosome – a string of genes that represents a solution

0 1 1 0 1 0 0 1+

Population – the number of chromosomes available to test

Page 16: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Chromosomes

Chromosomes can be:– Bit strings (0110, 0011, 1101, …)– Real numbers (33.2, -12.11, 5.32, …)– Permutations of elements (1234, 3241, 4312, …)– Lists of rules (R1, R2, R3, …Rn…)– Program elements(genetic programming)– …

Chromosome = array of Nvar variables (genes) pi

var1 2[ , , ... , ]Nchromosome p p p

( )cost f chromosome

chromosomespopN

Page 17: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

How does it works?

produce an initial population of individuals

evaluate the fitness of all individuals

while termination condition not met do

select fitter individuals for reproduction

recombine between individuals

mutate individuals

evaluate the fitness of the modified individuals

generate a new population

End while

So…

Page 18: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

How does it works?

The Evolutionary Cycle

selection

population evaluation

modification

discard

deleted members

parents

modifiedoffspring

evaluated offspring

initiate & evaluate

Or so…

Page 19: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Generation of the initial population[ , ]i i ip a b

random[0,1] ( )

1,i i i i

var

p a b a

i N

Coding: 4.25 01101101...

s1 = 1111010101 f (s1) = 7s2 = 0111000101 f (s2) = 5s3 = 1110110101 f (s3) = 7s4 = 0100010011 f (s4) = 4s5 = 1110111101 f (s5) = 8s6 = 0100110000 f (s6) = 3

Ex.Npop=6

Page 20: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Selection

[0.4,0.6]

keep rate pop

rate

N X N

X

or

, save!i tri f f

We are kind! Let’s save everybody!

Mating pool

Page 21: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Selection

,keep pop keepN N N

1. Pairing from top to bottom1

2 1...

keep

keep

NN

2. Random pairing ,1

,2

random[1, ]random[1, ]

c keep

c keep

s Ns N

3. Weighted random pairingroulette wheel weighting

Page 22: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Selection

The roulette wheel method:

21n

3

Area is proportional to fitness value

Individual i will have a probability to be chosen i

if

if

)(

)(

4

We repeat the extraction as many times as it is necessary

Page 23: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Selection

4. Tournament selection

1. Zenit 50

2. CSKA 48

16. Krylia Sovietov 14

a) randomly pick a small subsetb) perform a “tournament”c) “the winner takes it all”

Tournament + Threshold = No SORTING!!!

Page 24: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Mating (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)

Simple 1-point crossover

• 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

Page 25: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Mating (Crossover)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)

Page 26: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Mating (Crossover)Uniform crossover

Uniform crossover looks at each bit in the parents and randomly assigns the bit from one parent to one offspring and the bit from the other parent to the other offspring

Page 27: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Mutation

• Alter each gene (or, bit) independently with a probability pm

• pm is called the mutation rate

• Typically between 1/Npop and 1/[s]

Page 28: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Crossover or/and Mutation

• A 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-GA is possible, crossover-only-GA would not work

Page 29: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Crossover or/and Mutation

• 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

• Only crossover can combine information from two parents

• Only mutation can introduce new information

• To hit the optimum you often need a ‘lucky’ mutation

Page 30: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Mapping real values on bit strings

pi [ai, bi] R represented by {a1,…,aL} {0,1}L

• [ai, bi] {0,1}L must be invertible (one phenotype per

genotype)

: {0,1}L [ai, bi] defines the representation

• Only 2L values out of infinite are represented

• L determines possible maximum precision of solution

• High precision long chromosomes (slow evolution)

1

10

( ,..., ) ( 2 ) [ , ]2 1

Lji i

L i L j i iLj

b aa a a a a b

Real valued problems

Page 31: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

General scheme of floating point mutations

• Uniform mutation:

• Analogous to bit-flipping (binary) or random resetting

(integers)

1 2 1 2( , ,..., ) ' ( ' , ' ,..., ' )pop popN Ns p p p s p p p

, ' ,i i i ip p a b

' drawn randomly (uniform) from ,i i ip a b

Floating point mutations

Page 32: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• 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 + )

Floating point mutations

Page 33: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Discrete:– each gene 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

Crossover for real valued GAs

Page 34: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Parents: x1,…,xn and y1,…,yn• Pick a single gene (k) at random, • child1 is:

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

nkkk xxyxx ..., ,)1( , ..., ,1

Single arithmetic crossover

Page 35: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Parents: x1,…,xn and y1,…,yn• Pick random gene (k) after this point mix values• child1 is:

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

nx

kx

ky

kxx )1(

ny ..., ,

1)1(

1 , ..., ,

1

Simple arithmetic crossover

Page 36: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Most commonly used• Parents: x1,…,xn and y1,…,yn• child1 is:

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

yaxa )1(

“Whole” arithmetic crossover

Page 37: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

First generation (random values)

Tournament selection

SBX crossover

Select fittest individual

Start new generation

Good results? Enough iterations?

resultYes

No

micro-GA

Page 38: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Benefits of GA

• Concept is easy to understand

• Modular–separate from application (representation); building blocks can be used in hybrid applications

• Supports multi-objective optimization

• Good for “noisy”environment

• Always results in an answer, which becomes better and better with time

• Can easily run in parallel

• The fitness function can be changed from iteration to iteration, which allows incorporating new data in the model if it becomes available

Page 39: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Issues with GA

Choosing parameters:–Population size–Crossover and mutation probabilities–Selection, deletion policies–Crossover, mutation operators, etc.–Termination criteria

Performance:–Can be too slow but covers a large search space–Is only as good as the fitness function

Page 40: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Examples

Page 41: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Experimental specimens

4 CFRP–plates

2,35mmH [0 ,90 ,90 ,0 ]o o o o

2,25mmH [0 ,0 ,0 ,0 ]o o o o

60%fV 58%fV

Page 42: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Material properties

107 2% GPa; 8.9 2% GPa

2.82 2% GPa; 4.38 1% GPa

0.25 0.32; 0.49 0.56

x y z

yz xz yz

xz xy yz

E E E

G G G

110.5 7.0 7.0 0 0 0

7.0 13.8 8.2 0 0 0

7.0 8.2 13.8 0 0 0GPa

0 0 0 2.8 0 0

0 0 0 0 4.37 0

0 0 0 0 0 4.37

C

Page 43: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Comparison of results

0 modea

0o

90o

Page 44: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Comparison of results

0 modes

0o

90o

Page 45: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Comparison of results

0 modea

0 modes

Page 46: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• 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

GA for Permutations

Page 47: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

The traveling salesman must visit every city in his territory exactly once and then return to the starting point; given the cost of travel between all cities, how should he plan his itinerary for minimum total cost of the entire tour?

TSP NP-Complete

The Traveling Salesman Problem (TSP)

Search space is BIG: for 30 cities there are 30! 1032 possible tours

Page 48: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

A vector v = (i1 i2… in) represents a tour (v is a permutation of {1,2,…,n})

Fitness f of a solution is the inverse cost of the corresponding tour

Initialization: use either some heuristics, or a random sample of permutations of {1,2,…,n}

We shall use the fitness proportionate selection

TSP (Representation, Initialization and Selection)

citiesn

Page 49: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• 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

Mutation operations for permutations

Page 50: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• 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

Insert Mutation for permutations

Page 51: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Pick two alleles at random and swap their positions

• Preserves most of adjacency information (4 links broken), disrupts order more

Swap mutation for permutations

Page 52: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• 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

Inversion mutation for permutations

Page 53: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

• Pick a subset of genes at random

• Randomly rearrange the genes in those positions

(note subset does not have to be contiguous)

Scramble mutation for permutations

Page 54: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Crossover builds offspring by choosing a sub-sequence of a tour from one parent and preserving the relative order of cities from the other parent and feasibility

Example:

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

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

First, the segments between cut points are copied into offspring

o1 = (x x x 4 5 6 7 x x) and

o2 = (x x x 1 8 7 6 x x)

Crossover for TSP (ex.)

Page 55: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Next, starting from the second cut point of one parent, the cities from the other parent are copied in the same order

The sequence of the cities in the second parent is 9 – 3 – 4 – 5 – 2 – 1 – 8 – 7 – 6

After removal of cities from the first offspring we get 9 – 3 – 2 – 1 – 8

This sequence is placed in the first offspring

o1 = (2 1 8 4 5 6 7 9 3), and similarly in the second

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

Crossover for TSP (ex.)

Page 56: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Genetic Algorithms: an introduction

Crossover for TSP (ex.)

Partially Mapped Crossover

Cycle crossover

Edge Recombination

Page 57: Kuban State University Krasnodar, Russia Genetic algorithms: an introduction Artem Eremin, j. researcher, IMMI KSU.

Thank you


Recommended