Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar

Similar presentations


Presentation on theme: "Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar"— Presentation transcript:

1 Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar pawan.kumar@ecp.fr

2 Finite set Σ called alphabet of size ≥ 2 –{0,1} –{a,b,c,d,e,…,x,y,z} Set Σ* of all finite length strings (called words) –0, 1, 00, 01, 10, 11, 000,…. –discrete, optimization Size of word size(w) = number of letters –size(00) = 2 –size(discrete) = 8 Decision Problem

3 Problem Π is a subset of Σ* –All words with the answer “yes” Informal problem –Given input word x  Σ*, does x  Π ? Polynomial-time solvable problem Π –There exists a polynomial-time algorithm for the informal problem –Polynomial in size(x) Decision Problem

4 P Polynomial-time solvable problem Π –There exists a polynomial-time algorithm that decides whether x  Σ* belongs to Π or not. –Polynomial in size(x) P = {all Π, Π is polynomial time solvable} For example –Shortest path with +ve lengths  P –Shortest path with no –ve length circuit  P

5 NP Π  NP –There exists a problem Π’  P –There exists a polynomial p –There exists an x, size(x) ≤ p(size(w)) such that –w  Π if and only if wx  Π’ Polynomial-time checkable ‘certificate’ For example –Hamiltonian graph problem  NP

6 Reduction Π is reducible to Λ –There exists a polynomial time algorithm –Given w, returns x –w  Π if and only if x  Λ Λ  NP-complete –All Π  NP can be reduced to Λ –“Hardest” problems in NP

7 Outline Reduction –“SAT” is reducible to “3-SAT” –“3-SAT” is reducible to “Partition” –“Partition” is reducible to “Hamiltonian Path” NP-hard Problems NP-completeness of SAT

8 Alphabet Σ containing variables x 1,x 2,…,x n And special symbols (, ), ∧, ∨,~ And not containing 0 and 1 A variable is a Boolean expression Boolean Expression

9 Alphabet Σ containing variables x 1,x 2,…,x n And special symbols (, ), ∧, ∨,~ And not containing 0 and 1 If v and w are Boolean expressions then –(v ∧ w) is a Boolean expression Boolean Expression

10 Alphabet Σ containing variables x 1,x 2,…,x n And special symbols (, ), ∧, ∨,~ And not containing 0 and 1 If v and w are Boolean expressions then –(v ∨ w) is a Boolean expression Boolean Expression

11 Alphabet Σ containing variables x 1,x 2,…,x n And special symbols (, ), ∧, ∨,~ And not containing 0 and 1 If v and w are Boolean expressions then –~v is a Boolean expression –~w is a Boolean expression Boolean Expression

12 Alphabet Σ containing variables x 1,x 2,…,x n And special symbols (, ), ∧, ∨,~ And not containing 0 and 1 For example, f(x 1,x 2,…,x n ) –((x 2 ∧ x 3 ) ∨ ~(x 3 ∨ x 5 ) ∧ x 2 ) ∨ ~(x 2 ∧ x 5 ) –~(~x 2 ∨ ~x 3 ) ∧ ~x 1 Boolean Expression

13 f(x 1,x 2,…,x n ) is satisfiable if –there exists an assignment x 1 = α 1, …, x n = α n –where α i  {0,1} –such that f(x 1,x 2,…,x n ) = 1 The following identities hold –0 ∧ 0 = 0, 0 ∧ 1 = 0, 1 ∧ 0 = 0, 1 ∧ 1 = 1 –0 ∨ 0 = 0, 0 ∨ 1 = 1, 1 ∨ 0 = 1, 1 ∨ 1 = 1 –~0 = 1, ~1 = 0 –(0) = 0, (1) = 1 Satisfiability

14 Given the alphabet Σ Given the identities for 0 and 1 SAT is a subset of Σ* that is satisfiable Informal Problem –Given a Boolean expression w, is w satisfiable SAT

15 A special case of SAT Given variables x 1,x 2,…,x n  Σ –B 1 consists of x 1,~x 1,…,x n,~x n –B 2 consists of (w 1 ∨ … ∨ w k ), w i  B 1, 1≤k≤3 –B 3 consists of w 1 ∧ w 2 ∧ … ∧ w m, w i  B 2 –e.g., (x 1 ∨ ~x 2 ∨ x 3 ) ∧ (x 2 ∨ ~x 3 ∨ x 4 ) ∧ (~x 1 ∨ ~x 2 ) 3-SAT is the subset of B 3 that is satisfiable 3-SAT

16 x 1 = x 2 ∨ x 3 –(x 1 ∨ ~x 2 ) ∧ (x 1 ∨ ~x 3 ) ∧ (~x 1 ∨ x 2 ∨ x 3 ) x 1 = x 2 ∧ x 3 –(~x 1 ∨ x 2 ) ∧ (~x 1 ∨ x 3 ) ∧ (x 1 ∨ ~x 2 ∨ ~x 3 ) x 1 = ~x 2 –(x 1 ∨ x 2 ) ∧ (~x 1 ∨ ~x 2 ) SAT is reducible to 3-SAT

17 Outline Reduction –“SAT” is reducible to “3-SAT” –“3-SAT” is reducible to “Partition” –“Partition” is reducible to “Hamiltonian Path” NP-hard Problems NP-completeness of SAT

18 A special case of SAT Given variables x 1,x 2,…,x n  Σ –B 1 consists of x 1,~x 1,…,x n,~x n –B 2 consists of (w 1 ∨ … ∨ w k ), w i  B 1, 1≤k≤3 –B 3 consists of w 1 ∧ w 2 ∧ … ∧ w m, w i  B 2 –e.g., (x 1 ∨ ~x 2 ∨ x 3 ) ∧ (x 2 ∨ ~x 3 ∨ x 4 ) ∧ (~x 1 ∨ ~x 2 ) 3-SAT is the subset of B 3 that is satisfiable 3-SAT

19 A finite set X Partition of X is a collection of subsets –Mutually exclusive –Collectively exhaustive For example, X = {a,b,c,d,e,f} –{{a,b},{c},{d,e,f}} is a partition –{{a,b},{a,c},{d,e,f}} is not a partition –{{a,b},{c},{d,e}} is not a partition Partition

20 A finite set X Partition of X is a collection of subsets –Mutually exclusive –Collectively exhaustive Problem: Given collection of subsets C –Does C contain a partition of X? –Or not? Partition

21 f = w 1 ∧ w 2 ∧ … w m Bipartite undirected graph with V = V 1 U V 2 –V 1 are variables x 1,x 2,…,x n –V 2 are words w 1,w 2,…,w m Edges E = E 1 U E 2 –E 1 = {(w i,x j )}, x j  w i –E 2 = {(w i,x j )}, ~x j  w i 3-SAT is reducible to Partition

22 Collection C 1 of sets {w i } U E i –E i is non-empty –E i is a subset of edge set incident with w i Collection C 2 of sets {x j } U E j and {x j } U E’ j –E j is the set of all edges in E 1 incident with x j –E’ j is the set of all edges in E 2 incident with x j f is satisfiable iff C 1 U C 2 contains a partition 3-SAT is reducible to Partition

23 Outline Reduction –“SAT” is reducible to “3-SAT” (review) –“3-SAT” is reducible to “Partition” –“Partition” is reducible to “Hamiltonian Path” NP-hard Problems NP-completeness of SAT

24 A finite set X Partition of X is a collection of subsets –Mutually exclusive –Collectively exhaustive Problem: Given collection of subsets C –Does C contain a partition of X? –Or not? Partition

25 Digraph D = (V, A) Path P is Hamiltonian if –It traverses each vertex in V –All vertices in the path are distinct Problem: Given D –Does it contain a Hamiltonian Path? –Or not? Hamiltonian Path Connection to Shortest Path?

26 Partition Problem: Set X, Collection C –X = {1,2,…,k} –C = {C 1,C 2,…,C m } Let C i = {j 1,…,j t } Partition is reducible to Hamiltonian Introduce r 0 and s 0. Connect r m to s 0.

27 Partition Problem: Set X, Collection C –X = {1,2,…,k} –C = {C 1,C 2,…,C m } Let C i = {j 1,…,j t } Partition is reducible to Hamiltonian C has a partition iff G has Hamiltonian r 0 -s k path

28 Partition Problem: Set X, Collection C –X = {1,2,…,k} –C = {C 1,C 2,…,C m } Let C i = {j 1,…,j t } Partition is reducible to Hamiltonian Left as Exercise !!

29 Outline Reduction NP-hard Problems NP-completeness of SAT

30 NP-hard Need not be in NP –No polynomial-time checkable certificate –Not even a decision problem (e.g. optimization) At least as hard as NP-complete problems Λ  NP-hard –There exists Π  NP-complete –Π is reducible to Λ

31 NP-hard Image Courtesy of Wikipedia

32 Outline Reduction NP-hard Problems NP-completeness of SAT –Random Access Machine (review) –Cook’s Theorem

33 Given an array f with elements = 0,1 strings RAM executes a set of instructions Each instruction can –Read entries from prescribed positions –Perform arithmetic operation on read entries –Write answers to prescribed positions Random Access Machine

34 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Instructions numbered 0, 1, …, t Variable z 0 stores the instruction to execute Random Access Machine

35 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Instructions numbered 0, 1, …, t Stop if z 0 > t Random Access Machine

36 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Read instruction –z i := f(z j ) Random Access Machine

37 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Write instruction –f(z i ) := z j Random Access Machine

38 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Add instruction –z i := z j + z k Random Access Machine

39 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Subtract instruction –z i := z j - z k Random Access Machine

40 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Multiply instruction –z i := z j z k Random Access Machine

41 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Divide instruction –z i := z j / z k Random Access Machine

42 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Increment instruction –z i := z i + 1 Random Access Machine

43 Given an array f with elements = 0,1 strings Finite set of variables z 0, z 1, …, z k Initially, z i = 0 and f contains input Binarize instruction –z i := 1, if z i > 0 –z i := 0, otherwise Random Access Machine

44 Outline Reduction NP-hard Problems NP-completeness of SAT –Random Access Machine (review) –Cook’s Theorem

45 Key Observation z i = f(z j ) Remember z i, z j and f(z j ) are Boolean strings –z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –f(z j ) = b 1 b 2 b 3 b 4 …b n, b  {0,1} n “Read” as Boolean expression –a k =b k implies (a k ∧ b k ) ∨ (~a k ∧ ~b k ) = 1 –a k = b k = 1 OR a k = b k = 0 –B(a,b) = 1

46 Key Observation f(z i ) = z j Remember z i, z j and f(z i ) are Boolean strings –f(z i ) = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –z j = b 1 b 2 b 3 b 4 …b n, b  {0,1} n “Write” as Boolean expression –a k =b k implies (a k ∧ b k ) ∨ (~a k ∧ ~b k ) = 1 –a k = b k = 1 OR a k = b k = 0 –B(a,b) = 1

47 Key Observation z i = z j + z k Remember z i, z j and z k are Boolean strings –z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –z j = b 1 b 2 b 3 b 4 …b n, b  {0,1} n –z k = c 1 c 2 c 3 c 4 …c n, c  {0,1} n “Add” as Boolean expression –B(a,b,c) = 1 –Boolean algebra !!

48 Key Observation z i = z j - z k Remember z i, z j and z k are Boolean strings –z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –z j = b 1 b 2 b 3 b 4 …b n, b  {0,1} n –z k = c 1 c 2 c 3 c 4 …c n, c  {0,1} n “Subtract” as Boolean expression –B(a,b,c) = 1 –Boolean algebra !!

49 Key Observation z i = z j z k Remember z i, z j and z k are Boolean strings –z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –z j = b 1 b 2 b 3 b 4 …b n, b  {0,1} n –z k = c 1 c 2 c 3 c 4 …c n, c  {0,1} n “Multiply” as Boolean expression –B(a,b,c) = 1 –Boolean algebra !!

50 Key Observation z i = z j / z k Remember z i, z j and z k are Boolean strings –z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –z j = b 1 b 2 b 3 b 4 …b n, b  {0,1} n –z k = c 1 c 2 c 3 c 4 …c n, c  {0,1} n “Divide” as Boolean expression –B(a,b,c) = 1 –Boolean algebra !!

51 Key Observation z i = z i + 1 Remember old/new z i are Boolean strings –Old z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –New z i = b 1 b 2 b 3 b 4 …b n, b  {0,1} n “Increment” as Boolean expression –B(a,b) = 1 –Boolean algebra !!

52 Key Observation z i = 1 if z i > 0 and 0 otherwise Remember old/new z i are Boolean strings –Old z i = a 1 a 2 a 3 a 4 …a n, a  {0,1} n –New z i = b 1 b 2 b 3 b 4 …b n, b  {0,1} n “Binarize” as Boolean expression –B(a,b) = 1 –Boolean algebra !!

53 Cook’s Theorem Any problem in NP can be reduced to SAT Consider a problem Π  NP There is a corresponding problem Π’  P w  Π –There exists x, size(x) = poly(size(w)) –wx  Π’

54 Input for RAM of Π’ Input f(1), f(2), …, f(q) Each f(i)  {0,1} n Let w = f(1)f(2)…f(q’) Then x=f(q’+1)f(q’+2)…f(q) Size of input = q*n

55 Output for RAM of Π’ W.l.o.g., at termination output is written at f(0) E.g., f(0) = {1} n implies wx  Π’, otherwise not.

56 Variables for RAM of Π’ Variables z 0,z 1,…,z k k is polynomial in the size of input

57 Machine Memory The word m = z 0 z 1..z k f(0)f(1)…f(q) Size of m = (k+q+2)*n = poly(size(input)) Machine memory at iteration i = m i m i = z i 0 z i 1..z i k f i (0)f i (1)…f i (q)

58 History The algorithm terminates after r iterations Define history h = m 0 m 1 m 2 …m r Size of h = (r+1)*size(m) = s = poly(size(input))

59 Correct and Incorrect History Given h = {0,1} s, it is “correct” if there is an input wx such that the RAM has history h Given h = {0,1} s, it is “incorrect” if there is no input wx such that the RAM has history h

60 SAT Boolean expression g(h) –g(h) = 1 if h is “correct” –g(h) = 0 if h is “incorrect” Set f 0 (1)f 0 (2)f 0 (q’) = w Set f r (0) = {1} n w  Π if and only if g is satisfiable


Download ppt "Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar"

Similar presentations


Ads by Google