18
Evolutionary Algorithms A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ). The methods are best suited for (very) complicated optimization problems. Application areas: scheduling, robotics, routing. My interest is in scheduling!

A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ). The methods are best suited

Embed Size (px)

DESCRIPTION

 At some point the development is interrupted to do one or both of the following: 1. Recombination: some of the best solutions are combined to get better solutions. Usually two solutions are combined to get one new solution. 2. Mutation: One solution is mutated somehow to get a new solution.  The strongest solutions replaces the weakest ones in the population.

Citation preview

Page 1: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Evolutionary Algorithms A family of optimization methods that

search for an optimum minimum or maximum for a given problem (but never finds it ).

The methods are best suited for (very) complicated optimization problems.

Application areas: scheduling, robotics, routing.

My interest is in scheduling!

Page 2: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Evolutionary Algorithms Stems from the nature on how different

species behave and have developed. Examples: ant colony, fish swarms, bird

flocks, brain cells, and likes. Always population based. The individuals of the population

represents possible (candidate) solutions. All solutions are usually developed

concurrently (at the same speed).

Page 3: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Evolutionary Algorithms At some point the development is

interrupted to do one or both of the following:1. Recombination: some of the best solutions are

combined to get better solutions. Usually two solutions are combined to get one new solution.

2. Mutation: One solution is mutated somehow to get a new solution.

The strongest solutions replaces the weakest ones in the population.

Page 4: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Evolutionary Algorithms The level (amount) of recombination

and mutation can be different. It should be strongly noted that one

(or even both) can be omitted. It can be argued that if both are

omitted then we are not using an EA (it though still uses the population)

Page 5: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

The EA (GA)

Page 6: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Problems of EA How to decide when to perform EA? When to stop the algorithm? How to do recombination? How to use mutation? When to use only one of these? When to stick only with the

population? How to evaluate the solutions?

Page 7: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Application: N-queens problem N (usually 8) queens has to be placed on a

chess board in a way that no two queens can check each other.

Usually solved by an incremental approach: the queens are placed one by one on the chess board in a way that the latest placed queen do no check any other previously placed queen.

If and when a queen can not be placed on the chess board backing of previously placed queens is done.

Page 8: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Application: N-queens problem When solving this with a very simple EA we

take a totally different approach. We do not follow every step of the previously showed pseudo-algorithm.

We use a population of one just to be able to go through this example.

Therefore we also do not use recombination nor mutation.

After we have gone through the example we will take a look at how to apply all these to the problem.

Page 9: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Application: N-queens problem For simplicity, let’s use 4 queens. Here we only demonstrate how to

develop and evaluate the solution. First we make a random solution

(usually called candidate solution)

Page 10: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Randomized start Cost Possible moves, cost and the cost changes.

x       2 x       2 0 x       1 1 x       1 1  x     3 x       2 1     x   1 2       x 1 2  x     1   x     1 0   x     1 0   x     0 1      x 2       x 1 1       x 1 1       x 2 0

8 6 4 4

x       1 x       1 0 x       0 1 x       0 1      x 1       x 0 1       x 1 0       x 0 1  x     0   x     1 -1   x     1 -1   x     1 -1      x 2 x       2 0   x     2 0     x   1 1

4 4 4 2

x       0 x       1 -1 x       1 -1 x       0      x 0       x 0 0       x 1 -1       x 1  x     1 x       1 0     x   3 -2       x 2    x   1     x   0 1     x   1 0     x   1

2 2 6 4

x       1   x     0 1     x   3 -2       x 1 0      x 0       x 0 0       x 1 -1       x 1 -1x       1 x       0 1 x       1 0 x       0 1    x   0     x   0 0     x   1 -1     x   0 0

2 0 6 2

Page 11: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Application: N-queens problem So, that was an easy problem. What if we had an infinite number of

queens? We wouldn’t have enough time to

evaluate the solutions. What to do? There must always be enough time to

evaluate the solutions, so we must take a short cut somewhere else.

Page 12: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Applications: How to do it? We must narrow the search space. We could choose only some of the

rows of the chess board. We could choose only some of the

columns where to place the queens. The only rule that matters here is:

there must be enough computing time to perform all the required operations.

Page 13: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Applications: How to do it? So what if we can’t find a solution to the

problem? We might be (are) forced to be satisfied

with a non-optimal solution. For almost all of the problems the

minimum (or maximum) is not known. You can test your algorithm with a lot of

bench mark problems. They might not fit your algorithm, though.

Page 14: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Applications: How to do it? The code must always be ”well” done. The data structures must be perfect. Evaluation is always an update –

never a total calculation (and this is really hard to accomplish!).

Very soon you have to forget about ”stylish” programming.

In the end every line of code depends on every other line of the code.

Page 15: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Applications: How to do it? There are a lot of pitfalls in using EA. Representing the problem. Choosing the recombination and

mutation operators. Or choosing not to use them.

Getting stuck in a local optimum is a very big problem. How to escape from it?

Page 16: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

Recombination

    x   2 x       2   x     2   x     1  x     3 x       2     x   2   x     2    x   3   x     1     x   2     x   1      x 2       x 1   x     2 x       0

10 6 8 4

How to recombine these?Choose the best rows. If the best rows are equally good, randomize. (We check them all as an example.)

  x     2   x     1   x     2   x     1x       3 x       2   x     2   x     2  x     3     x   0   x     3     x   1x       2 x       1 x       1 x       0

10 4 8 4

After this we should replace the worst candidate solution with this best one. The worst has a costof 10 so the probability to get a better solution to the population is 3/4 = 0.75.

This kind of EA was just a simple example. It can be done in other ways also.F.ex. We could be smart and allow only candidate solutions where every queen is in an unique column.We could also be even more "stupid" and allow more than one queen in a row.

Page 17: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

MutationLets try mutation to the best solution from the original population.We could mutate every queen with three new positions (4*3 = 12 possibilities).

x       3     x   2       x 1   x     1  x     2   x     2   x     1 x       2    x   2     x   2     x   1     x   0x       1 x       0 x       1 x       1

8 6 4 4

  x     1   x     0   x     1   x     2    x   3       x 1   x     2   x     2    x   1     x   1 x       2   x     3x       1 x       0 x       1 x       1

6 2 6 8

  x     1   x     2   x     1   x     1  x     1   x     3   x     2   x     3      x 0     x   2     x   2     x   2x       0   x     3     x   1       x 2

2 10 6 8

So, by mutation we get a better solution to the population with probability 11/12 = 0.92.

Page 18: A family of optimization methods that search for an optimum minimum or maximum for a given problem (but never finds it ).  The methods are best suited

My applications The schedule of the Finnish Ice

Hockey League. Rosters of employees.