38
1 Thomas Stidsen DTU-Management / Operations Research Evolutionary Algorithms – simulated evolution Thomas Stidsen [email protected] DTU-Management Technical University of Denmark

Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

1Thomas Stidsen

DTU-Management / Operations Research

Evolutionary Algorithms– simulated evolution

Thomas Stidsen

[email protected]

DTU-Management

Technical University of Denmark

Page 2: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

2Thomas Stidsen

DTU-Management / Operations Research

Outline1Heuristics and Meta-heuristics

General information on EA’s

The standard EA

EA for Facility Location

EA disected

Different EA types

Advanced topics

Why and why not use EA

Parameters

Page 3: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

3Thomas Stidsen

DTU-Management / Operations Research

Specialised heuristics vs. metaheuristicsThis part of the course is termed: Metaheuristics,what is a metaheuristic ?

A general skeleton to an algorithm applicable toa wide range of optimisation problems.

A meta-heuristic often “evolve” into a morespecialised heuristic when it is specialised to aparticular problem

Approximation algorithms and very largeneighbourhood searches are very specialisedtechniques which have a more limited scope

Page 4: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

4Thomas Stidsen

DTU-Management / Operations Research

Specialised heuristics vs. metaheuristicsEfficiency

Specialisation

Heuristics

Meta−heuristics

Page 5: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

5Thomas Stidsen

DTU-Management / Operations Research

General InformationEvolutionary Algorithms is not just GeneticAlgorithms.

EA tries to mimic the Darvinian evolution

EA is significantly different from SA and TABUand thus complements these.

EA is difficult to use:Many parametersParameters are hidden and dependsnon-linearly on each other.

Page 6: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

6Thomas Stidsen

DTU-Management / Operations Research

HistoryInvented independently three different places, inthe 60’ies:

Michigan: John Holland, Genetic Algorithms.Germany: Schwefel and Rechenberg,Evolution Strategies.California: Edward Fogel: EvolutionaryProgramming.

First dedicated conference: ICGA-85.

Popularised by D. Goldberg, 1989 (GeneticAlgorithms).

Page 7: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

7Thomas Stidsen

DTU-Management / Operations Research

The Standard EA

Initialise the entire populationrepeat

Select promising individuals from current populationReproduce selected individualsMutate reproduced individualsEvaluate created individualsCreate new/updated population

until finished()return best from population

Page 8: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

8Thomas Stidsen

DTU-Management / Operations Research

Application of EAWhen applying EA’s to a certain problem we needto:

Define problem dependent parts

Select type of EA to use

Select parameters for EA

Page 9: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

9Thomas Stidsen

DTU-Management / Operations Research

Problem dependent partsThis is where the modelling of a real world problembegins, three different parts needs to be specified:

Evaluation

Crossover and Mutation operators (andRepresentation)

Let’s look at the simple and classic problem ...

Page 10: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

10Thomas Stidsen

DTU-Management / Operations Research

Representation: A Bit vectorVery simple: Boolean vector, corresponding to e.g.binary variables ...

Page 11: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

11Thomas Stidsen

DTU-Management / Operations Research

Mutation

0

0

6

������

������

6

1 2 3 4 5

1 0 0 10

1 2 3 4 5

11 0 0 1

Exactly like the neighborhood

Page 12: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

12Thomas Stidsen

DTU-Management / Operations Research

CrossoverThe simple 1-point crossover:

1

0

6

6

1

0

6

6

������������������������

������������������������

������������

������������

������������

������������

1 1

54321

01010

0

5

010

01

10

54321

1001 1

4321

54321

Page 13: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

13Thomas Stidsen

DTU-Management / Operations Research

OperatorsThe bit-mutation operator and the 1-point crossoverare general non-problem dependent operators.Generally these are not the best operators forspecific problems. What could be the alternative ?

Problem dependent crossovers ???

PMX crossover to Christmas Lunch problem

Page 14: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

14Thomas Stidsen

DTU-Management / Operations Research

ReproductionWhat is a good crossover ? Difficult to quantify but:

Avoid epistasis: Related genes should be“close”.

Avoid collateral mutation, keep the geneticmaterial.

New genetic material should be created by themutation operator.

Choose the best material (a little dangerous).

Creating good reproduction operators is an art not ascience.

Page 15: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

15Thomas Stidsen

DTU-Management / Operations Research

Optimisation algorithm choiceChoosing the right Evolutionary Algorithm for theoptimization problem then becomes the next issue,the components are:

Population, several current solutions instead ofjust one.

Selection, which individuals should the nextpopulation consist of.

Stopping Criteria, when are we finished ?

Page 16: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

16Thomas Stidsen

DTU-Management / Operations Research

The Components II: PopulationThe population is necessary for thereproduction.

Makes the algorithm robust, but increases theneed for computer power and memory.

The trade off: Prob. of getting a good solutionvs. time.

The size determines this trade off and isproblem dependent.

Important measure: Convergense, is thedegree of similarity of the solutions in thepopulation.

The crossover requires a non-converged populationto work.

Page 17: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

17Thomas Stidsen

DTU-Management / Operations Research

The Components III: SelectionA much overlooked component which is veryimportant.

Takes one population to a reduced population.

Can be compared to the temperature of theSimulated Annealing.

Three important types:Proportional selection, the classic method,but problematic ...Tournament selection, the simplest method.Stochastic Universal Sampling after LinearFitness ranking.

Page 18: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

18Thomas Stidsen

DTU-Management / Operations Research

Selection: Proportional Selection

P3

P4

P1

P2

Page 19: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

19Thomas Stidsen

DTU-Management / Operations Research

Selection: Proportional SelectionThis classical method is the basis for most of thetheory, but there are two problems:

Premature convergence: A good initialindividual may quickly spread into the entirepopulation.

Slow finishing: In the end, the individualsusually have almost identical fitness values

For these reasons, proportional selection is neverused ...

Page 20: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

20Thomas Stidsen

DTU-Management / Operations Research

Selection: Tournament selectionA simple and efficient approach: Select twodifferent individuals randomly and choose the best:

Avoids the premature convergence and slowfinishing.

Easy to use in parallel

Random fluctuations may cause problems

Page 21: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

21Thomas Stidsen

DTU-Management / Operations Research

Selection: LFR-SUSLFR-SUS: Linear Fitness Ranking with StochasticUniversal Sampling. Works in several stages:

Sort the entire population

Assign selection value linearly

Use stochastic universal sampling to copyindividuals

Page 22: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

22Thomas Stidsen

DTU-Management / Operations Research

LFR

1

1.0

2.0

NIndividual Ranking

Page 23: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

23Thomas Stidsen

DTU-Management / Operations Research

SUS

P2

P1

P4

P3

Page 24: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

24Thomas Stidsen

DTU-Management / Operations Research

Selection: LFR-SUSThe most “fair” method, with the least noise inthe sampling of new individuals.

More computational demanding, but that’susually not a problem

Difficult to parralellise

Page 25: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

25Thomas Stidsen

DTU-Management / Operations Research

The Components IIII: ReproductionThe biggest difference compared to otheralgorithms: Create a new individual/solution bycombining material from two previous solution:

Intuitively: Create new solutions by combiningexisting solutions in a new way.

Very problemdependent.

Standard types: 1-point, 2-point.

Traditionally considered the most importantcomponent.

If you cannot create a good crossover, don’t useEA.

Page 26: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

26Thomas Stidsen

DTU-Management / Operations Research

The Components IIII: MutationTraditionally a background operator.

Corresponds to the traditional neighbourhoodupdate: sm ∈ N (sl).

Possibility for guided mutations.

Page 27: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

27Thomas Stidsen

DTU-Management / Operations Research

Two recomandable EA’sTwo good algorithms worth considering are:

Generational EA with LFT-SUS (bacteriaevolution)

Steady State EA with tournament selection(elephant evolution)

Depending on the problem, these are excellentalgorithms.

Page 28: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

28Thomas Stidsen

DTU-Management / Operations Research

Generational EAP ← RandomIndividuals()repeat

P ′ := LFR− SUS(P )P ′′ ← {}while P ′ 6= {}

p1, p2 := RandomRemove2(P ′)o1, o2 := Crossover(p1, p2)P ′′ ← o′

1, o′

2:= Mutate(o1, o2)

endwhileP := P ′′

until finished()return Best(P )

Page 29: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

29Thomas Stidsen

DTU-Management / Operations Research

Steady State EAP ← RandomIndividuals()repeat

p1, p2, p3, p4 := RandomSelect4dif(P )o1, o2 := Crossover(Best(p1, p2), Best(p3, p4))o′

1, o′

2:= Mutate(o1, o2)

r1, r2, r3, r4 := RandomSelect4different(P )Replace(P,Worst(r1, r2), o1)Replace(P,Worst(r3, r4), o2)

until finished()

Page 30: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

30Thomas Stidsen

DTU-Management / Operations Research

Convergence ?What did I mean by converged ? Depending on therepresentation, we may look on the similarity of thedifferent individuals:

Binary strings: Hamming distance

Permutation ???

Real valued arrays: Euclidian distance

Special structures: ???

Page 31: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

31Thomas Stidsen

DTU-Management / Operations Research

Advanced TopicsThere are MANY variations of EA’s, just to name afew:

Island EA.

Hill climber inclusion: Baldwin and Lamarcianevolution.

Parallel implementations.

Multi-criteria optimisation.

Co-evolutionary EA.

Automatic operator probability adjustment.

Page 32: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

32Thomas Stidsen

DTU-Management / Operations Research

EA TheoryAs for the other metaheuristics, the EA theory isvery limited:

The Schemata theorem, in your notes.

Price’es theorem. Comes from populationbiology, and has been transferred to EA’s byLee Altenberg. Very complicated mathematics.

Goldberg’s work on population sizing.

In practice none of theories are useable. Note,contrary to SA there is no convergence theory.

Page 33: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

33Thomas Stidsen

DTU-Management / Operations Research

The first theory book ...Is the book: “Genetic Algorithms - Principles andPerspectives”, C.R. Reeves & J. E. Rowe.

The first (to my knowledge) theory book onevolutionary algorithms.

The lack of theory is acknowledged ...

... but not ignored !

Page 34: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

34Thomas Stidsen

DTU-Management / Operations Research

Many bad articles ...“The number of papers devoted to GA’s isenormous - and increasing - but sadly, too many ofthem have titles like: A New Genetic Algorithm forthe Multi-Resource Travelling GravediggerProblem with Variable Coffin Size”, “GeneticAlgorithms - Principles and Perspectives”, C.R.Reeves & J. E. Rowe.

Page 35: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

35Thomas Stidsen

DTU-Management / Operations Research

When to use EA ?When should you consider EA ?

If the problem is REALLY hard:If the problem is very multimodal.If the problem is a multi criteria problem.If the standard neighbourhood is bad ...

If you have a good reproduction operator.

If your problem is multi-objective

Page 36: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

36Thomas Stidsen

DTU-Management / Operations Research

When not use EADon’t use EA if:

Your problem is too simple.

Your (single solution) neighbourhood operator isefficient

Your reproduction cannot produce goodindividuals.

Time is critical.

Page 37: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

37Thomas Stidsen

DTU-Management / Operations Research

ParametersThere are more parameters in EA than in SA andmost TABU algorithms. Further some parametersare hidden:

Population size.

Selection pressure, Important but hiddenparameter.

Operator probability: Which operator should thealgorithm use ?

Stopping criteria.

Generation gap.These are just the basic parameters, many othersmay show up ...

Page 38: Evolutionary Algorithms · Evolutionary Algorithms is not just Genetic Algorithms. EA tries to mimic the Darvinian evolution EA is significantly different from SA and TABU and thus

38Thomas Stidsen

DTU-Management / Operations Research

Tips and tricksA few general advices:

The most important: Get the representation andreproduction operator right.

Use a large population initially.

Be carefull about the selection pressure, use alow selection pressure initially.

Tune your evaluation function, this is where thebulk of the work is performed by the computer.

Watch the convergens.