Local Search for Satisfiability - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Local Search for Satisfiability

Description:

Logical formula in conjunctive normal form (AND of OR-clauses): (x1 or not(x2) ... 13. Metropolis Algorithm. Simulated Annealing: Gradually decrease T ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 14
Provided by: kevin354
Category:

less

Transcript and Presenter's Notes

Title: Local Search for Satisfiability


1
Local Search for Satisfiability
2
CNF Satisfiability Problem
  • Input. Logical formula in conjunctive normal form
    (AND of OR-clauses) (x1 or not(x2) or x3) and
    (x2 or x3 or not(x4)) and (not(x1) or x2 or x4)
  • Output. Satisfying boolean assignment
  • k-CNF SAT. Each OR-clause contains exactly k
    literals)
  • 3-CNF SAT. Each OR-clause contains exactly 3
    literals
  • All of these problems are NP-Complete.
  • Can randomized search help solve them?

3
Simple Random Walk for CNF Satisfiability
  • Simple Random Walk Start with a random truth
    assignment. Pick a random unsatisfied clause and
    flip the truth value of a random variable in that
    clause. Repeat until formula satisfied.
  • Simple Random Walk is good enough for 2-CNF
    formulas Solves any satisfiable instance in
    expected O(n2) time Papadimitriou 1991.
  • Simple Random Walk is bad for 3-CNF formulas
    Some satisfiable instances require exponential
    expected time Papadimitriou 1994. Also
    empirically bad on random 3-CNF formulas.

4
Local Search for Satisfiability
  • Construct a cost function for truth assignments
    that is minimized when the formula is satisfied.
  • Guess a truth assignment (e.g., at random).
  • Try to improve the guess by checking nearby
    truth assignments for one with lower cost
    (repeatedly).

5
(No Transcript)
6
Hill-climbing search
Thanks to Min-Yen Kan
  • Problem depending on initial state, can get
    stuck in local maxima

7
Local Search for CNF Satisfiability
  • cost function for truth assignments number of
    satisfied clauses
  • nearest truth assignments flip the value of
    one boolean variable
  • Example x1 1, x2 0, x3 0, x4 1 has cost
    2 for CNF formula
  • (x1 or not(x2) or x3) and (x2 or x3 or not(x4))
    and (not(x1) or x2 or x4).
  • Nearest truth assignments x1 0, x2 0, x3
    0, x4 1 has cost 2
  • x1
    1, x2 1, x3 0, x4 1 has cost 3
  • x1
    1, x2 0, x3 1, x4 1 has cost 3
  • x1
    1, x2 0, x3 0, x4 0 has cost 2

8
GSAT Algorithm (Selman et al. 1992)
  • GSAT(k-SAT formula with variables x_1, , x_n)
  • Repeat MAX-TRIES times (or until formula is
    satisfied)
  • Let A be a random boolean assignment for x_1,
    , x_n
  • Repeat MAX-FLIPS times (or until formula is
    satisfied)
  • For i 1 to n
  • Let Ni number of clauses satisfied
    by A if x_i value flipped
  • Let i be the index that maximizes Ni
  • Flip the value of x_i in A
  • NOTE The flip is made even if the best flip
    increases the number of unsatisfied clauses. If
    GSAT only makes improving steps, then it
    performs very poorly.

9
Iterative Repair
  • Unsatisfied clauses symptoms of a flaw in
    the truth assignment that needs to be repaired
  • Different from local search Every step repairs a
    flaw but might make the natural cost function
    worse.
  • Simple Random Walk is an example of Iterative
    Repair.

10
Iteraritive Repair WALKSAT (Selman et al. 1994)
  • WALKSAT(k-SAT formula with variables x_1, , x_n)
  • Repeat MAX-TRIES times (or until formula is
    satisfied)
  • Let A be a random boolean assignment for x_1,
    , x_n
  • Repeat MAX-FLIPS times (or until formula is
    satisfied)
  • Choose a random clause c that is not
    satisfied under assignment A
  • Choose a variable x in c (randomly or to
    max of sat clauses)
  • Flip the value of x in A
  • This Iterative Repair algorithm performs very
    well in practice.

11
Iterative Repair Novelty (McAllester et al. 1997)
  • Novelty(k-SAT formula with variables x_1, , x_n)
  • Repeat MAX-TRIES times (or until formula is
    satisfied)
  • Let A be a random boolean assignment for x_1,
    , x_n
  • Repeat MAX-FLIPS times (or until formula is
    satisfied)
  • Choose a random clause c that is not
    satisfied under assignment A
  • Choose a variable x in c greedily (to max
    of satisfied clauses)
  • If x was not the most recently flipped
    variable in clause c
  • then flip its value in A
  • If x was the most recently flipped
    variable in clause c
  • then with probability 1-p flip its
    value in A anyway
  • else flip the value in A of the
    second-best variable in c
  • This Iterative Repair algorithm performs well in
    practice.

12
Simulated Annealing for Satisfiability
  • Basic Simulated Annealing Algorithm(k-SAT
    formula)
  • Let temperature T Initial-Temperature
  • Let A be a random boolean assignment for x_1, ,
    x_n
  • For i 1 to MAX-STEPS do
  • Pick a random variable x
  • Let d change in the number of unsatisfied
    clauses if x flipped
  • If d lt 0, then flip x
  • If d gt 0, then flip x with probability e-d/T
  • Reduce the temperature T
  • The low-probability flips let you escape from a
    local minimum. Its easier to escape early on
    when the temperature is higher.

13
Metropolis Algorithm
Simulated Annealing Gradually decrease T
Write a Comment
User Comments (0)
About PowerShow.com