Satisfiability - Data Structures and Algorithm - Lecture Slides, Slides of Data Structures and Algorithms

Some concept of Data Structures and Algorithm are Permutation, Representation, Implemented, Algorithm Design, Dynamic Programming, Graph Data Structures, String Processing, General Trees. Main points of this lecture are: Satisfiability, Subroutine, Decision Problem, Salesman, Traveling, Efficient Algorithm, Calls, Polynomial Number, Instance, Answers

Typology: Slides

2012/2013

Uploaded on 04/27/2013

shareeka_555
shareeka_555 🇮🇳

4

(6)

74 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Satisfiabilit
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Satisfiability - Data Structures and Algorithm - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Satisfiabilit

Problem of the Day

Suppose we are given a subroutine which can solve the traveling salesman decision problem in, say, linear time. Give an efficient algorithm to find the actual TSP tour by making a polynomial number of calls to this subroutine.

What Does this Imply?

Now suppose my reduction translates G to Y in O(P (n)):

  1. If my Bo-billy subroutine ran in O(P ′(n)) I can solve the Bandersnatch problem in O(P (n) + P ′(n′))
  2. If I know that Ω(P ′(n)) is a lower-bound to compute Bandersnatch, then Ω(P ′(n) − P (n′)) must be a lower- bound to compute Bo-billy.

The second argument is the idea we use to prove problems hard!

Satisfiabilit

Consider the following logic problem: Instance: A set V of variables and a set of clauses C over V. Question: Does there exist a satisfying truth assignment for C? Example 1: V = v 1 , v 2 and C = {{v 1 , v 2 }, {v 1 , v 2 }} A clause is satisfied when at least one literal in it is TRUE. C is satisfied when v 1 = v 2 =TRUE.

Satisfiabilit is Hard

Satisfiability is known/assumed to be a hard problem. Every top-notch algorithm expert in the world has tried and failed to come up with a fast algorithm to test whether a given set of clauses is satisfiable. Further, many strange and impossible-to-believe things have been shown to be true if someone in fact did find a fast satisfiability algorithm.

3-Satisfiabilit

Instance: A collection of clause C where each clause contains exactly 3 literals, boolean variable v. Question: Is there a truth assignment to v so that each clause is satisfied? Note that this is a more restricted problem than SAT. If 3 -SAT is NP-complete, it implies SAT is NP-complete but not visa- versa, perhaps long clauses are what makes SAT difficult?! After all, 1 -Sat is trivial!

  • If k = 2, meaning {z 1 , z 2 }, create one new variable v 1 and two new clauses: {v 1 , z 1 , z 2 }, {v 1 , z 1 , z 2 }
  • If k = 3 , meaning {z 1 , z 2 , z 3 }, copy into the 3 -SAT instance as it is.
  • If k > 3 , meaning {z 1 , z 2 , ..., zn}, create n − 3 new variables and n − 2 new clauses in a chain: {vi, zi, vi}, ...

Why does the Chain Work?

If none of the original variables in a clause are TRUE, there is no way to satisfy all of them using the additional variable:

(F, F, T ), (F, F, T ),... , (F, F, F )

But if any literal is TRUE, we have n − 3 free variables and n − 3 remaining 3 -clauses, so we can satisfy each of them. (F, F, T ), (F, F, T ),... , (F, T, F),... , (T, F, F ), (T, F, F ) Any SAT solution will also satisfy the 3 -SAT instance and any 3 -SAT solution sets variables giving a SAT solution, so the problems are equivallent.

A Perpetual Point of Confusion

Note carefully the direction of the reduction. We must transform every instance of a known NP-complete problem to an instance of the problem we are interested in. If we do the reduction the other way, all we get is a slow way to solve x, by using a subroutine which probably will take exponential time. This always is confusing at first - it seems bass-ackwards. Make sure you understand the direction of reduction now - and think back to this when you get confused.

Vertex Cover

Instance: A graph G = (V, E), and integer k ≤ V Question: Is there a subset of at most k vertices such that every e ∈ E has at least one vertex in the subset?

Here, four of the eight vertices suffice to cover. It is trivial to find a vertex cover of a graph – just take all the vertices. The tricky part is to cover with as small a set as possible. Docsity.com

Clause Gadgets

For each clause, we create three new vertices, one for each literal in each clause. Connect these in a triangle. At least two vertices per triangle must be in the cover to take care of edges in the triangle, for a total of at least 2 C vertices. Finally, we will connect each literal in the flat structure to the corresponding vertices in the triangles which share the same literal. v1 v1 v2 v2 v3 v3 v4 v

v3 v

v1 v4 v1 v

Claim: G has a vertex cover of size N + 2C iff S

is Satisfiabl

Any cover of G must have at least N + 2C vertices. To show that our reduction is correct, we must show that:

  1. Every satisfying truth assignment gives a cover. Select the N vertices cooresponding to the TRUE literals to be in the cover. Since it is a satisfying truth assignment, at least one of the three cross edges associated with each clause must already be covered - pick the other two vertices to complete the cover.

Example Reduction

Every SAT defines a cover and Every Cover Truth values for the SAT! Example: V 1 = V 2 = T rue, V 3 = V 4 = F alse.

v1 v1 v2 v2 v3 v3 v4 v

v3 v

v1 v4 v1 v

Starting from the Right Problem

As you can see, the reductions can be very clever and very complicated. While theoretically any N P -complete problem can be reduced to any other one, choosing the correct one makes finding a reduction much easier.

3 − Sat ∝ V C

As you can see, the reductions can be very clever and complicated. While theoretically any NP-complete problem will do, choosing the correct one can make it much easier.