Sunteți pe pagina 1din 2

COMP3620 Assignment 2: Propositional Satisability

The task of this assignment is to implement a solver for propositional satisability problems (SAT) and to analyse its performance for dierent randomly generated problem instances. As a random generator of propositional satisability 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 following 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: nal 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 variables and 425 clauses of length 3. Each instance is written to a separate le 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 rst 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 le. Each clause is presented in separate line and ended with a zero (0).

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 xed number of variables (choose the number according to the speed of your computer) and modify the number of clauses in order to nd the phase transition. Generate 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 termination, pure symbol heuristic and unit clause heuristic. Solve the same random instances by using four dierent modications of the DPLL algorithm. Three of the modications do not use one of the strategies, the fourth modication changes the order of the pure sumbol and the early termination heuristic. Describe the eect of these modications 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 algorithm 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 dierent 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 x 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 lecture slides/textbook so that it can solve sentences in CNF as generated by the ggens program. Compare its performance for three dierent 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.

S-ar putea să vă placă și