2

Consider a 3SAT instance with the following special locality property. Suppose there are n variables in the Boolean formula, and that they are numbered 1,2,3....n in such a way that each clause involves variables whose numbers are within +-10 of each other. Give a linear-time algorithm for solving such an instance of 3SAT.

I could not solve the problem but my intuition is that if we could map the problem in graph then may be solved but could not go much farther ..

2 Answers 2

4

This is a relatively straightforward dynamic programming problem. I'll describe a solution, ignoring the fairly straightforward indexing issues around either boundary.

After the m'th step we have the set of possible values for variables (m-10, m-9, ..., m+10) which could be solutions so far, each linked to a set of values for all previous variables that leads to solutions to equations 1..m.

For the m+1'th step we take each member of this possible solution set, ignore the m-10'th value, and consider each possibility for the m+11'th value. If the m+1'th equation is true, we add this to the next solution set, pointing to our history, only if that solution pattern has not already been added.

This lands us ready for the m+2nd step.

There are n steps required, each of which can have about 2 million possible cases to consider, so this is linear.

(Fun challenge. Modify this algorithm to not just find a solution, but to count how many solutions there are.)

Sign up to request clarification or add additional context in comments.

2 Comments

is it that each step we have to try with 20 variables which in turn means 2^20 possible cases to try with !!! am I right ?
As described it is actually 2^21 (don't forget 0). though you can actually ignore the m-10'th value to bring it back down to 2^20. It is a big constant, but it is a constant, and therefore does not change the big-O of the algorithm.
1

I think you can just brute force it in poly time. Divide the clause list into two pieces. Exhaustive search over variables which are on both sides of the split. There are at most 30 of them, so that's 2^30 = O(1) settings to try. Once those variables are set, you can recursively solve both sides, each one is an independent SAT instance with n/2 variables.

8 Comments

Can you please elaborate why it is constant number variable present in both side of the split.
suppose we have something like (x1 + x2'+ x3) | (x1' + x2 + x3) (x4'+ x5 + x6) | (x4 + x5' + x6) .......................... .......................... (x30 + x31' + x32) | (x30 + x31 + x32') Then each side of the split has more than 30 variables right !!!
I mean that there are no more than 30 variables which appear on both sides of the split.
Suppose I am trying to make an instance of the problem which have more than 30 variables which appear in both side of the split.Let us assume that the the left side <br/> (x1 + x2'+ x3) | (x1' + x2 + x3) <br/> (x4'+ x5 + x6) | (x4 + x5' + x6) <br/> .......................... <br /> .......................... <br /> (x30 + x31' + x32) | (x30 + x31 + x32') <br/> So each side of the split has more than 30 variable in common also obeying the condition imposed upon the clauses .. , may be I am not getting your point please point out my error in understanding. regards
I don't know why the break line is not working what I have tried to write is there is | is the split line So both side contain total 60 clauses we can increase it to any number.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.