This preview shows pages 1–3. Sign up to view the full content.
Sheet1
Page 1
GSAT Tracing
 
GSAT is a `greedy local search' procedure for satisfying
propositional formulae in CNF form.
You have been asked
to code the GSAT algorithm, and as a first step, you are
to code a variation of the core of this algorithm and
output a trace of its execution.
A propositional formula is a formula containing boolean
variables and the operators AND, OR, and NOT.
A propo
sitional formula is in `conjunctive normal form', or
CNF, if it has the syntax:
CNFformula ::= clause { AND clause }*
clause ::= ( literal { OR literal }* )
literal ::= variable  NOT variable
Thus if v1, v2, v3, .
.. are boolean variables, an exam
ple is
( v1 OR NOT v3 ) AND ( NOT v4 OR v5 OR v2 )
As a shorthand we will write such formula with the
following modifications:
A. We will omit OR's and AND's.
B. We will omit v's, representing variables by
integers.
C. We will replace NOT's by 's, negating the integer
representing a variable that is to be NOT'ed.
We
will omit space between the `' and its following
integer.
Thus the above example becomes:
( 1 3 ) ( 4 5 2 )
(
The goal of the GSAT algorithm is to find an assignment
of values (true or false) to variables so that the given
input CNF formula is satisfied (evaluates to true by the
rules of boolean algebra).
The core of the GSAT algorithm is:
1. Assign values (true or false) to all the variables
randomly.
2. If all clauses are satisfied (so the formula is
satisfied), stop.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentSheet1
Page 2
3. For each variable i, compute the number of clauses
N[i] that will be satisfied if just the value of
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '11
 k.v.arya

Click to edit the document details