UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2006 - PowerPoint PPT Presentation

Loading...

PPT – UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2006 PowerPoint presentation | free to download - id: 5e49b9-MjFiO



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2006

Description:

Title: COMP 150 Author: Murray Daniels Last modified by: XX Created Date: 1/8/2000 8:31:54 PM Document presentation format: On-screen Show Company – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 52
Provided by: MurrayD2
Learn more at: http://www.cs.uml.edu
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2006


1
UMass Lowell Computer Science 91.503 Analysis
of Algorithms Prof. Karen Daniels Fall, 2006
  • Lecture 6
  • Wednesday, 10/11/06
  • NP-Completeness

2
Overview
  • NP-Completeness, Part 1
  • Graham videotape
  • Review Reduction to Establish Lower Bounds
  • Basics
  • NP-Completeness, Part 2
  • More basics
  • How to Treat NP- Hard or Complete Problems

3
Resources
  • Recommended
  • Computers Intractability
  • by Garey Johnson
  • W.H.Freeman
  • 1990
  • ISBN 0716710455.

4
Motivation
5
Why do we care??
  • When faced with a problem in practice, need to
    know whether or not one can expect produce a
    fast algorithm (i.e. O(nk)) to solve it
  • Intractable problems occur frequently in
    practice
  • Surface differences between tractable and
    intractable problems are often hard to see
  • e.g. MST solvable in polynomial time but
    Dominating Set intractable

6
Dominating Set
source Garey Johnson
7
Industrial MotivationSupporting Apparel
Manufacturing
8
Covering Research Example Translational 2D
Covering CCCG01, CCCG03 conference papers
  • Input
  • Covering polygons Q Q1, Q2 , ... , Qm
  • Target polygons (or point-sets) P P1, P2 , ...
    , Pn
  • Output
  • Translations g g 1, g 2 , ... , g m such that

STATIC
NP-COMPLETE
9
Covering Problem Taxonomy
covering
non-geometric covering
geometric covering
VERTEX-COVER, SET-COVER, EDGE-COVER, VLSI logic
minimization, facility location
2D translational covering
P finite point sets
P shapes
Q identical
  • Thin coverings of the plane with congruent convex
    shapes
  • Translational covering of a convex set by a
    sequence of convex shapes
  • Translational covering of nonconvex set with
    nonidentical covering shapes

Q nonconvex
Q convex
1D interval covered by annuli
BOX-COVER
partition
  • NP-hard/complete polygon problems
  • polynomial-time results for restricted orthogonal
    polygon covering and horizontally convex polygons
  • approximation algorithms for boundary, corner
    covers of orthogonal polygons

Polynomial-time algorithms for triangulation and
some tilings
10
Reduction to Establish Lower Bound
  • Tightening a Lower Bound for Maximum-Area
    Axis-Parallel Rectangle Problem
  • from W(n) to W(nlgn)

11
Approach
  • Go around lower bound brick wall by
  • examining strong lower bounds for some similar
    problems
  • transforming a similar problem to the rectangle
    problem
  • this process is similar to what we do when we
    prove problems NP-complete

worst-case bounds on problem
n5
2n
1
n2
n log2 n
n
12
Lower Bound of W(n log n) by Transforming a
(seemingly unrelated) Problem
MAX-GAP instance given n real numbers x1, x2,
... xn find the maximum difference between 2
consecutive numbers in the sorted list.
O(n) time transformation
Rectangle area is a solution to the MAX-GAP
instance
specialized polygon
Rectangle algorithm must take as least as much
time as MAX-GAP. MAX-GAP is known to be in W(n
log n).
Rectangle algorithm must take W(n log n) time for
specialized polygons. Transforming yet another
different problem yields bound for unspecialized
polygons.
13
NP-Completeness
Chapter 34
14
Basic Concepts
  • Polynomial Time Problem Formalization
  • Polynomial-Time Verification
  • NP-Completeness Reducibility
  • NP-Completeness Proofs
  • Expanding List of Hard Problems via Reduction

15
Polynomial Time Problem Formalization
  • Formalize notions of abstract and concrete
    decision problems
  • Encoding a problem
  • Define class of polynomial-time solvable decision
    problems
  • Define complexity class
  • Express relationship between decision problems
    and algorithms that solve them using framework of
    formal language theory

16
Polynomial Time Problem Formalization
(continued)
  • Solvable in Polynomial Time
  • i.e. O(nk) for some positive constant k
  • Tractable k is typically small (e.g. 1, 2, 3)
  • Typically holds across sequential computation
    models
  • Closure properties (chaining/composition)
  • Abstract Problem
  • Binary relation on set of problem instances
    solutions
  • Decision Problem yes/no answer
  • impose bound on optimization problem to recast
  • e.g. Dominating Set

17
Dominating Set
source Garey Johnson
18
Polynomial Time Problem Formalization
(continued)
  • Encoding of set S of abstract objects is mapping
    e from S to set of binary strings
  • Concrete Problem instance set is set of binary
    strings
  • Concrete Problem is Polynomial-Time Solvable if
    there exists an algorithm to solve it in time
    O(nk) for some positive constant k
  • Complexity Class P set of polynomial-time
    solvable concrete decision problems
  • Given abstract decision problem Q that maps
    instance set I to 0,1 can induce a
    concrete decision problem e(Q)
  • If solution to abstract-problem instance
  • then solution to concrete-problem instance
    is also Q(i)

19
Polynomial Time Problem Formalization
(continued)
Goal Extend definition of polynomial-time
solvability from concrete to abstract using
encodings as bridge
  • is polynomial-time
    computable if there exists a polynomial-time
    algorithm A that, given any input
    , produces f(x) as output.
  • For set I of problem instances, encodings are
    polynomially related if there exist 2
    polynomial-time computable functions f12, f21
    such that
  • If 2 encodings e1, e2 of abstract problem are
    polynomially related, then polynomial-time
    solvability of problem is encoding-independent

20
Polynomial Time Problem Formalization
(continued)
  • Formal Language Framework
  • Alphabet S is finite set of symbols
  • Language L over S is any set of strings
    consisting of symbols from S
  • Set of instances for decision problem Q is
  • View Q as language L over S 0,1
  • Express relation between decision problems and
    algorithms
  • Algorithm A accepts string if,
    given input x, output A(x) is 1
  • Language accepted by A is set of strings A accepts

21
Polynomial Time Problem Formalization
(continued)
  • Formal Language Framework (continued)
  • Language L is decided by algorithm A if every
    binary string in L is accepted by A and every
    binary string not in L is rejected by A
  • Language L is accepted in polynomial time by
    algorithm A if it is accepted by A and if exists
    constant k such that, for any length-n string
    , A accepts x in time O(nk)
  • Language L is decided in polynomial time by
    algorithm A if exists constant k such that, for
    any length-n string , A
    correctly decides in time O(nk) if

22
Polynomial Time Problem Formalization
(continued)
  • Formal Language Framework (continued)
  • Complexity Class is a set of languages whose
    membership is determined by a complexity measure
    (i.e. running time) of algorithm that determines
    whether a given string belongs to a language.
  • We already defined Complexity Class P set of
    polynomial-time solvable concrete decision
    problems
  • Language Framework gives other definitions

P there exists an algorithm A that
decides L in polynomial time
L L is accepted by a polynomial-time algorithm
23
Polynomial-Time Verification
  • Examine algorithms that verify membership in
    languages
  • Define class of decision problems whose solutions
    can be verified in polynomial time

24
Polynomial-Time Verification (continued)
  • Verification Algorithms
  • algorithm A verifies language L if for any string
    certificate y that A
    can use to prove that
  • also, for any string certificate y that A can
    use to prove that
  • language verified by verification algorithm A is

25
Polynomial-Time Verification (continued)
  • The Complexity Class NP
  • languages that can be verified by a
    polynomial-time algorithm A
  • A verifies language L in polynomial time
  • The Complexity Class co-NP
  • set of languages L such that

26
Polynomial-Time Verification (continued)
P
P

P
34.3
source 91.503 textbook Cormen et al.
27
NP-Completeness Reducibility
  • Polynomial-Time Reducibility
  • Define complexity class of NP-complete problems
  • Relationships among complexity classes
  • Circuit satisfiability as an NP-complete problem

28
NP-Completeness Reducibility (continued)
  • Q can be reduced to Q if any instance of Q can
    be easily rephrased as an instance of Q, the
    solution to which provides solution to instance
    of Q
  • L1 is polynomial-time reducible to L2

    if exists polynomial-time computable function

34.4
source 91.503 textbook Cormen et al.
29
NP-Completeness Reducibility (continued)
34.5
34.3
source 91.503 textbook Cormen et al.
30
NP-Completeness Reducibility (continued)
Theorem - If any NP-complete problem is
polynomial-time solvable, then PNP. -
Equivalently, if any problem in NP is not
polynomial-time solvable, then no NP-complete
problem is polynomial-time solvable.
source 91.503 textbook Cormen et al.
31
Expanding List of Hard Problems via Reduction
  • Relationships among some NP-complete problems

Circuit-SAT
source Garey Johnson
source 91.503 textbook Cormen et al.
Need to show that starting problem is in NP
32
NP-Completeness Reducibility (continued)
Circuit Satisfiability
circuit inputs
  • Satisfying Assignment truth assignment inducing
    output 1
  • GOAL Show Circuit Satisfiability is NP-complete

Language Def CIRCUIT-SAT ltCgtC is a
satisfiable boolean combinational circuit.
34.8
33
NP-Completeness Reducibility (continued)
Circuit Satisfiability
  • CIRCUIT-SAT is in NP
  • Construct 2-input polynomial-time algorithm A
    that verifies CIRCUIT-SAT
  • Input 1 encoding of circuit C
  • Input 2 certificate assignment of boolean
    values to all wires of C
  • Algorithm A
  • For each logic gate A checks if certificate value
    for gates output wire correctly computes gates
    function based on input wire values
  • If output of entire circuit is 1, algorithm
    outputs 1
  • Otherwise, algorithm outputs 0
  • For satisfiable circuit, there is a
    (polynomial-length) certificate that causes A to
    output 1
  • For unsatisfiable circuit, no certificate can
    cause A to output 1
  • Algorithm A runs in polynomial time

source 91.503 textbook Cormen et al.
34
NP-Completeness Reducibility (continued)
Circuit Satisfiability
  • CIRCUIT-SAT is NP-hard
  • L represents some language in NP
  • Create polynomial-time algorithm F computing
    reduction function f that maps every binary
    string x to a circuit Cf(x) such that
  • Must exist algorithm A verifying L in polynomial
    time. (A from NP)
  • F uses A to compute f.
  • Represent computation of A as sequence of
    configurations
  • F constructs single circuit that computes all
    configurations produced by initial configuration

source 91.503 textbook Cormen et al.
35
NP-Completeness Proofs (continued)
  • Proving a Language NP-Complete
  • Proving a Language NP-Hard
  • all steps except (1)

source 91.503 textbook Cormen et al.
36
NP-Completeness Proofs (continued)
  • Reducing Boolean Circuit Satisfiability to
    Boolean Formula Satisfiability
  • Boolean Formula Satisfiability Instance of
    language SAT is a boolean formula f consisting
    of
  • n boolean variables x1, x2, ... , xn
  • m boolean connectives boolean function with 1 or
    2 inputs and 1 output
  • e.g. AND, OR, NOT, implication, iff
  • parentheses
  • truth, satisfying assignments notions apply

source 91.503 textbook Cormen et al.
37
NP-Completeness Proofs (continued)
  • Show SAT is NP-Complete
  • SAT is in NP via argument similar to circuit case
  • Reduce Boolean Circuit Satisfiability to Boolean
    Formula Satisfiability
  • Careful! Naive approach might have shared
    subformulas and cause formula size to grow
    exponentially!

source 91.503 textbook Cormen et al.
38
NP-Completeness Proofs (continued)
  • Show SAT is NP-Complete (continued)
  • Reduce Boolean Circuit Satisfiability to Boolean
    Formula Satisfiability (continued)
  • Approach For each wire xi in circuit C, formula
    f has variable xi. Express gate operation.

34.10
source 91.503 textbook Cormen et al.
39
NP-Completeness Proofs (continued)
  • Reducing Formula Satisfiability to
    3-CNF-Satisfiability
  • Boolean Formula Satisfiability Instance of
    language SAT is a boolean formula f
  • CNF conjunctive normal form
  • conjunction AND of clauses
  • clause OR of literal(s)
  • 3-CNF each clause has exactly 3 distinct
    literals
  • Show 3-CNF is NP-Complete

source 91.503 textbook Cormen et al.
40
NP-Completeness Proofs (continued)
  • Show 3-CNF is NP-Complete (continued)
  • 3CNF is in NP via argument similar to circuit
    case
  • Reduce Formula Satisfiability to
    3-CNF-Satisfiability
  • 3 steps progressively transforming formula f
    closer to 3CNF
  • 1) Similar to reduction

Binary ParseTree
34.11
source 91.503 textbook Cormen et al.
41
NP-Completeness Proofs (continued)
  • Show 3-CNF is NP-Complete (continued)
  • 3CNF is in NP via argument similar to circuit
    case
  • Reduce Formula Satisfiability to
    3-CNF-Satisfiability
  • 3 steps progressively transforming formula f
    closer to 3CNF
  • 2) Convert each clause fi into conjunctive
    normal form
  • construct truth table for fi
  • using entries for 0, build DNF formula for
  • convert DNF into CNF formula fi by applying
    DeMorgans laws
  • each clause has at most 3 literals

source 91.503 textbook Cormen et al.
42
NP-Completeness Proofs (continued)
  • Show 3-CNF is NP-Complete (continued)
  • 3CNF is in NP via argument similar to circuit
    case
  • Reduce Formula Satisfiability to
    3-CNF-Satisfiability
  • 3 steps progressively transforming formula f
    closer to 3CNF
  • 3) Convert each clause fi so it has exactly 3
    distinct literals
  • add padding variables
  • create fi
  • Size of resulting formula is polynomial in length
    of original formula and reduction takes only
    polynomial time and 3-CNF formula

source 91.503 textbook Cormen et al.
43
Expanding List of Hard Problems via Reduction
  • Relationships among some NP-complete problems

Circuit-SAT
source Garey Johnson
source 91.503 textbook Cormen et al.
44
Vertex Cover
A
B
vertex cover of size 2
Vertex Cover of an undirected graph G(V,E) is a
subset
F
45
Dominating Set
source Garey Johnson
46
Clique
Clique of an undirected graph G(V,E) is a
complete subgraph of G.
clique of size 3
source Garey Johnson
47
Hamiltonian Cycle
34.2
Hamiltonian Cycle of an undirected graph G(V,E)
is a simple cycle that contains each vertex in V.
source 91.503 textbook Cormen et al.
48
Reducing 3-CNF-SAT to Clique
source 91.503 textbook Cormen et al.
Construct graph G such that f is satisfiable iff
G has clique of size k
x1
x3
x1
x2
x2
34.14
49
Reducing Clique to VertexCover
Construct complement G (V, E ) of graph G such
that G has clique of size k iff graph G has a
vertex cover of size V-k.
34.15
source 91.503 textbook Cormen et al.
50
How to Treat
NP-Hard or Complete Problems
51
How to Treat NP-Complete Problems??
  • Approximation Algorithms
  • Heuristic Upper or Lower Bounds
  • Greedy, Simulated Annealing, Genetic Alg, AI
  • Mathematical Programming
  • Linear Programming for part of problem
  • Integer Programming
  • Quadratic Programming...
  • Search Space Exploration
  • Gradient Descent, Local Search, Pruning,
    Subdivision
  • Randomization, Derandomization
  • Leverage/Impose Problem Structure
  • Leverage Similar Problems
About PowerShow.com