Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 1.09 KB

WalkSAT.md

File metadata and controls

18 lines (15 loc) · 1.09 KB

WALKSAT

AIMA3e

function WALKSAT(clauses, p, max_flips) returns a satisfying model or failure
inputs: clauses, a set of clauses in propositional logic
    p, the probability of choosing to do a "random walk" move, typically around 0.5
    max_flips, number of flips allowed before giving up

model ← a random assignment of true/false to the symbols in clauses
for i = 1 to max_flips do
   if model satisfies clauses then return model
   clause ← a randomly selected clause from clauses that is false in model
   with probability p flip the value in model of a randomly selected symbol from clause
   else flip whichever symbol in clause maximizes the number of satisfied clauses
return failure


Figure ?? The WALKSAT algorithm for checking satisfiability by randomly flipping the values of variables. Many versions of the algorithm exist.