adapting heuristic mastermind strategies to evolutionary algorithms

23
T. P. Runarsson, J. J. Merelo, U. Iceland & U. Granada (Spain) NICSO 2010 Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Upload: juan-j-merelo

Post on 03-Jul-2015

1.593 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

T. P. Runarsson, J. J. Merelo,

U. Iceland & U. Granada (Spain)

NICSO 2010

Adapting Heuristic Mastermind Strategies to

Evolutionary Algorithms

Page 2: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 2

Game of MasterMind

Page 3: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 3

But that's just a game!

Page 4: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 4

7 reasons why you should

Donald Knuth

NP-Complete

Differential cryptanalisis

Circuit and program test

Genetic profiling

Minimize guesses

Minimize evaluations

Page 5: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 5

Let's play, then

Page 6: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 6

Consistent combinations

Page 7: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 7

Naïve Algorithm

Repeat

Find a consistent combination and play it.

Page 8: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 8

Looking for consistent solutions

Optimization algorithm based on distance to consistency (for all combinations played)

D = 2

Page 9: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 9

Not all consistent combinations are born the same

There's at least one better than the others (the solution)

Some will reduce the remaining search space more.

But scoring them is an open issue

Page 10: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 10

Score consistent set

AAA BBB CCC ABC CBA AAB AAC AAD BCAAAA 3b-0w 0b-0w 0b-0w 1b-0w 1b-0w 2b-0w 2b-0w 2b-0w 1b-0wBBB 0b-0w 3b-0w 0b-0w 1b-0w 1b-0w 1b-0w 0b-0w 0b-0w 1b-0wCCC 0b-0w 0b-0w 3b-0w 1b-0w 1b-0w 0b-0w 1b-0w 0b-0w 1b-0wABC 1b-0w 1b-0w 1b-0w 3b-0w 1b-2w 1b-1w 2b-0w 1b-0w 0b-3wCBA 1b-0w 1b-0w 1b-0w 1b-2w 3b-0w 0b-2w 0b-2w 0b-1w 1b-2wAAB 2b-0w 1b-0w 0b-0w 1b-1w 0b-2w 3b-0w 2b-0w 2b-0w 0b-2wAAC 2b-0w 0b-0w 1b-0w 2b-0w 0b-2w 2b-0w 3b-0w 2b-0w 0b-2wAAD 2b-0w 0b-0w 0b-0w 1b-0w 0b-1w 2b-0w 2b-0w 3b-0w 0b-1wBCA 1b-0w 1b-0w 1b-0w 0b-3w 1b-2w 0b-2w 0b-2w 0b-1w 3b-0w

Page 11: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 11

Enter partitions

0b-0w 0b-1w 0b-2w 0b-3w 1b-0w 1b-1w 1b-2w 2b-0wAAA 2 0 0 0 3 0 0 3BBB 4 0 0 0 4 0 0 0CCC 4 0 0 0 4 0 0 0ABC 0 0 0 1 4 1 1 1CBA 0 1 2 0 3 0 2 0AAB 1 0 2 0 1 1 0 3AAC 1 0 2 0 1 0 0 4AAD 2 2 0 0 1 0 0 3BCA 0 1 2 1 3 0 1 0

Most parts. Score = 5 Best worst case. Score = -3

1.31

0.96

0.96

1.58

1.52

1.67

1.42

1.52

1.67

Entropy. Score = 1.67

Page 12: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 12

Less Naïve Algorithm

Play initial combination

Repeat until end

Eliminate non-consistent combinations

Score the rest using partitions

Play best score

Page 13: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 13

And the (exhausted) winner is...

Entropy & Most Parts obtains the best results ~ 4.408 combinations played

Naïve algorithms obtain ~ 4.6

Problem: exhaustive search needed

Page 14: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 14

We want to do better than exhaustive search

Berghman et al.'s used only a subset of the set of consistent combinations with an evolutionary algorithm: non-exhaustive

Better scaling

In this paper, we want first to compute the size of the set which obtains the same result as exhaustive search.

Page 15: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 15

What we do in this paper

Check exhaustive search strategies

Make small improvements

Find out minimum set with same results

Incorporate heuristic into EA

Play the best score

Page 16: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 16

Comparison of exhaustive search strategies

Strategy min mean median max st.dev. max guesses

Entropy 4.38 4.41 4.41 4.42 0.01 6

Most parts 4.38 4.41 4.41 4.43 0.01 7

Expected size 4.45 4.47 4.47 4.49 0.02 7

Worst case 4.46 4.48 4.47 4.51 0.02 6

Random 4.57 4.61 4.61 4.65 0.03 8

Page 17: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 17

Since entropy is good, let's try on EDAs

Rank-based GA did not yield good results

Available as Algorithm::Mastermind::EDA

Population = 1/6 of search space

Replacement rate: 50%

10 * 1296 runs (10 for each combination AAAA .. FFFF)

Page 18: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 18

How fit are combinations

Combinations evolved directly

Fitness: Distance-to-consistency

Play random consistent combination (f)

Play highest local entropy (f

l)

Page 19: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 19

Strategy min mean median max st. dev, max guesses

Entropy 4.38 4.41 4.41 4.42 0.01 6

Most parts 4.38 4.41 4.41 4.43 0.01 7

Expected size 4.45 4.47 4.47 4.49 0.02 7

Worst case 4.46 4.48 4.47 4.51 0.02 6

LocalEntropy 4.53 4.57 4.57 4.61 0.02 7

EDA+fl 4.52 4.57 4.58 4.6 0.03 7

EDA+f 4.56 4.62 4.62 4.67 0.03 7

Random 4.57 4.61 4.61 4.65 0.03 8

Are EDAs any good?

Page 20: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 20

Can we avoid exhaustive search?

Instead of finding all consistent combinations, how many are needed?

Most-parts & entropy methods need only ~20 (10-25% of total)

Could be used for EDAs

Not in this paper!

Page 21: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - R unarsson/Merelo 21

Exhaustive search algorithms examined

Comparison with EDAs yield better-than-random results

We can use just a subset of consistent combinations

Concluding...

Exhaustive search algorithms examined

Comparison with EDAs yield better-than-random results

We can use just a subset of consistent combinations

Page 22: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 22

Open source your science!

Page 23: Adapting Heuristic Mastermind Strategies to Evolutionary Algorithms

Evolutionary Mastermind - Merelo/R unarsson 23

That's allThat's all

Thanks for your attentionAny questions?