drama at the oscars

32
Y T H E O R Y 1 C O M P L E X I T

Upload: tucker

Post on 10-Jan-2016

25 views

Category:

Documents


1 download

DESCRIPTION

Drama At the Oscars. Some History…. Not that there’s anything wrong with that!. How Can a Catastrophe be Avoided?. Getting It Right. Naive Algorithm. Naive Algorithm. Times Square. Rockefeller Center. Empire State Building. Stuyvesant Tn. World Trade Center. 9. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Drama At the Oscars

Y T H E O R Y

1

C

O

M

P

L

E

X

I

T

Page 2: Drama At the Oscars

2

Goal: •Introduce basic concepts in Complexity Theory.

Plan:•Meet Celebrities and Computations•Growth Rate and Tractability•Reducibility•… etc. …

Page 3: Drama At the Oscars

3

Drama At the OscarsProblem:

• seat all guests around a table, so people who sit next to each other get along.

Page 4: Drama At the Oscars

Some History…

4

Not that there’s anything wrong

with that!

Page 5: Drama At the Oscars

How Can a Catastrophe be Avoided?

5

Page 6: Drama At the Oscars

6

Getting It Right

Page 7: Drama At the Oscars

Observation:

• Given a seating one can efficiently check if all guests get along with their neighbors

For each seating arrangement: Check if all guests are OK with neighborsStop if a good arrangement is foundHow much time would it take? (worse case)

7

Naive Algorithm

Page 8: Drama At the Oscars

For each seating arrangement: Check if all guests are OK with neighborsStop if a good arrangement is foundHow much time would it take? (worse case)

8

Naive Algorithm

Guests Steps

N (N-1)!

5 24

15 87178291200

100 9·10155

• say our computer is capable of 1010

instructions per second, this will still take 3·10138

years!

Can you do better?

Page 9: Drama At the Oscars

9

Stuyvesant Tn.

World Trade Center

Rockefeller Center

Empire State Building

Tour Problem

• Plan a trip that visits every location exactly once.

Times Square

Page 10: Drama At the Oscars

10

Naive Algorithm (Backtracking)

For each siteTry out all reachable

sitesnot yet visited

Backtrack and retry

Repeat the process until

stuck

Page 11: Drama At the Oscars

Sites Steps

N N!

5 120

15 1307674368000

100 9·10157

11

How Much Time?

• On a computer that can check 10,000 options per second, this still takes 4 years!

Page 12: Drama At the Oscars

Yes •and here’s an efficient algorithm that solves it

No• and I can prove it

? •and if neither is the case?

12

Is a Problem Tractable?

Page 13: Drama At the Oscars

13

Growth Rate: rough classification

input length

time

Page 14: Drama At the Oscars

14

Basic split in time-complexity

Maybereasonable

Totallyunreasonabl

e

polynomial nO(1)

exponential

2nO(1)

Page 15: Drama At the Oscars

15

Which is Harder?

SEATING

TOUR

Page 16: Drama At the Oscars

If

• assuming an efficient procedure for B there is an efficient procedure for A

Then

• A cannot be radically harder than B

an efficient procedure for A using

an efficient procedure forB

an efficient procedure for A using

an efficient procedure forB

16

Relations Between Problems

Page 17: Drama At the Oscars

an efficient procedure for A using

an efficient procedure forB

Notation

17

ReductionsA cannot be radically harder than B

• In other words:

B is at least as hard as A

A ≤p B

Page 18: Drama At the Oscars

18

Reduce Tour to Seating

Find someone who can seat next to everyone

Page 19: Drama At the Oscars

Completeness:

• If there’s a tour, there’s a way to seat all the guests around the table.

Soundness:

• If there’s a seating, we can easily find a tour path (no tour, no seating).

19

Reduce Tour to Seating

QED

• seating is at least as hard as tour

Page 20: Drama At the Oscars

COULDNOT:

•find an efficient algorithm for problems

NOR •prove they are intractable

DIDMANAGE:

•to show a very strong correlation between their complexity

20

So Far

Page 21: Drama At the Oscars

Interestingly,we can also reduce the

seating problem to the tour problem.

Furthermore, there is a whole class of

problems, which can be pair-wise efficiently reduced to

each other.

21

Can you?

Page 22: Drama At the Oscars

Does P=NP

NP

P

• Efficiently computable

NP

• Solution efficiently verifiable

22

NP and P

Page 23: Drama At the Oscars

NP

23

NPC

Contains thousand

s of distinct

problems

each reducible

to all others

exponential-time algorithmsefficient algorithms

Page 24: Drama At the Oscars

The “P vs. NP” question is the most fundamental of CS• Human ingenuity is redundant!• So would mathematicians be!!

Resolving it would bring you great honor…

… as well as significant fortune… www.claymath.org/

Philosophically: if P=NP

Is nature nondeterministic?

24

How can Complexity make you a Millionaire?

Page 25: Drama At the Oscars

Next:

•we’ll review basic questions explored through the course.

25

What’s Ahead?

Page 26: Drama At the Oscars

Generalized Tour Problem

• Each segment of the tour problem now has a cost• find a least-costly tour

26

$2

$5

$4

$3$1

$4

$6

$5

$2

Approximate the optimal tour?

i.e. – find a tour that

costs, say, no more

than twice as much as

the least costly.

Page 27: Drama At the Oscars

Is Running Time the

only Resourc

e?• What about

memory (space)?

• Any other?

27

Page 28: Drama At the Oscars

Word Games:Players take turns

choose a word whose first letter matches other player’s last

28

Games

Apple EggGirl LordDog

GuyYardDeer

Apple

Egg Girl

Ear

LordDog

Red

Page 29: Drama At the Oscars

Can one compute a winning strategy?

How much time would it take?

How much space?

29

Egg Girl DogApple Ear LordRed

GirlEgg EarDog DogLord Girl Red

Lord Lord

Dog

Dog

Girl

Lord

Dog Girl

Lord

Girl Girl Red Lord Dog Lord Dog Girl

Apple

Egg Girl

Ear

LordDog

Red

Page 30: Drama At the Oscars

We have introduced two problems: 1. Seating HAMILTONIAN-CYCLE 2. Tour HAMILTONIAN-PATH

Unable to settle their complexity we, nevertheless, showed strong correlations between them

These problems are representatives of a large class of problems: NPC

30

Summary

Page 31: Drama At the Oscars

Topics to be studied later:

•Approximation•Space-bounded computations

31

Prognosis

Page 32: Drama At the Oscars

WWindex

32

Complexity Theory

Computations

Completeness

Hamiltonian Path

Growth Rate

Complexity Classes

NPC P NP Exponential Timewww.cl

aymath.org

Approximation

Reducibility

Completeness

Soundness