Graham Kendall GXK@CS.NOTT.AC.UK gxk +44 (0) 115 846 6514 G5AIAI Introduction to AI Graham Kendall...

Preview:

Citation preview

Graham Kendall

GXK@CS.NOTT.AC.UK

www.cs.nott.ac.uk/~gxk

+44 (0) 115 846 6514

G5AIAIIntroduction to AI

Graham KendallCombinatorial Explosion

G5G5AIAIAIAI History of AI History of AI

The Travelling Salesman Problem

• A salesperson has to visit a number of cities

• (S)He can start at any city and must finish at that same city

• The salesperson must visit each city only once

• The number of possible routes is (n!)/2 (where n is the number of cities)

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion

Travelling Salesman Problem

0

500000

1000000

1500000

2000000

1 2 3 4 5 6 7 8 9 10

Cities

Ro

ute

s

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion

Cities Routes

1 12 13 34 125 606 3607 25208 201609 18144010 181440011 19958400

G5G5AIAIAIAI History of AI History of AI

Combinatorial ExplosionA 10 city TSP has 181,000 possible solutions

A 20 city TSP has 10,000,000,000,000,000 possible solutions

A 50 City TSP has 100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 possible solutions

There are 1,000,000,000,000,000,000,000 litres of water on the planet

Mchalewicz, Z, Evolutionary Algorithms for Constrained Optimization Problems, CEC 2000 (Tutorial)

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

• How many moves does it take to move four rings?

• You might like to try writing a towers of hanoi program (and you may well have to in one of your courses!)

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

• If you are interested in an algorithm here is a very simple one

• Assume the pegs are arranged in a circle

• 1. Do the following until 1.2 cannot be done– 1.1 Move the smallest ring to the peg residing next to

it, in clockwise order

– 1.2 Make the only legal move that does not involve the smallest ring

• 2. Stop

• P. Buneman and L.Levy (1980). The Towers of Hanoi Problem, Information Processing Letters, 10, 243-4

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

• A time analysis of the problem shows that the lower bound for the number of moves is

2N-1

• Since N appears as the exponent we have an exponential function

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

Pegs 2N-1

3 74 155 326 63… …10 1023

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

• The original problem was stated that a group of tibetan monks had to move 64 gold rings which were placed on diamond pegs.

• When they finished this task the world would end.

• Assume they could move one ring every second (or more realistically every five seconds).

• How long till the end of the world?

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Towers of Hanoi

• > 500,000 years!!!!! Or 3 Trillion years

• Using a computer we could do many more moves than one a second so go and try implementing the 64 rings towers of hanoi problem.

• If you are still alive at the end, try 1,000 rings!!!!

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion - Optimization

• Optimize f(x1, x2,…, x100)

• where f is complex and xi is 0 or 1

• The size of the search space is 2100 1030

• An exhaustive search is not an option– At 1000 evaluations per second– Start the algorithm at the time the universe was

created– As of now we would have considered 1% of all

possible solutions

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion

11E+141E+281E+421E+561E+701E+841E+981E+1121E+1261E+1401E+1541E+1681E+1821E+1961E+2101E+2241E+2381E+2521E+2661E+280

2 4 8 16 32 64 128 256 512 1024 2048

5N

N^3

N^5

N^10

1.2^N

2^N

N^N

Microseconds in a Day

Microseconds since Big Bang

G5G5AIAIAIAI History of AI History of AI

Combinatorial Explosion

10 20 50 100 200

N2

N5

1/10,000 second

1/2500 second

1/400 second

1/100 second

1/25 second

1/10 second

3.2 seconds

5.2 minutes

2.8 hours

3.7 days

2N

NN

1/1000 second

1 second

35.7 years

> 400 trillion

centuries

45 digit no. of centuries

2.8 hours

3.3 trillion years

70 digit no. of

centuries

185 digit no. of

centuries

445 digit no. of

centuries

Running on a computer capable of 1 million instructions/second

Ref : Harel, D. 2000. Computer Ltd. : What they really can’t do, Oxford University Press

G5AIAIIntroduction to AI

Graham KendallEnd Combinatorial Explosion

Recommended