CIS 671: Programming Assignment No.2

Sameer Shende Matthew Giger Junying Wang Saikiran Sheth

October 20, 1995

1. Overview

In this assignment we are trying to solve the 3-SAT problem in propositional logic. We are using various different methods to solve a variety of problems of this type. The problems range in size and complexity from large and complex to fairly simple. We use ordering of variables by number of clauses that they are in to choose the variables that will have the most effect upon the unsatisfied clauses. The variables are chosen and tried out and if a conflict occurs, we back out of that choice for a variable. This solution is a much better way to solve this than just choosing random variables to assign. Another method that we used was arc-consistency to remove clauses from the list of clauses when their value was forced by the choice of another variable. This in turn may force other variables to be selected. The routine is called until there are no more variables being set. This method showed improvement above the random method also, but the extra processing needed to check the arc-consistency didn’t benefit us until the clauses were very large and comples. We then combined the variable ordering with the arc-consistency propagation routine. This produced pretty good results for large and complex problems but was slower than the others for small problems.

2. Software

The source code is located in the directory /home/grads/sameer/cis671/p2/ The files are as follows :

• csp-3sat.sch - The basic program for backtracking algorithm. Part 1.

• score.sch - The score-variables program. Part 2 (a).

• order.sch - The order-unassigned-state program. Part 2 (b).

• var-sel.sch - The variables-selection program integrated with backtracking. Part 2(c).

• propagate.sch - The propagate program. Part 3.

• csp-prop.sch - The propagate integrated with backtracking. Part 3.

• var-prop.sch - The variable-selection, propagation program. Part 4.

• gensat.sch - The test case generator file. Part 5.

The data and script files can be found in the same directory too. Several 3-sat test case files were generated and used to test the four programs. The naming convention is 3sat-10clause-10var where it tests the backtrack-3sat problem with 10 clauses and 10 variables. The testing result for part1 is stored in part1.script. The part 2’s testing result is stored in part2.script. The test cases for the four programs are stored in test.data.