Sunteți pe pagina 1din 2

COMP3620 Assignment 2: Propositional Satisfiability

The task of this assignment is to implement a solver for propositional satis- fiability problems (SAT) and to analyse its performance for different randomly generated problem instances. As a random generator of propositional satisfiabil- ity instances in CNF, we provide the program ggensata.c which can be compiled using the command ’gcc ggensata.c -o ggens -O3’. The generator uses the fol- lowing input parameters:

ggens nb variables nb clauses clause length seeds start-1 seeds end

nb variables: number of variables, nb clauses: number of clauses, clause length: length of clauses, seeds start-1: initial seed for random number generator, seeds end: final seed for random number generator. The seed is incremented by one for each new sentence. Using the same seed generates the same random problem instances.

Example: ggens 100 425 3 0 10 generates 10 problem instances of 100 vari- ables and 425 clauses of length 3. Each instance is written to a separate file with name v100c425l3s1 to v100c425l3s10.

The output format of the generated instances is as follows:

c seed 1

i cnf 100 425

-99 -21 -29 0 (this is the first clause of the sentence) 100 -37 -62 0 -19 -34 50 0

97 33 -92 0

Line starting with ”c” is for comment line. Line starting with ”i” has information about number of variables and number of clauses in the CNF file. Each clause is presented in separate line and ended with a zero (0).

1

Question 1 (6 marks) Implement the DPLL algorithm given in the lecture slides/textbook so that it can solve sentences in CNF as generated by the ggens program.

Question 2 (4 marks) Use the ggens program to generate problem instances and solve them using your DPLL algorithm. Use a fixed number of vari- ables (choose the number according to the speed of your computer) and modify the number of clauses in order to find the phase transition. Gen- erate at least 20 random instances per clause/variable ratio. Give a table or graph that shows the phase transition you found and the runtime of your algorithm.

Question 3 (2 marks) How does the phase-transition and runtime depend on the length of the clauses?

Question 4 (4 marks) The DPLL algorithm uses three strategies: early ter- mination, pure symbol heuristic and unit clause heuristic. Solve the same random instances by using four different modifications of the DPLL al- gorithm. Three of the modifications do not use one of the strategies, the fourth modification changes the order of the pure sumbol and the early termination heuristic. Describe the effect of these modifications on the runtime of the algorithm. Note: generate random instances around the phase-transition region.

Question 5 (4 marks) It is likely that the performance of the DPLL algo- rithm depends on the order in which the symbols are processed, i.e., which symbol is selected as “P FIRST(symbols)” in the algorithm. Compare the performance for two different order criteria, one which you think is bad and one which you think is good. Explain why you think one order criterion is better than the other.

Note that for any given order criterion and any given instance, you can apply the criterion either in advance and fix the processing order for a given instance in advance (static order of symbols), or you can apply the criterion every time you select the next symbol (dynamic order of symbols).

Question 6 (5 marks) Implement the WalkSAT algorithm given in the lec- ture slides/textbook so that it can solve sentences in CNF as generated by the ggens program. Compare its performance for three different choices for the probability p.

Question 6 is for honours and masters students. Undergrads will be marked out of 20 (but can receive bonus points for answering question 6), Honours/Masters students will be marked out of 25.

2