Evolutionary Computing A Practical Introduction Presented by Ben Paechter Napier University with...

44
Evolutionary Computing A Practical Introduction Presented by Ben Paechter Napier University with thanks to the EvoNet Training Committee and its “Flying Circus”
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    1

Transcript of Evolutionary Computing A Practical Introduction Presented by Ben Paechter Napier University with...

Evolutionary ComputingA Practical Introduction

Presented by Ben PaechterNapier University

with thanks to the EvoNet Training Committee and its “Flying Circus”

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 2

Contents

Natural Evolution Evolutionary Algorithms A Simple Example Simple Demonstrations How to Build an Evolutionary

Algorithm

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 3

Natural Genetics

The information required to build a living organism is coded in the DNA and other genetic material found in the cells of that organism

Within a species, most of the genetic material is the same

Small changes in the genetic material give rise to small changes in the organism

E.g height, hair colour

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 4

DNA and Genes

DNA is a large molecule made up of fragments. There are several fragment types, each one acting like a letter in a long coded message:

-A-B-A-D-C-B-B-C-C-A-D-B-C-C-A- Certain groups of letters are meaningful

together - a bit like words. These groups are called genes The DNA is made up of genes and rubbish

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 5

Example: Human Reproduction

Human DNA is organised into chromosomes Most human cells contains 23 pairs of

chromosomes which together define the physical attributes of the individual:

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 6

Reproductive Cells

Sperm and egg cells contain 23 individual chromosomes rather than 23 pairs

Reproductive cells are formed by one cell splitting into two

During this process the pairs of chromosome undergo an operation called crossover

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 7

Crossover

During crossover the chromosome pairs link up and swap parts of themselves:

Before After

After crossover one of each pair goes into each cell

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 8

Fertilisation

Sperm cell from Father Egg cell from Mother

New person cell

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 9

Mutation

Occasionally some of the genetic material changes very slightly during this process

This means that the child might have genetic material information not inherited from either parent

This is most likely to be catastrophic

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 10

Theory of Evolution Mutation, Crossover =>New genetic material or new

combinations. Usually less able to to survive and so reproduce Occasionally more able to survive and so reproduce More reproduction leads to more of the “new improved”

genetic “Good” sets of genes get reproduced more “Bad” sets of genes get reproduce less Organisms as a whole get better and better at surviving in

their environment Evolutionists claim that this slow changing of genetic

material through reproduction, mutation and possibly crossover has produced all the species of plants and animals

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 11

Evolution as Search

Evolution - search through the enormous genetic parameter space for the best genetic make-up

Borrow ideas from nature to help us solve problems that have an equally large search spaces or similarly changing environment

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 12

Evolutionary ComputingThe Metaphor

Natural Evolution

Individual

Fitness

Environment

Evolutionary Computation

Candidate Solution

Quality

Problem

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 13

The Evolutionary Cycle

Recombination

MutationPopulation

Offspring

ParentsSelection

Replacement

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 14

Simple Example The Knapsack Problem

The problem is to choose which items to take in a knapsack .

Each item has a weight and a value We want to maximise the value of the items in

the knapsack, without exceeding some maximum weight.Note: This is not the best way to solve this problem with an evolutionary algorithm and an evolutionary algorithm is not the best way to solve this problem!

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 15

Chromosome Representation

An array of bits - one for each item in the knapsack

A “1” means - take the item

A “0” mean don’t take the item

CHROMOSOMECHROMOSOME

GENEGENE

Create 100 random bit strings for the initial population

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 16

ChromosomeFitness Evaluation

Add up the value of the items in the knapsack to give the fitness.

If the knapsack is overweight, then subtract from the fitness the amount overweight.

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 17

Choosing Parents to Reproduce

To choose one parent: Choose two chromosomes randomly from

the population. Whichever has the highest fitness is the

parent.

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 18

To make a child - Recombination

For each gene choose randomly whether to take it from one chromosome or the other

0 01 01 0 1 1

10 11 00110 1 0 10 111

ParentsChild

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 19

Mutation

Give each gene a small chance of flipping - say 1/(length of string)

0 1 0 10 111 0 1 0 00 111

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 20

Replacement

When inserting a new child into the population, choose a existing member to kill by: Choosing two chromosomes randomly

from the population. Whichever has the lowest fitness is killed.

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 21

The Evolutionary Cycle

Recombination

MutationPopulation

Offspring

ParentsSelection

Replacement

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 22

The Evolution Mechanism

Increasing diversity by genetic operators

mutation recombination

Decreasing diversity by selection of

parents things to kill

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 23

Real World EC

Tends to include: More complex representations and operators Use of problem specific knowledge for

seeding the initial population and creating heuristic operators

Hybridisation with other methods

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 24

Advantages

Handles huge search spaces Balances exploration and exploitation Easy to try - not knowledge intensive Easy to combine with other methods Provides many alternative solutions Can continually evolve solutions to fit with a

continually changing problem

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 25

Disadvantages

No guarantee for optimal solution within finite time - lacks the killer instinct

Weak theoretical basis May need extensive parameter tuning Often computationally expensive, i.e. slow

Demos

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 27

How to Build an Evolutionary Algorithm

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 28

The Steps

Design a representation Decide how to initialise a population Design a way of mapping a genotype to a phenotype Design a way of evaluating an individual Design suitable mutation operator(s) Design suitable recombination operator(s) Decide how to select individuals to be parents Decide how to manage the population Decide when to stop the algorithm

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 29

Designing a Representation

How to represent an individual as a genotype. Should be relevant to the problem that we are

solving. Consider at same time

How genotype is evaluated Possible genetic operators

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 30

Possible Representations

Binary string String of integers String of reals Trees Much more complicated things

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 31

Initialization

uniformly on the search space, e.g.: Binary strings: 0 or 1 with probability 0.5 Real-valued representations: Uniformly on a given

interval

Seed with previous results or those from heuristics, or the user.

With care: Possible loss of genetic diversity Possible unrecoverable local optimum

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 32

Getting a Phenotype from our Genotype

Sometimes producing the phenotype from the genotype is a simple and obvious process.

Other times the genotype might be a set of parameters to some algorithm, which works on the problem data to produce the phenotype

GenotypeProblem

Data

Phenotype

Growth Function

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 33

Evaluating an Individual

This is by far the most costly step for real applications

simple calculation, a black-box simulator, external process (e.g. robot experiment)

Could use approximate fitness - but not for too long

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 34

More on Evaluation

Constraint handling - what if the phenotype breaks some constraint of the problem:

penalize the fitness specific evolutionary methods

Multi-objective evolutionary optimization Special methods for dealing with multi-objective optimisation - give a set of compromise solutions .

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 35

Mutation Operators

One or more mutation operators for our representation:

At least one mutation operator should allow every part of the search space to be reached

The size of mutation is important and should be controllable

The recombination operator(s) should be designed in conjunction with the representation so that mutation is not always catastrophic

Mutation should produce valid chromosomes Heuristic mutations might be used

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 36

Recombination Operators

One or more recombination operators for our representation.

The child should inherit something from each parent. If this is not the case then the operator is a mutation operator.

The recombination operator(s) should be designed in conjunction with the representation so that recombination is not always catastrophic

Recombination should produce valid chromosomes Heuristic recombination might be used

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 37

Selection Strategy

We want: better individuals to have a better chance of being

parents than less good individuals.

This will give us selection pressure which will drive the population forward.

We must be careful: less good individuals must have some chance of

being parents - they may include some useful genetic material.

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 38

Population StrategyThe selection pressure is also affected by the way in which we manage the population:

How do we decide which individuals to kill to make way for new ones?

Is the population size fixed?

Do we allow duplicates in the population?

Should we always keep the best in the population? (Elitism)

Should we replace the whole population at once? (generational)

Or just one individual at a time? (steady-state),

Or something else?

Do we select between the children?

Do we compare parents and children?

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 39

Stopping criterion

The optimum is reached!

Limit on CPU resources:

Maximum number of fitness

evaluations

Limit on the user’s patience:

After some generations without improvement

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 40

Algorithm performance

Never draw any conclusion from a single run use statistical measures (averages, medians) from a sufficient number of independent runs

From the application point of view design perspective:

find a very good solution at least once production perspective:

find a good solution at almost every run

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 41

Maintaining Genetic Diversity

We must try to maintain genetic diversity:

loss of genetic diversity = all individuals in the population look alike

snowball effect convergence to the nearest local optimum

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 42

Balancing Exploration and Exploitation

We should try to balance exploration and exploitation: Exploration =sample unknown regions Too much exporation = random search, no

convergence

Exploitation = try to improve the best-so-far individuals

Too much expoitation = local search only … convergence to a local optimum

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 43

Summary

Evolutionary Computation: is a method, based on biological metaphors,

of breeding solutions to problems has been shown to be useful in a number of

areas could be useful for your problem its easy to give it a try

Evolutionary Computing - A Practical Introduction by Ben Paechter, Napier University, for the EvoNet Summer School 2001 44

Further Information and Demos

The EvoNet Flying Circus :

evonet.dcs.napier.ac.uk/evoweb/resources/flying_circus/index.html