Heuristics for Efficient SAT Solving - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Heuristics for Efficient SAT Solving

Description:

Given an undirected graph G(V,E) and a natural number k, is there an assignment color: ... xi,j = node i is assigned the color' j (1 i n, 1 j k) Constraints: ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 25
Provided by: ofer6
Category:

less

Transcript and Presenter's Notes

Title: Heuristics for Efficient SAT Solving


1
Heuristics forEfficient SAT Solving
  • As implemented in GRASP, Chaff and GSAT.

2
Formulation of famous problems as SAT k-Coloring
(1/2)
The K-Coloring problem Given an undirected graph
G(V,E) and a natural number k, is there an
assignment color
3
Formulation of famous problems as SAT k-Coloring
(2/2)
xi,j node i is assigned the color j (1 ? i ?
n, 1 ? j ? k) Constraints i) At least one color
to each node (x1,1 ? x1,2 ? x1,k ) ? ....
ii) At most one color to each node
iii) Coloring constraints
4
Formulation of famous problems as SATBounded
Model Checking (1/4)
Given a property p (e.g. always signal_a
signal_b) Is there a state reachable within k
cycles, which satisfies ?p ?
p
p
?p
p
p
. . .
s0
s1
s2
sk-1
sk
5
The reachable states in k steps are captured by
Formulation of famous problems as SATBounded
Model Checking (2/4)
The property p fails in one of the cycles 1..k
6
Formulation of famous problems as SATBounded
Model Checking (3/4)
The safety property p is valid up to cycle k iff
? is unsatisfiable
p
p
?p
p
p
. . .
s0
s1
s2
sk-1
sk
7
Example a two bit counter
Formulation of famous problems as SATBounded
Model Checking (4/4)
Initial state
Transition
Property always (?l ? ?r).
For k 2
For k 2, ? is unsatisfiabe. For k 4 ? is
satisfiable
8
A Basic SAT algorithm (1/3)
  • Given ? in CNF (x,y,z),(-x,y),(-y,z),(-x,-y,-z)

Decide()
Deduce()
Resolve_Conflict()
9
A Basic SAT algorithm (2/3)
Choose the next variable and value. Return False
if all variables are assigned
While (true) if (!Decide()) return (SAT)
while (!Deduce()) if (!Resolve_Conflict())
return (UNSAT)
Apply unit clause rule. Return False if reached
a conflict
Backtrack until no conflict. Return False if
impossible
10
A Basic SAT algorithm (3/3)
bool Resolve_Conflict() d most recent
decision not 'tried both ways if (d NULL)
return FALSE flip the value of d mark d as
'tried both ways undo invalidated
implications return true
11
Chaff enjoyed a profiler-based development
process.
A large set of CNF instances were used to
identify the bottleneck of classical SAT solving.
First conclusion almost 90 of the time SAT
solvers perform Deduction(). Second conclusion
dynamic decision strategies impose large
overhead.
Deduction() allocates new implied variables and
conflicts. How can this be done efficiently ?
12
Grasp implements Deduction() with counters (1/2)
Hold 4 counters for each clause ?
Val1_neg_literals(?) - of negative literals
assigned 0 in ?. Val1_pos_literals(?) - of
positive literals assigned 1 in ?.
Val0_neg_literals(?) - of negative literals
assigned 1 in ?. Val0_pos_literals(?) - of
positive literals assigned 0 in ?.
Define val1(?) Val1_pos_literals(?)
Val1_neg_literals(?) val0(?)
Val0_pos_literals(?) Val0_neg_literals(?) ?
literals in ?
13
Grasp implements Deduction() with counters (2/2)
? is satisfied iff val1(?) gt 0
? is unsatisfied iff val0(?) ?
? is unit iff val1(?) 0 ? val0(?) ? - 1
? is unresolved iff val1(?) 0 ? val0(?) lt ?
- 1 . .
Every assignment to a variable x results in
updating the counters for all the clauses that
contain x.
Backtracking Same complexity.
14
Chaff implements Deduction() with a pair of
observers (1/3)
Observation during Deduction(), we are only
interested in newly implied variables and
conflicts. These occur only when the number of
literals in ? with value false is greater than
? - 2. (val0(?) gt ? - 2)
Define two observers O1(?), O2(?). O1(?) and
O2(?) point to two distinct ? literals which are
not false. ? becomes unit if updating one
observer leads to O1(?) O2(?).
Chaff visits clause ? only if O1(?) or O2(?)
become false.
15
Chaff implements Deduction() with a pair of
observers (2/3)
Both observers of an implied clause are on the
highest decision level present in the clause.
Therefore, backtracking will un-assign them
first. Conclusion when backtracking, observers
stay in place.
Backtracking 0 complexity.
16
Chaff implements Deduction() with a pair of
observers (3/3)
The choice of observing literals is important.
Best strategy is - the least frequently updated
variables.
The observers method has a learning curve in this
respect 1. The initial observers are chosen
arbitrarily.
2. The process shifts the observers away from
variables that were recently updated. These
variables will most probably be reassigned in
a short time. In our example the next time v5
is updated, it will point to a significantly
smaller set of clauses.
17
A (rough) quantitative comparison
l literals, v vars, c clauses, d
decisions implied vars
clauses per var
Probability of observing
Negative assignments
Chaff
Avg. Length of clause
Several missing factors in the equations 1) the
complexity of each updating operation. 2) the
learning curve of the observers.
18
Decision heuristics (1/3)
Grasp's default (DLIS) - Choose the literal
which appears most frequently in unresolved
clauses. (Requires l queries for each decision).
19
Decision heuristics (2/3)
Chaffs default (VSIDS) - (Variable State
Independent Decaying Sum)
1. Each variable in each polarity has a counter
initialized to 0.
2. When a clause is added, the counters are
updated.
3. The unassigned variable with the highest
counter is chosen.
4. Periodically, all the counters are divided by
a constant.
  • Chaff holds a list of unassigned variables
    sorted by the counter value.
  • Updates are needed only when adding conflict
    clauses.
  • Thus - decision is made in constant time.

20
Decision heuristics (3/3)
VSIDS is a quasi-static strategy - static
because it doesnt depend on var state - dynamic
because it gradually changes. Variables that
appear in recent conflicts have higher
priority.
This strategy is a conflict-driven decision
strategy.
..employing this strategy dramatically (i.e. an
order of magnitude) improved performance ...
21
GSAT A different approach to SAT solving
Given a CNF formula ?, choose max_tries and
max_flips
for i 1 to max_tries T randomly
generated truth assignment for j 1 to
max_flips if T satisfies ? return TRUE
choose v s.t. flipping vs value gives largest
increase in the of satisfied
clauses (break ties randomly). T T with
vs assignment flipped.
22
Improvement 1 clause weights
Initial weight of each clause 1 Increase by k
the weight of unsatisfied clauses. Choose v
according to max increase in weight
Clause weights is another example of
conflict-driven decision strategy.
23
Improvement 2 Averaging-in
Q Can we reuse information gathered in previous
tries in order to speed up the search ?
A Yes! Rather than choosing T randomly each
time, repeat good assignments and choose
randomly the rest.
24
Improvement 2 Averaging-in (contd)
Let X1, X2 and X3 be equally wide bit vectors.
Define a function bit_average X1 ? X2 ? X3
as follows b1i b1i b2i
random otherwise (where bji is the i-th bit in
Xj, j ?1,2,3)
b3i
25
Improvement 2 Averaging-in (contd)
Let Tiinit be the initial assignment (T) in cycle
i. Let Tibest be the assignment with highest
of satisfied clauses in cycle i. T1init
random assignment. T2init random assignment.
?i gt 2, Tiinit bit_average(Ti-1best,
Ti-2best)
Write a Comment
User Comments (0)
About PowerShow.com