340 likes | 466 Views
CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. HARDEST PROBLEMS IN NP. Theorem: A language B is NP-complete if:. Definition: A language B is NP-complete if:. 1. B NP. 2. A is NP-complete and A ≤ P B. 2. Every A in NP is poly-time reducible to B (i.e. B is NP-hard).
E N D
CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS
HARDEST PROBLEMS IN NP Theorem: A language B is NP-complete if: Definition: A language B is NP-complete if: 1. B NP 2. A is NP-complete and A ≤PB 2. Every A in NP is poly-time reducible to B (i.e. B is NP-hard) If B is NP-Complete and P NP, then There is no fast algorithm for B.
REDUCTION STRATEGIES A reduction by restriction shows that the source problem is a special case of the target problem. For example, 3SAT ≤P CNF-SAT because every satisfiable 3CNF is also a satisfiable CNF. Example. Prove 3SAT ≤P 4SAT by restriction. A 3CNF can be converted to an equivalent 4CNF by repeating one literal in each clause.
REDUCTION STRATEGIES A reduction from A to B by local replacement shows how to “translate” between “units” of A and “units” of B. Example. vertex cover “units” are vertices and edges; set cover “units” are elements and sets. Example. CIRCUIT-SAT units are gates, CNFSAT units are clauses, 3SAT units are 3-literal clauses.
GRADUATION A transcript is a set of course numbers a student has taken A major consists of: Pairs: exactly one of which must be taken Lists: at least one course of which must be taken GRADUATION = {〈T,M〉 | a subset of T satisfies M} For example: T = {1901A, 1902B, 1902A, 2011, 4041A, 4061, 4211} M = [1901A,1901B], [1902A,1902B] (4011,4041A,4041B), (4211,4707), (4061)
GRADUATION ∈NP: The subset is a proof that (T,M) ∈GRADUATION. 3SAT ≤PGRADUATION: T = {101, 102, 201, 202, 301, 302} (x1⋁ x2⋁ ¬x3) ∧ (¬x1 ⋁ x2 ⋁ x2) ∧ (¬x2⋁ x3⋁ x1) M = [101, 102], [201, 202], [301, 302] (101,201,302), (101,201,201), (101,202,301)
GRADUATION ∈NP: The subset is a proof that (T,M) ∈GRADUATION. 3SAT ≤PGRADUATION: Let = C1∧ C2∧ … ∧Cm have variables x1…xk For each xi: add classes i01 and i02 to T. add pair (i01,i02) to M. For each Cj, we add a triple to M: if xi is a literal in Cj, the triple includes i01. if ¬xiis a literal in Cj, the triple includes i02.
UHAMPATH No HAM PATH Undirected HAM PATH B A B A C D C D E F E F UHAMPATH = {〈G,s,t〉 | G is an undirected graph with a Hamiltonian path from s to t}
HAMPATH≤PUHAMPATH Amid Aout B A Ain C D E F
HAMPATH ≤PUHAMPATH B A C D E F
3SAT P SUBSET-SUM We transform a 3-cnf formula into 〈y1…yn, t〉: 3SAT 〈y1…yn,t〉 SUBSET-SUM The transformation can be done in time polynomial in the length of
Each variable and each clause result in two yi’s. Each yi will have a digit for each clause and variable. x2 x1 C3 C2 C1 x1 (x1⋁ x2 ⋁ x2) ∧ (¬x1⋁ x2⋁ x2) ∧ (x1 ⋁ ¬x2⋁ x2) x2 C3 C2 C1
REDUCTION STRATEGIES A reduction by component design constructs gadgets that simulate variables and clauses. In particular a reduction must provide: a gadget to force the solution to the target instance to choose either x or ¬x a gadget to force the solution to the target instance to choose one literal from each clause a gadget to force the solution to the target instance to satisfy every clause
e f b a g d c K-CLIQUES
3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that 3SAT 〈G,k〉 CLIQUE The transformation can be done in time polynomial in the length of
x1 x2 x2 x1 x1 x1 x2 x2 x2 (x1 x1 x2) (x1 x2 x2) (x1 x2 x2) k = #clauses
x1 x1 x2 x2 x2 x2 x1 x1 x1 x2 x2 x1 (x1 x1 x1) (x1 x1 x2) (x2 x2 x2) (x2 x2 x1)
3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that 3SAT 〈G,k〉 CLIQUE If has k clauses, we create a graph with k clusters of 3 nodes each. Each cluster corresponds to a clause. Each node in a cluster is labeled with a literal from the clause. We do not connect any nodes in the same cluster We connect nodes in different clusters whenever they are not contradictory
3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that 3SAT 〈G,k〉 CLIQUE is satisfiable iff there is an assignment that makes at least one literal true in each clause. The nodes corresponding to these k true literals do not contradict each other, so they form a k- clique in G. A k-clique in G must have one node from each cluster. Setting the corresponding literals to true will satisfy
e e b b a a d d c c VERTEX COVER Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER NP (2) CLIQUE ≤P IND-SET ≤P VERTEX-COVER
e f b a g d i c h HAMILTONIAN PATHS
HAMPATH = { 〈G,s,t〉 | G is a graph with a Hamiltonian path from s to t } Theorem: HAMPATH is NP-Complete (1) HAMPATH NP (2) 3SAT P HAMPATH
3SAT P HAMPATH We transform a 3-cnf formula into 〈G,s,t〉 so that 3SAT 〈G,s,t〉 HAMPATH The transformation can be done in time polynomial in the length of
x1 x1 x2 x2 s t (x1Ç x2Ç x2) Æ (:x1Ç x2Ç x2)
x11 x12 x21 x22 x1 x1 x2 x2 c1 s t (x1Ç x2Ç x2) Æ (:x1Ç x2Ç x2)
x11 x15 x14 x22 x21 x12 x24 x25 c1 c2 x1 x2 x2 x1 s t (x1Ç x2Ç x2) Æ (:x1Ç x2Ç x2)
c e e b b b b a a a a d d d d c c 3-COLORING
3SAT P 3COLOR We transform a 3-cnf formula into a graph G so 3SAT G 3COLOR The transformation can be done in time polynomial in the length of
x1 x1 ? T F x2 x2 (x1Ç x2Ç x2)
? T F (x1Ç x2Ç x2) x1 x1 x2 x2 c13 c11 c12 c16 c14 c15
? T F (x1Ç x2Ç x2) Æ (x2 Ç :x1 Ç:x1) x1 x1 x2 x2 c13 c13 c11 c12 c11 c12 c16 c14 c16 c15 c14 c15
? T F (x1Ç x2Ç x2) Æ (x2 Ç :x1 Ç:x1) x1 x1 x2 x2 c13 c13 c11 c12 c11 c12 c16 c14 c16 c15 c14 c15
MOREGADGETS http://web.mat.bham.ac.uk/R.W.Kaye/minesw/
MOREGADGETS http://arxiv.org/abs/1203.1895