dKS, Spring 2009

23
1 dKS, Spring 2009

description

dKS, Spring 2009. Some practical information. Lecturers: Kristoffer Arnsfelt Hansen and Peter Bro Miltersen. Homepage: www.daimi.au.dk/dKS Kompendium will be available in GAD after easter. Three compulsory assignments, hand in to your teaching assistant at the tutorial on time. - PowerPoint PPT Presentation

Transcript of dKS, Spring 2009

Page 1: dKS, Spring 2009

1

dKS, Spring 2009

Page 2: dKS, Spring 2009

2

Some practical information• Lecturers: Kristoffer Arnsfelt Hansen and Peter Bro Miltersen.

• Homepage: www.daimi.au.dk/dKS

• Kompendium will be available in GAD after easter.

• Three compulsory assignments, hand in to your teaching assistant at the tutorial on time.

• Tutorials start second week of quarter. Due to easter, second week of term starts April 15th.

• Exam is oral, without preparation.

Page 3: dKS, Spring 2009

3Maximum matching

Max Flow

Shortest paths

Min Cost Flow

Linear Programming

Mixed Integer Linear Programming

Polynomial time (easy)

Exponential time (hard).

= reduction

TSP

“Optimization” – a summary!

Page 4: dKS, Spring 2009

4Maximum matching

Max Flow

Shortest paths

Min Cost Flow

Linear Programming

Mixed Integer Linear Programming

Polynomial time (easy)

Exponential time (hard).

= reduction

TSP…

NP-completeness

Page 5: dKS, Spring 2009

5

Rigorous Formalization

“Problems” Languages

“Efficient Algorithms” Turing Machines, P

“Search Problems” NP

“Reductions” Polynomial Reductions

“Universal Search Problems” NPC

Page 6: dKS, Spring 2009

6

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!

Page 7: dKS, Spring 2009

7

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!

Page 8: dKS, Spring 2009

8

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.

Page 9: dKS, Spring 2009

9

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

How to encode max flow instance?

Page 10: dKS, Spring 2009

10

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.

Page 11: dKS, Spring 2009

11

Restriction: Output yes or no

• Suppose we want to consider computing a function, f: {0,1}* ! {0,1}*.

• Stand-in for f:

Lf = {<x, b(j), y> | f(x)j = y}

Page 12: dKS, Spring 2009

12

Restriction: functions

• OPT: Given description of F, f find x 2 F maximizing f(x).

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

• Stand-in for OPT:

LOPT = { < desc(F), desc(f), b(), b() > | some x 2 F has f(x) ¸ / }

Page 13: dKS, Spring 2009

13

Page 14: dKS, Spring 2009

14

LOPT vs. OPT

• LOPT may be easy to solve even though OPT is hard to solve, so LOPT is not a perfect stand-in.

• However, if LOPT has no efficient solution, then OPT has no efficient solution, so LOPT can still be used to argue that OPT is hard.

Page 15: dKS, Spring 2009

15

Algorithms: Turing Machines

Page 16: dKS, Spring 2009

16

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 is at any point in time positioned at a cell.

• A finite control reads the symbol at the head, updates the symbol at the head and the position of the head.

Page 17: dKS, Spring 2009

17

Finite Control

• Finite set of states Q. The control is in exactly one of the state. Three special states: start, accept, reject.

• Transition function:

Page 18: dKS, Spring 2009

18

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 a language L if it accepts all members of L and rejects all members of {0,1}*-L.

Page 20: dKS, Spring 2009

20

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

Page 21: dKS, Spring 2009

21

Church-Turing Thesis

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

Page 22: dKS, Spring 2009

22

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.

Page 23: dKS, Spring 2009

23

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?