In this assignment, you will construct a solver for Boolean Satisfiability problems using the Davis-Putnam algorithm. Recall from class that the Davis-Putnam algorithm is a simple depth-first search of the ``binding space'' of variables in a propositional logic formula.
Given a propositional logic formula in CNF, that is, a conjunction of disjunctive clauses such as
(x or y or not z) and (not x or y or not z) and (not y or z) and (not x)the Davis-Putnam algorithm finds a satisfying assignment, a binding of each variable in the formula to true or false, such that the whole formula is true. The algorithm proceeds as follows:
Your program may be written in the language of your choice. (Let me know if you're planning on something other than C, C++, or Java), but should compile and run on the department UNIX machines. The input to the program will be as follows:
p cnf 3 4 1 2 -3 -1 2 -3 -2 3 -1If the input is unsatisfiable, the output will be a line of the form "s cnf 0" followed by the number of variables and number of clauses. Otherwise, the output will be a satisfying assignment, consisting of
s cnf 1 3 4 -1 2 3Only one satisfying assignment should be produced. Note that this input/output format is the DIMACS CNF format described in detail in a DIMACS Satisfiability Suggested Format document. No more than 10000 clauses or variables need be accepted.
BONUS: Convert the formulae of your previous assignment to propositions in CNF, and then feed it to your solver. What do you get?
BONUS: What techniques can you use to speed up the solver?
Homework should be submitted by e-mail to <cs541@cs.pdx.edu>. The words "CS441/541 HW2" should appear somewhere in the subject line. The homework submission should be a computer program giving the requested input-to-output mapping. It will be manually scanned for readability and approach, then automatically graded by validating it against a set of reasonable test cases. Remember, if I can't understand your submission, I can't give you credit for it.