Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar

Slides:



Advertisements
Similar presentations
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
Advertisements

Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Lecture 21 NP-complete problems
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
The Theory of NP-Completeness
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
NP-complete and NP-hard problems
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Analysis of Algorithms CS 477/677
NP-complete examples CSC3130 Tutorial 11 Xiao Linfu Department of Computer Science & Engineering Fall 2009.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Polyhedral Optimization Lecture 1 – Part 2 M. Pawan Kumar Slides available online
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Non-Approximability Results. Summary -Gap technique -Examples: MINIMUM GRAPH COLORING, MINIMUM TSP, MINIMUM BIN PACKING -The PCP theorem -Application:
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
Discrete Optimization Lecture 4 M. Pawan Kumar
NP-Completness Turing Machine. Hard problems There are many many important problems for which no polynomial algorithms is known. We show that a polynomial-time.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Discrete Optimization Lecture 4 – Part 1 M. Pawan Kumar
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
NP-completeness NP-complete problems. Homework Vertex Cover Instance. A graph G and an integer k. Question. Is there a vertex cover of cardinality k?
NPC.
CSC 413/513: Intro to Algorithms
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Discrete Optimization Lecture 6 – Part 1 M. Pawan Kumar
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Discrete Optimization MA2827 Fondements de l’optimisation discrète Material from M. Pawan Kumar, E. Demaine.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Discrete Optimization
Lecture 24 NP-Complete Problems
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Prabhas Chongstitvatana
CSE 589 Applied Algorithms Spring 1999
Presentation transcript:

Discrete Optimization Lecture 6 – Part 2 M. Pawan Kumar

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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?

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.

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

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 !!

Outline Reduction NP-hard Problems NP-completeness of SAT

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 Λ

NP-hard Image Courtesy of Wikipedia

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 !!

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 !!

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 !!

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 !!

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 !!

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 !!

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  Π’

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

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.

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

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)

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))

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

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