CS 289, Spring 1999
Assignment 1: Satisfiability Algorithms




1. Prove by induction the assertion that every sentence of propositional logic has an equivalent CNF representation.

2. Define data structures for sentences of propositional logic, for sentences in CNF, and for models. (Hint: use integers for variables.) Write functions for (a) evaluating the truth of a propositional logic sentence in a model, and (b) converting a propositional logic sentence into your CNF representation.

3. Implement the DPLL algorithm as efficiently as possible.

4. Write a function for generating random 3-SAT problems with m clauses, such that each clause is constructed by selecting k variables at random (no duplicates) and negating each with 50% probability.

5. Run sufficient experiments to reproduce the graphs in Figure 1 of Cook and Mitchell (n = 50 variables), with the following modifications: use CPU time on the y-axis; show error bars for one standard deviation; and plot two runtime curves, one for satisfiable and one for unsatisfiable problems. Save the satisfiable problems for q.7. (Note that the graph shows median rather than average runtime. Why? How can you take advantage of this to speed up your experiments? Does the average curve look any different?) You may need to generate extra problems in the high and low satisfiability regions to reduce variance in your data.

6. Implement the WalkSAT algorithm described in Cook and Mitchell. (Note that the WalkSAT step is choosing a variable to flip from a single randomly selected clause, not from the whole set of variables as in GSAT.) Consider ways to make it efficient by incremental evaluation of the flip heuristic.

7. Rerun the experiments of q.5 using WalkSAT and plot the curves. Since WalkSAT does not terminate on unsatisfiable problems, run it just on the satisfiable problems. You may wish to experiment with using multiple restarts (as in GSAT).

8. Now try larger problems---larger n. Investigate what happens to the shape of the curve as n increases. You will need to think of a way to handle the fact that it may no longer be feasible to run DPLL to filter out unsatisfiable instances.