08IntractabilityII

Embed Size (px)

Citation preview

  • 7/25/2019 08IntractabilityII

    1/67

    Lecture slides by Kevin Wayne

    Copyright 2005 Pearson-Addison Wesley

    Copyright 2013 Kevin Wayne

    http://www.cs.princeton.edu/~wayne/kleinberg-tardos

    Last updated on Sep 8, 2013 6:41 AM

    8. INTRACTABILITY II

    ! P vs. NP

    ! NP-complete

    !

    co-NP! NP-hard

  • 7/25/2019 08IntractabilityII

    2/67

    3-SATpoly-time reduces to all of

    these problems (and many, many more)

    2

    Recap

    3-SAT

    DIR-HAM-CYCLEINDEPENDENT-SET

    VERTEX-COVER

    3-SAT

    poly-

    timer

    educ

    es

    toIND

    EPEN

    DENT

    -SET

    GRAPH-3-COLOR

    HAM-CYCLE

    TSP

    SUBSET-SUM

    SCHEDULINGPLANAR-3-COLOR

    SET-COVER

  • 7/25/2019 08IntractabilityII

    3/67

    SECTION 8.3

    8. INTRACTABILITY II

    ! P vs. NP

    ! NP-complete

    !

    co-NP! NP-hard

  • 7/25/2019 08IntractabilityII

    4/67

    3

    Decision problems

    Decision problem.

    ProblemXis a set of strings.Instance s is one string.

    AlgorithmAsolves problemX: A(s) =yesiff s!X.

    Def. AlgorithmAruns in polynomial timeif for every string s,A(s)

    terminates in at mostp(|s|)"steps", wherep(")is some polynomial.

    Ex.

    Problem PRIMES= { 2, 3, 5, 7, 11, 13, 17, 23, 29, 31, 37, . }.

    Instance s= 592335744548702854681.

    AKS algorithm PRIMES in O(|s|8) steps.

    length of s

  • 7/25/2019 08IntractabilityII

    5/67

    P. Decision problems for which there is a poly-time algorithm.

    Problem Description Algorithm yes no

    MULTIPLE Isxa multiple ofy ? grade-school division 51, 17 51, 16

    REL-PRIME Arexandyrelatively prime ? Euclid (300 BCE) 34, 39 34, 51

    PRIMES Isxprime ? AKS (2002) 53 51

    EDIT-DISTANCEIs the edit distance between

    xandyless than 5 ?

    dynamic

    programming

    niether

    neither

    acgggt

    ttttta

    L-SOLVEIs there a vector xthat

    satisfiesAx = b ?

    Gauss-Edmonds

    elimination

    ST-CONNIs there a path between s

    and tin a graph G ?

    depth-first search

    (Theseus)

    Definition of P

    0 1 1

    2 4 "2

    0 3 15

    #

    $

    %

    %

    %

    &

    '

    (

    (

    (

    ,

    4

    2

    36

    #

    $

    %

    %

    %

    &

    '

    (

    (

    (

    1 0 0

    1 1 1

    0 1 1

    "

    #

    $

    $

    $

    %

    &

    '

    '

    '

    ,

    1

    1

    1

    "

    #

    $

    $

    $

    %

    &

    '

    '

    '

    5

  • 7/25/2019 08IntractabilityII

    6/67

    NP

    Certification algorithm intuition.

    Certifier views things from "managerial" viewpoint.Certifier doesn't determine whether s!Xon its own;

    rather, it checks a proposed proof tthat s!X.

    Def. Algorithm C(s, t)is a certifierfor problemXif for every string s,

    s!Xiff there exists a string tsuch that C(s, t) =yes.

    Def. NPis the set of problems for which there exists a poly-time certifier.

    C(s,t)is a poly-time algorithm.

    Certificate t is of polynomial size: |t| !p(|s|)for some polynomialp(")

    Remark. NPstands for nondeterministicpolynomial time.

    6

    "certificate" or "witness"

  • 7/25/2019 08IntractabilityII

    7/67

    COMPOSITES. Given an integer s, is scomposite?

    Certificate. A nontrivial factor tof s. Such a certificate exists iff sis

    composite. Moreover |t| !|s|.

    Certifier. Check that 1< t < sand that sis a multiple of t.

    Conclusion. COMPOSITES!NP.

    Certifiers and certificates: composite

    7

    437,669 = 541 809

    instance s 437669

    certificate t 541 or 809

  • 7/25/2019 08IntractabilityII

    8/67

    3-SAT. Given a CNF formula ", is there a satisfying assignment?

    Certificate. An assignment of truth values to the nboolean variables.

    Certifier. Check that each clause in "has at least one true literal.

    Conclusion. 3-SAT!NP.

    Certifiers and certificates: 3-satisfiability

    8

    " = x

    1 # x

    2 # x

    3( ) $ x1 # x2 # x3( ) $ x1 # x2 # x4( )instance s

    certificate t x1= true, x2= true, x3= false, x4= false

  • 7/25/2019 08IntractabilityII

    9/67

    Certifiers and certificates: Hamilton path

    HAM-PATH. Given an undirected graph G= (V,E), does there exist a simple

    path Pthat visits every node?

    Certificate. A permutation of the nnodes.

    Certifier. Check that the permutation contains each node in Vexactly once,

    and that there is an edge between each pair of adjacent nodes.

    Conclusion. HAM-PATH!NP.

    instance s certificate t

    9

  • 7/25/2019 08IntractabilityII

    10/67

    NP. Decision problems for which there is a poly-time certifier.

    Problem Description Algorithm yes no

    L-SOLVEIs there a vectorxthat

    satisfiesAx = b ?

    Gauss-Edmondselimination

    COMPOSITES Isxcomposite ? AKS (2002) 51 53

    FACTORDoesxhave a nontrivial factor

    less thany ?? (56159, 50) (55687, 50)

    SATIs there a truth assignment that

    satisfies the formula?? x1!x2x1!x2

    x2x1!x2

    x1!

    x2

    3-COLORCan the nodes of a graph Gbe

    colored with 3 colors??

    HAM-PATHIs there a simple path between

    sand tthat visits every node??

    Definition of NP

    0 1 1

    2 4 "2

    0 3 15

    #

    $

    %

    %%

    &

    '

    (

    ((

    ,

    4

    2

    36

    #

    $

    %

    %%

    &

    '

    (

    ((

    1 0 0

    1 1 1

    0 1 1

    "

    #

    $

    $$

    %

    &

    '

    ''

    ,

    1

    1

    1

    "

    #

    $

    $$

    %

    &

    '

    ''

    10

  • 7/25/2019 08IntractabilityII

    11/67

    Definition of NP

    NP. Decision problems for which there is a poly-time certifier.

    11

    NP captures vast domains of computational, scientific, and mathematical

    endeavors, and seems to roughly delimit what mathematicians and scientists

    have been aspiring to compute feasibly. Christos Papadimitriou

    In an ideal world it would be renamed P vs VP. Clyde Kruskal

  • 7/25/2019 08IntractabilityII

    12/67

    P, NP, and EXP

    P. Decision problems for which there is a poly-time algorithm.

    NP. Decision problems for which there is a poly-time certifier.EXP. Decision problems for which there is an exponential-time algorithm.

    Claim. P # NP.

    Pf. Consider any problemX!P.

    By definition, there exists a poly-time algorithm A(s)that solvesX.

    Certificate t= #, certifier C(s, t) =A(s). !

    Claim. NP # EXP.

    Pf. Consider any problemX!NP.

    By definition, there exists a poly-time certifier C(s, t)forX.

    To solve input s, run C(s, t)on all strings twith |t| !p(|s|).

    Returnyesif C(s, t)returnsyesfor any of these potential certificates. !

    Remark. Time-hierarchy theorem implies P ! EXP.

    12

  • 7/25/2019 08IntractabilityII

    13/67

    The main question: P vs. NP

    Q. How to solve an instance of 3-SATwith nvariables?

    A. Exhaustive search: try all 2ntruth assignments.

    Q. Can we do anything substantially more clever?

    Conjecture. No poly-time algorithm for 3-SAT.

    13

    "intractable"

  • 7/25/2019 08IntractabilityII

    14/67

    The main question: P vs. NP

    Does P = NP? [Cook 1971, Edmonds, Levin, Yablonski, Gdel]

    Is the decision problem as easy as the certification problem?

    If yes. Efficient algorithms for 3-SAT, TSP, 3-COLOR, FACTOR,

    If no. No efficient algorithms possible for 3-SAT, TSP, 3-COLOR,

    Consensus opinion. Probably no.

    EXP NP

    P

    If P !NP If P = NP

    EXP

    P = NP

    14

  • 7/25/2019 08IntractabilityII

    15/67

    Possible outcomes

    P "NP.

    15

    I conjecture that there is no good algorithm for the traveling salesman

    problem. My reasons are the same as for any mathematical conjecture:

    (i) It is a legitimate mathematical possibility and (ii) I do not know.

    Jack Edmonds 1966

  • 7/25/2019 08IntractabilityII

    16/67

    Possible outcomes

    P "NP.

    16

    In my view, there is no way to even make intelligent guesses about the

    answer to any of these questions. If I had to bet now, I would bet that

    P is not equal to NP. I estimate the half-life of this problem at 2550

    more years, but I wouldnt bet on it being solved before 2100.

    Bob Tarjan

    We seem to be missing even the most basic understanding of the

    nature of its difficulty. All approaches tried so far probably (in

    some cases, provably) have failed. In this sense P =NP is different

    from many other major mathematical problems on which a gradual

    progress was being constantly done (sometimes for centuries)

    whereupon they yielded, either completely or partially.

    Alexander Razborov

  • 7/25/2019 08IntractabilityII

    17/67

    Possible outcomes

    P = NP.

    17

    P = NP. In my opinion this shouldnt really be a hard problem; its just

    that we came late to this theory, and havent yet developed any

    techniques for proving computations to be hard. Eventually, it will

    just be a footnote in the books. John Conway

  • 7/25/2019 08IntractabilityII

    18/67

    Other possible outcomes

    P= NP, but only !(n100)algorithm for 3-SAT.

    P"NP, but with O(nlog*n)algorithm for 3-SAT.

    P= NPis independent (of ZFC axiomatic set theory).

    18

    It will be solved by either 2048 or 4096. I am currently somewhat

    pessimistic. The outcome will be the truly worst case scenario:

    namely that someone will prove P = NP because there are only

    finitely many obstructions to the opposite hypothesis; hence there

    will exists a polynomial time solution to SAT but we will never

    know its complexity! Donald Knuth

  • 7/25/2019 08IntractabilityII

    19/67

    Millennium prize

    Millennium prize. $1 million for resolution of P = NPproblem.

    19

  • 7/25/2019 08IntractabilityII

    20/67

    Looking for a job?

    Some writers for the Simpsons and Futurama.

    J. Steward Burns. M.S. in mathematics (Berkeley '93).

    David X. Cohen. M.S. in computer science (Berkeley '92).

    Al Jean. B.S. in mathematics. (Harvard '81).

    Ken Keeler. Ph.D. in applied mathematics (Harvard '90).

    Jeff Westbrook. Ph.D. in computer science (Princeton '89).

    Copyright 2000, Twentieth Century FoxCopyright 1990, Matt Groening20

  • 7/25/2019 08IntractabilityII

    21/67

    21

    Princeton CS Building, West Wall, Circa 2001

  • 7/25/2019 08IntractabilityII

    22/67

    Princeton CS Building, West Wall, Circa 2001

    01

    1

    00

    0

    0

    char ASCII binary

    P 80 1010000

    = 61 0111101

    N 78 1001110

    P 80 1010000

    ? 63 0111111

    11

    0

    10

    1

    1

    1

    01

    11

    0

    00

    1

    1

    00

    0

    01

    10

    11

    1

    1

    22

  • 7/25/2019 08IntractabilityII

    23/67

    SECTION 8.4

    8. INTRACTABILITY II

    ! P vs. NP

    ! NP-complete

    ! co-NP

    ! NP-hard

  • 7/25/2019 08IntractabilityII

    24/67

    Polynomial transformation

    Def. ProblemXpolynomial (Cook) reducesto problem Yif arbitrary

    instances of problemXcan be solved using:Polynomial number of standard computational steps, plus

    Polynomial number of calls to oracle that solves problem Y.

    Def. ProblemXpolynomial (Karp) transformsto problem Yif given any

    inputxtoX, we can construct an inputysuch thatxis ayesinstance ofXiffyis ayesinstance of Y.

    Note. Polynomial transformation is polynomial reduction with just one call

    to oracle for Y, exactly at the end of the algorithm forX. Almost all previousreductions were of this form.

    Open question. Are these two concepts the same with respect to NP?

    we require |y| to be of size polynomial in |x|

    we abuse notation #pand blur distinction24

  • 7/25/2019 08IntractabilityII

    25/67

    NP-complete

    NP-complete. A problem Y!NPwith the property that for every

    problemX!NP,X!pY.

    Theorem. Suppose Y!NP-complete. Then Y!Piff P = NP.

    Pf. $ If P = NP, then Y!Pbecause Y!NP.

    Pf. % Suppose Y!P.

    Consider any problemX!NP. SinceX!pY, we haveX!P.This implies NP# P.

    We already know P# NP. Thus P = NP. !

    Fundamental question. Do there exist "natural" NP-complete problems?

    25

  • 7/25/2019 08IntractabilityII

    26/67

    CIRCUIT-SAT. Given a combinational circuit built from AND, OR, and NOTgates,

    is there a way to set the circuit inputs so that the output is 1?

    !

    ! "

    !

    "

    1 0 ? ? ?

    output

    variable inputshard-coded inputs

    yes: 1 0 1

    Circuit satisfiability

    26

  • 7/25/2019 08IntractabilityII

    27/67

    The "first" NP-complete problem

    Theorem. CIRCUIT-SAT!NP-complete. [Cook 1971, Levin 1973]

    27

    IX 1973 . 3

    519.14

    .

    ,

    , -

    .

    -

    , -

    , ,

    ). -

    .

    - , -

    . -

    : , ,

    .

    , . -

    ,

    . -

    1, 2

    ]) , -

    . , ,

    , .)

    , - -

    ) ,

    ) , , -

    -

    , .). -

    .

    f{n) g{n) ,

    f n) ^ g n)+2)*

    g n)