1 / 13

Friday, April 2 nd Test # 2 Includes: Greedy Algorithms

Friday, April 2 nd Test # 2 Includes: Greedy Algorithms Nondeterministic algorithms, NP, NP-Completeness. Transformation :. Polynomial transformation. prob. npc. solution. NP-Complete. A problem npc is NP-complete if: npc is in NP

Download Presentation

Friday, April 2 nd Test # 2 Includes: Greedy Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Friday, April 2ndTest # 2 Includes: • Greedy Algorithms • Nondeterministic algorithms, NP, NP-Completeness

  2. Transformation: Polynomial transformation prob npc solution NP-Complete • A problem npc is NP-complete if: • npc is in NP • Every other problem prob in NP can be transformed in polynomial time into npc. (NP-Hard)

  3. TSP MST Shortest Path … Sorting Knapsack q npc How to Proof that a Problem is NP-Complete? • First problem was hard to proof: Conjunctive Normal Form (Cook, 1971) • Every problem q afterwards is “easier”: • Show that q is in NP • Find a problem, npc, that is NP-complete and show that npc can be transformed in polynomial time into q

  4. Example: A: Find a Maximum Spanning Tree of an input graph G B: Find a Minimum Spanning Tree of an input graph G A B Transformation from A into B: What Does this Thing “Polynomial Transformation” Means? A problem A can be transformed in polynomial time into a problem B if we can write a polynomial algorithm that transforms A into B such that when we solve B, we also solve A Multiply the weight of each edge in G by -1

  5. Conjunctive Normal Form A conjunctive normal form (CNF) is a Boolean expression consisting of one or more disjunctive formulas connected by an AND symbol (). A disjunctive formula is a collection of one or more (positive and negative) literals connected by an OR symbol (). Example: (a)  (¬ a  ¬b  c  d)  (¬c  ¬d)  (¬d) Problem (CNF-satisfaction): Give an algorithm that receives as input a CNF form and returns Boolean assignments for each literal in form such that form is true Example (above): a  true, b  false, c  true, d  false

  6. Cook Theorem (1971) The CNF-satisfaction satisfaction is NP-complete

  7. S1 S1 S2 S2 (Vague) Idea of The Proof (I) State1: S1 State2: S2 Computer Memory Program … <instruction> …. A computation: S1, S2, S3, …, Sm

  8. Sj Sj (Vague) Idea of The Proof (II) Statej Computer Memory Program … <instruction> …. Sj can be represented as a logic formula Fj The computation can be represented S1, S2, S3, …, Sm as (F1  F2  …  Fm), which is transformed into a CNF

  9. How can we know the minimum cost in advance? The Issue with the “Cheating” phaseII(C: path, min: int ) //input: C a guessed solution //output: true iff C is a TSP If |C| < n thenreturn false Visited  {} for i =1 to n do { (u,v) = C[i] if v in Visited then return false else Visited  Visited + {v} } return cost(C) = min • The concept of nondeterministic algorithms is not for solving actual problems. • This concept is useful for determine properties about the problems (e.g., NP-completeness) • When transforming problems into other problems we formulate problems as decision problems

  10. Is the element 3 in the array A[1..N]? Find the position of 3 in the array A[1..N] Decision Problems A decision problem is one that has a Yes or No answer Standard Formulation Decision Problem Formulation Is m the minimum number in the array A[1..N]? Find the minimum number in the array A[1..N] Is there a minimum spanning tree G of cost m? Find a minimum spanning tree for a graph G Is there a Traveling salesman solution for G of cost m? Find a Traveling Salesman Solution for a graph G Note that the nondeterministic algorithms return True or False

  11. x x  y y x x  y y x ¬x Circuit-sat (I) A Boolean combinatorial circuit consists of one or more Boolean components connected by wires such that there is one connected component (i.e., there are no separate parts) and the circuit has only one output. Boolean components:

  12. x y z Circuit-sat (II) Circuit-sat: Given a Boolean combinatorial circuit, find a Boolean assignment of the circuit’s input such that the output is true

  13. CNF Circuit-SAT Homework • Show that Circuit-sat is NP-complete • Show that Circuit-sat is in NP • Show that CNF can be polynomial transformed into Circuit-sat Consider the formulas: •  (¬a  ¬b  c  d)  (¬c  ¬d)  (¬d) (Section 010) • ( a  ¬b)  (c  ¬b)  (d  ¬b)  b (Section 011) • For which assignments is the formula true? • Draw the formula in an equivalent circuit • Explain in words how the transformation is done • Section 010: • Formulate the Hamiltonian circuit as a decision problem • show that Graph Coloring is in NP (pseudocode!) • Section 011: • Formulate Graph Coloring as a decision problem • Show that the Hamiltonian Circuit is in NP (pseudocode!)

More Related