Traveling Salesman Problem

Download Report

Transcript Traveling Salesman Problem

Combinatorial Search

Spring 2008 (Fourth Quarter) 1

Some practical remarks

• Homepage: www.daimi.au.dk/dKS • Exam: Oral, 7-scale 30 minutes, including overhead, no preparation.

• There will be three compulsory assignments. If you want to transfer credit from last year, let me know as soon as possible

and before May 1

.

• The solution to the compulsory assignments should be handed in at specific exercise sessions and given to the instructor

in person

.

• Text: “Kompendium” available at GAD + online notes.

2

Exercise classes

• You can switch classes iff you find someone to switch with.

• To find someone, post an add in the group dSoegOpt … Or try finding someone after the class!

• Exercise classes are on specific dates, see webpage 3

• •

Frequently asked questions about compulsory assignments

Q: A:

Do I really have to hand in all three assignments?

YES!

• •

Q: A:

Do I really have to hand in all three assignments

on time

?

YES!

• •

Q:

What if I can’t figure out how to solve them?

A: Ask your instructor.

sufficient time.

Start solving them early, so that you will have • •

Q:

What if I get sick or my girlfriend breaks up or my hamster dies?

A:

Start solving them early, so that you will have sufficient time in case of emergencies.

• •

Q: A:

Do I really have to hand in all three assignments?

YES!

4

“Optimization” – a summary!

Exponential

By Branching

Efficient

by Local Search

Mixed Integer Linear Programming … TSP …

?

Linear Programming Min Cost Flow Max Flow Maximum matching Shortest paths

=

reduction 5

Lots and lots of man hours….

6

NP-completeness

Exponential

By Branching

Efficient

by Local Search

Mixed Integer Linear Programming … TSP …

?

Linear Programming Min Cost Flow Max Flow Maximum matching Shortest paths

=

reduction 7

NP-completeness

Mixed Integer Linear Programming …

Exponential

TSP

Efficient

by Local Search No reduction, unless P=NP

Linear Programming Min Cost Flow Max Flow Maximum matching Shortest paths

=

reduction 8

Very useful for saving (human) time

9

Rigorous Formalization

“Problems” “Efficient Algorithms” “Search Problems” “Reductions” “Universal Search Problems” Languages Turing Machines,

P NP

Polynomial Reductions

NPC

10

Problems:

Languages

• A

language L

is a subset of {0,1}*.

• A language models a decision problem: Members of

L

are the

yes

-instances, non members are the

no

-instances.

• This is the

only

kind of problem our theory shall be concerned with!

11

Restriction: Inputs Boolean Strings

• Strings over an arbitrary alphabet can be represented as Boolean Strings (Ex: ascii, unicode).

• In reality, computers may only hold Boolean strings (their memory image

is

a bit string).

• Arbitrary real numbers may not be represented but this is intentional!

12

Models of Computation

Model 1:

Our computer holds exact real numbers. The size of the input is the number of real numbers in the input. The time complexity of an algorithm is the number of arithmetic operations performed.

Model 2:

Our computer holds bits and bytes. The size of the input is the number of bits in the input. The time complexity of an algorithm is the number of bit-operations performed.

• We know an efficient algorithm for linear programming in Model 2 but not model 1.

The NP-completeness theory is intended to capture Model 2 and not Model 1.

13

How to encode max flow instance?

java MaxFlow 6#0|16|13|0|0|0#0|0|10|12|0|0 #0|4|0|0|14|0#0|0|9|0|0|20 #0|0|0|7|0|4|#0|0|0|0|0|0 14

Restriction: All inputs “legal”.

• Any string should be either a

yes

-string or a

no

-string.

• It would be nice to also have “malformed” strings.

• However, we shall just lump the malformed strings with the

no

-strings.

15

Restriction: Output

yes

or

no

• Suppose we want to consider computing a

function, f

: {0,1}* !

{0,1}*.

Stand-in

for

f

:

L f

= {<

x

,

b

(

j

),

y

> |

f

(

x

)

j

= y} •

L f

has an efficient algorithm if and only if f has an efficient algorithm.

16

Restriction: functions

• OPT: Given description of

F

, maximizing

f(x

).

f

find

x

2

F

• There may be several optimal solutions. OPT does not seem to be captured easily by a function.

• Stand-in for OPT: L OPT = { < desc(

F

), desc(

f

), b(  ), b(  ) > | some

x

2

F

has

f

(

x

) ¸  /  } 17

18

L

OPT

vs. OPT

L

OPT may be easy to solve even though OPT is hard to solve, so

L

OPT is not a perfect stand-in.

• However, if

L

OPT has no efficient solution, then OPT has no efficient solution, so

L

OPT can still be used to argue that OPT is hard.

19

Algorithms:

Turing Machines

20

Turing Machines

• A Turing machine consists of an infinite

tape

, divided into

cells

, each holding a symbol from alphabet  that includes 0,1,#.

• A tape

head

a cell.

is at any point in time positioned at • A

finite control

reads the symbol at the head, updates the symbol at the head and the position of the head.

21

Finite Control

• Finite set of states

Q

. The control is in exactly one of the state. Three special states:

start

,

accept

,

reject

.

• Transition function: 22

Running the machine on an input

• The input string is placed on the tape (surrounded by blanks) and the head positioned to the immediate left of the input. The initial state of the finite control is

start

.

• If the finite control eventually goes to

accept

state, the input is accepted (“the machine outputs yes”).

• If the finite control eventually goes to

reject

state, the input is rejected (“the machine outputs no”).

• The machine is said to

decide

all members of

L

a language

L

if it accepts and rejects all members of {0,1}*-

L

.

23

Some Turing Machine Applets

http://math.hws.edu/TMCM/java/labs/xTuringMachineLab.html

http://www.igs.net/~tril/tm/tm.html

http://web.bvu.edu/faculty/schweller/Turing/Turing.html

24

If you want to make rigorous the notion of an “efficient algorithm” why do you choose such a hopelessly

inefficient

device ??!?

25

Church-Turing Thesis

Any decision problem that can be solved by some mechanical procedure, can be solved by a Turing machine.

26

Polynomial Church-Turing thesis

A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only if it can be solved in polynomial time by a Turing machine.

27

The complexity class

P

P

:= the class of decision problems (languages) decided by a Turing machine so that for some polynomial

p

and all

x

, the machine terminates after at most

p

(|

x

|) steps on input

x

. • By the Polynomial Church-Turing Thesis,

P

is “robust” with respect to changes of the machine model.

• Is

P

also robust with respect to changes of the representation of decision problems as languages?

28

How to encode max flow instance?

java MaxFlow 6#0|16|13|0|0|0#0|0|10|12|0|0 #0|4|0|0|14|0#0|0|9|0|0|20 #0|0|0|7|0|4|#0|0|0|0|0|0 29

java MaxFlow 111111 #|1111111111111111|1111111111111||| #||1111111111|111111111111|| #|1111|||11111111111111| #||111111111|||11111111111111111111 #|||1111111||1111 #||||| 30

Polynomial time computable maps

f

: {0,1}* !

{0,1}* is called polynomial time computable if for some polynomial

p

, - For all

x

, |

f

(

x

)| ·

p

(|

x

|).

L f

2

P

.

31

Polynomially equivalent representations

• A representation of objects (say graphs, numbers) as strings is in

P

.

good

if the language of valid representations is • Two different representations of objects are called

polynomially equivalent

if we may translate between them using polynomial time computable maps.

• • •

Ex

: Adjacency matrices vs. Edge lists

Ex

: Binary vs. Decimal

Counterexample

: Binary vs. Unary 32

Robustness of Representation

• Given two good, polynomially equivalent representations of the instances of a decision problem, resulting in languages

L

1 and

L

2 we have

L

1 2

P

iff

L

2 2

P

.

33

Rigorous Formalization

“Problems” “Efficient Algorithms” “Search Problems” “Reductions” “Universal Search Problems” Languages Turing Machines,

P NP

Polynomial Reductions

NPC

34

Search Problems:

NP

• • We want to capture decision problems that can be solved by exhaustive search of the following kind.

Go through a space of possible solutions, checking for each one of them if it is an actual solutions (in which case the answer is yes).

• Example:

Compositeness

. Given a number in binary, is it a product of smaller numbers? 35

Search Problems:

NP

L

is in

NP

iff there is a language

L

’ in

P

polynomial

p

so that: and a 36

Intuition

• The

y

-strings are the

possible solutions

to the instance

x

.

• We require that solutions are not too long and that it can be checked efficiently if a given

y

is indeed a solution (we have a “simple” search problem) 37

38

39

P

vs.

NP

P

is a subset of

NP

• Is

P

=

NP

? Then any “simple” search problem has a polynomial time algorithm. •

This is the most famous open problem of mathematical computer science!

40

.

Clay Mathematics Institute | [home] | [index] |

- Annual Meeting - Research - Students - Awards - Summer School - Workshops - About CMI - Millennium Prize Problems - News -

HOME / MILLENNIUM PRIZE PROBLEMS M I L L E N N I U M P R I Z E P R O B L E M S P versus NP The Hodge Conjecture The Poincaré Conjecture The Riemann Hypothesis

Solved (Perelman)!

Yang-Mills Existence and Mass Gap Navier-Stokes Existence and Smoothness The Birch and Swinnerton-Dyer Conjecture

Announced 16:00, on Wednesday, May 24, 2000 Collège de France 41

P

vs.

NP

and mathematics

• If

P

=

NP

,

mathematicians may be replaced by (much more reliable) computers:

P=NP ) There is an algorithmic procedure that takes as input

any

formal math statement and

always

outputs its shortest formal proof in time polynomial in the length of the proof.

• This is usually regarded (in particular by mathematicians!) as evidence that

P

and

NP

different.

are 42

Rigorous Formalization

“Problems” “Efficient Algorithms” Languages Turing Machines,

P

“Search Problems” “Reductions” “Universal Search Problems”

NP

Polynomial Reductions

NPC

43

Reductions

• A

reduction r

of

L

1 to

L

2 computable map so that is a polynomial time 8

x

:

x

2

L

1 iff

r

(

x

) 2

L

2 • We write L 1 · L 2 if L 1 reduces to L 2 .

Intuition:

Efficient software for L 2 used to efficiently solve L 1 .

can also be 44

Properties of reductions

Transitivity:

L

1 ·

L

2 Æ

L

2 ·

L

3

Downward closure of P:

)

L

1 ·

L

2 Æ

L

2 2

P

L

1 ·

L

)

L

1 2

P

.

3 • Follows from Polynomial Church-Turing thesis.

45

NP

-hardness

• A language L is called

NP

-hard iff 8

L

’ 2

NP

:

L

’ ·

L

Intuition:

Software for L is strong enough to be used to solve any simple search problem.

Proposition

: If some

NP

-hard language is in

P

, then

P

=

NP

.

46

NPC

• A language L 2

NP

that is

NP

-hard is called

NP

-complete.

NPC

:= the class of

NP

-complete problems.

Proposition

:

L

2

NPC

) [

L

2

P

iff

P

=

NP

]. 47