Title: Exploiting Structure in Symmetry Detection for CNF
1Exploiting Structure in Symmetry Detection for CNF
- Paul T. Darga, Mark H. Liffiton,
- Karem A. Sakallah, and Igor L. Markov
- The University of Michigan
2Structure in SAT
- Human-designed artifacts possess considerable
structure - Manifested in instances of Boolean satisfiability
(SAT) - Symmetry
- Some rearrangement of the components of the
design that preserves its structure - Sparsity
- Most design elements are directly related to only
a few other elements in the whole design - We can exploit this structure to speed up SAT
solving!
3Symmetry Breaking
- Shatter (Aloul et. al)
- Converts CNF formula to a colored undirected
graph (Crawford) - Uses nauty (McKay), a graph symmetry detection
tool, to find the symmetries present in the graph - Converts the symmetries back into additional
symmetry-breaking predicates (SBPs) - Appends the SBPs to the original formula
- The resulting formula is often much faster to
solve
??? (a'bc)(ab'c')(b'c)(a')
? (a'bc)(ab'c')(b'c)
(a'bc) (ab'c') (b'c)
(a'bc) (ab'c') (b'c)
(a,a')(b,c')(b',c)
4Symmetry Breaking
Sym
Total
Search
Sym
Benchmark
84.4
0.45
0.07
0.38
Hole-n
39.4
1.93
1.17
0.76
Urq
88.4
43.84
5.08
38.76
GRoute
93.9
3.45
0.21
3.24
FPGARoute
99.4
26.03
0.17
25.86
ChnlRoute
82.6
13.84
2.41
11.43
XOR
74.6
31.51
8.01
23.50
2pipe
- On all but the synthetic Urquhart instances,
symmetry detection with nauty dominates the run
time of the Shatter flow - Further improvements must come from improved
symmetry detection
5Outline
- Graph construction
- nauty "No Automorphisms, Yes?"
- Problem description
- Partition refinement
- The search tree
- saucy a new symmetry detection tool
- Algorithmic improvements exploiting structure
- Experimental results saucy run time
insignificant compared to SAT solver - Conclusions and future work
6Graph Construction for CNF
? C1C2C3 (a'bc)(ab'c')(b'c)
- Two vertices and one edge for each variable
- One vertex for each clause
- One edge for each literal in each clause
- Color literals and clauses differently
C1
c
b
a'
C3
b'
c'
a
C2
7Symmetry Detection Problem
- What precisely is a symmetry of a graph G?
- A symmetry is a permutation ? of the labels
assigned to vertices of G such that G? G - The set of all symmetries is denoted Aut(G)
C1
C2
C1
G? G
G? ? G
b
a'
c
b'
c'
a
c
b
a'
C3
C3
C3
a
b'
c'
c
b
a'
b'
c'
a
C2
C1
C2
- (a,a')(b,c')(b',c)(C1,C2)
8Symmetry Detection Problem
?
?
?
?
?
?
?
?
(1,2)
2134
?
1234
(1,4,3,2)
4123
(1,3,2)
3124
(1,2)(3,4)
2143
(3,4)
1243
(1,4,2)
4132
(1,3,4,2)
3142
(1,2,3)
2314
(2,3)
1324
(1,4,3)
4213
(1,3)
3214
(1,2,3,4)
2341
(2,3,4)
1342
(1,4)
4231
(1,3,4)
3241
(1,2,4,3)
2413
(2,4,3)
1423
(1,4,2,3)
4312
(1,3)(2,4)
3412
(1,2,4)
2431
(2,4)
1432
(1,4)(2,3)
4321
(1,3,2,4)
3421
- Problem there are n! possible labelings!
- Can we prune the search space?
9Partition Refinement
- We can rule out many candidate labelings
- Distinguish vertices that cannot possibly be
mapped into each other by any symmetry - Fast distinguishing method degree
- Select a color in the graph
- Compute the number of connections every vertex
has to that color - Distinguish vertices within colors based on that
count - Repeat until coloring stabilizes
- Refinement distinguished all vertices! This
graph has no symmetry besides the identity.
1
1
0
0
0
0
0
0
0
0
1
0
1
0
4
4
1
1
0
1
6
7
3
0
0
4
2
0
1
0
0
2
3
0
1
2
0
1
0
1
3
5
10Partition Refinement
- In a stable coloring
- vertices in different colors definitely cannot
map into each other in some symmetry of the graph - vertices in the same color may map into each
other (i.e. refinement is only an approximation)
C1
c
b
a'
C3
b'
c'
a
C2
11The Search Tree
? 035421
?
?0 ? ?1 (2,4)(3,5) ?2 (0,3)(1,2) ?3
(0,3,5)(1,2,4) ?4 (0,5,3)(1,4,2) ?5 (0,5)(1,4)
- Out of 6! 720 possible labelings, partition
refinement pruned away all but the six symmetries
of the graph
?1 (2,4)(3,5)
?3 (0,3,5)(1,2,4)
?0 ?
?5 (0,5)(1,4)
?2 (0,3)(1,2)
?4 (0,5,3)(1,4,2)
- Select a non-singleton color T (for target) and
generate T colorings, each with one element of
T artificially distinguished from the remainder
of T - Discrete colorings (leaf nodes) yield likely
symmetries
12Pruning Using Generators
- Too many symmetries Aut(G) is O(n!)
- Group theory provides the answer generators
- Irredundant set H ? Aut(G) implicitly
representsentire set of symmetries - Exponential compression H ? log2Aut(G)
- We prune away subtrees guaranteed to yield
symmetries that we can already generate with
previously discovered symmetries
13saucy Exploiting Structure
- nauty works very well on small graphs (and thus
small formulas) but fails to scale - Takes considerably longer than the SAT solver
after adding SBPs to the CNF formula - Runs out of memory on formulas with corresponding
graphs having gt50,000 vertices - saucy improvement 1 sparse representation
- saucy improvement 2 use knowledge of graph
construction - Clause vertices only connected to their literals
- Never connected to each other
14saucy Algorithmic Improvements
- nauty
- Iterate over all colors
- For each vertex, count connections to refining
color, and sort - saucy improvement 3
- Determine directly connected colors
- For each vertex, count connections to refining
color, and sort - saucy improvement 4
- For each vertex in refining color, count
connections - For every color touched, sort the counts
15saucy Asymptotic Performance
- Partition refinement
- nauty implementation O(n3)
- saucy improvement 4 O(n2 log n)
- Search tree size
- Worst case exponential
- No bad leaves O(n3)
- In practice O(n)
- Complete algorithm
- Worst case exponential
- No bad leaves O(n5 log n)
- Much lower in practice
16saucy Empirical Performance
17saucy Empirical Performance
18Conclusions and Future Work
- CNF formulas from EDA applications exhibit
considerable structure (symmetry and sparsity) - saucy, a new implementation of the nauty
symmetry-detection system - Exploits structure to improve symmetry detection
performance by several orders of magnitude - Symmetry-detection time insignificant compared to
SAT solver - Future work
- Apply saucy to more sparse domains which may
benefit from symmetry detection - Find other applications of partition refinementa
surprisingly general framework for distinguishing
objects in a finite domain
19Thank You!
20saucy Exploiting Structure
- Graphs from typical CNF formulas possess a
particular structure - By construction, clauses are never connected to
other clauses - Thus, when refining the partition with a color of
clauses, we can ignore all colors containing
clauses, since we know that the connection count
for every vertex will be zero - Such graphs are also very sparse
- Few literals are connected to most clauses
- Few clauses are connected to most literals
- Thus, we aggressively avoid work by maintaining
data structures (like adjacency lists) which
explicitly direct the search and refinement
procedures
21saucy Exploiting Structure
1
1
1
1
1
1
1
1
1
1
1
1
22saucy example Hole-3
23saucy Exploiting Structure
- We can generalize this idea of avoiding obviously
disconnected colors - saucy improvement 3
- Iterate over a color's adjacency lists to
determine connected colors - Compute connection counts only for those colors
24saucy example Hole-3
- nauty
- Iterate over all colors
- For each vertex, count connections to refining
color, and sort - saucy improvement 3
- Determine directly connected colors
- For each vertex, count connections to refining
color, and sort - saucy improvement 4
- For each vertex in refining color, count
connections - For every color touched, sort the counts
25saucy Exploiting Structure
- nauty works very well on small graphs (and thus
small formulas) but fails to scale - Takes considerably longer than the SAT solver
after adding SBPs - Runs out of memory on formulas with corresponding
graphs having gt50,000 vertices - saucy improvement 1 sparse representation
- Input graph is represented in adjacency-list
format
26saucy Exploiting Structure
- Graphs from CNF formulas possess a particular
structure - Clause vertices only connected to their literals
- Never connected to each other
- saucy improvement 2 ignore colors containing
clauses when refining with clauses - We know that the connection count for every
vertex will be zero
27Symmetry Detection Problem
- What precisely is a symmetry of a graph G?
- A symmetry is a permutation ? of the labels
assigned to vertices of G such that G? G - The set of all symmetries is denoted Aut(G)
G? G
G? ? G
- (a,a')(b,c')(b',c)(C1,C2)
28The Search Tree
- We have a stable ordered partition ? of the
vertices of the graph. How can we extract
Aut(G)? - Recall the naïve approach we need labelings
(i.e. discrete colorings) - We select a non-singleton color T (for target)
and generate T colorings, each with one element
of T individualized "in front of" the remainder
of T - Partitions the set of all discrete colorings
descendant from ? - We can then recursively apply partition
refinement to further prune the search space! - Fix the first discrete coloring found as ? the
remaining discrete colorings yield likely
candidates for Aut(G)
29The Search Tree
0
1
2
4
3
5
? 035421
- Out of 6! 720 possible labelings, partition
refinement pruned away 714, leaving the six
symmetries of the graph - Discrete colorings do not necessarily yield
symmetries - Refinement is only an approximation
- Only occurs on highly regular graphs, which are
uncommon in EDA applications
?
?1 (2,4)(3,5)
?3 (0,3,5)(1,2,4)
?0 ?
?5 (0,5)(1,4)
?2 (0,3)(1,2)
?4 (0,5,3)(1,4,2)
30saucy Empirical Performance
31(No Transcript)
32saucy Empirical Performance
33saucy Empirical Performance
34saucy Runtime Performance
- Speedup is roughly linear in the number of
vertices - Primarily due to efficient use of sparsity within
the partition refinement procedure - Search tree maintenance has relatively low
overhead
- We ran saucy and nauty on the complement graphs
- Isomorphic search trees!
- Isolate performance difference in refinement
- Slowdown is roughly linear, which is expected
given difference in representation
35Ordered Partitions
- The partition refinement algorithm based on
degree operates independently of the labeling of
the graph - To guarantee identical partition representations
for isomorphic graphs, we impose an ordering on
the colors in the partition - When a color is split, the new colors are
assigned in sorted order of degree with the
refining color - Refining colors are chosen based on position
within the partition ordering, not based on label - The search algorithm absolutely the refinement
procedure to be labeling-independent!
36Partition Refinement
- In a stable coloring
- vertices in different colors definitely cannot
map into each other in some symmetry of the graph - vertices in the same color may map into each
other (i.e. refinement is only an approximation)
C1
- Refinement can't distinguish any vertices (all
have degree two) - Vertices in the triangle and square cannot map
into each other - Fortunately, this rarely happens with EDA
instances - An exact, polynomial time partition refinement
algorithm would prove that the graph isomorphism
problem is in P
c
b
a'
C3
b'
c'
a
C2
37Additional Pruning Methods
- Enumerating all symmetries is not an option
- Aut(G) is O(n!)
- Many EDA-related instances possess exponentially
many symmetries - Group theory provides the answer generators
- Find a set H ? Aut(G) that implicitly represents
the entire set of symmetries - Every element of Aut(G) is a product
(composition) of integer powers of elements of H - Exponential compression H ? log2Aut(G)
- We prune away subtrees guaranteed to yield
symmetries that we can already generate with
previously discovered symmetries
38Symmetry Breaking
- On all but the synthetic Urquhart instances,
symmetry detection with nauty dominates the run
time of the Shatter flow - Further improvements must come from improved
symmetry detection