Exploiting Structure in Symmetry Detection for CNF

1 / 38

# Exploiting Structure in Symmetry Detection for CNF - PowerPoint PPT Presentation

Exploiting Structure in Symmetry Detection for CNF. Paul T. Darga, Mark H. Liffiton, Karem A. Sakallah, and Igor L. Markov The University of Michigan. Structure in SAT. Human-designed artifacts possess considerable structure Manifested in instances of Boolean satisfiability (SAT) Symmetry

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Exploiting Structure in Symmetry Detection for CNF' - thom

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Exploiting Structure in Symmetry Detection for CNF

Paul T. Darga, Mark H. Liffiton,

Karem A. Sakallah, and Igor L. Markov

The University of Michigan

Structure 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!
Symmetry 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'+b+c)(a+b'+c')(b'+c)(a')

= (a'+b+c)(a+b'+c')(b'+c)

(a'+b+c)

(a+b'+c')

(b'+c)

(a'+b+c)

(a+b'+c')

(b'+c)

(a,a')(b,c')(b',c)

Symmetry 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

Benchmark

Sym

Search

Total

% Sym

Hole-n

0.38

0.07

0.45

84.4

Urq

0.76

1.17

1.93

39.4

GRoute

38.76

5.08

43.84

88.4

FPGARoute

3.24

0.21

3.45

93.9

ChnlRoute

25.86

0.17

26.03

99.4

XOR

11.43

2.41

13.84

82.6

2pipe

23.50

8.01

31.51

74.6

Outline
• 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
Graph Construction for CNF
• 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

= C1C2C3 = (a'+b+c)(a+b'+c')(b'+c)

C1

a'

b

c

C3

a

b'

c'

C2

Symmetry 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

C1

C2

G = G

G G

c

a'

b

a'

b

c

a

c'

b'

C3

C3

C3

c'

a

b'

a

b'

c'

a'

c

b

C2

C2

C1

• = (a,b',c')(a',b,c)
• = (a,a')(b,c')(b',c)(C1,C2)

1

2

3

4

Symmetry Detection Problem

1234

2134

(1,2)

3124

(1,3,2)

4123

(1,4,3,2)

1243

(3,4)

2143

(1,2)(3,4)

3142

(1,3,4,2)

4132

(1,4,2)

1324

(2,3)

2314

(1,2,3)

3214

(1,3)

4213

(1,4,3)

1342

(2,3,4)

2341

(1,2,3,4)

3241

(1,3,4)

4231

(1,4)

1423

(2,4,3)

2413

(1,2,4,3)

3412

(1,3)(2,4)

4312

(1,4,2,3)

1432

(2,4)

2431

(1,2,4)

3421

(1,3,2,4)

4321

(1,4)(2,3)

• Problem: there are n! possible labelings!
• Can we prune the search space?
Partition 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

0

0

0

1

0

1

0

0

0

0

1

0

• 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.

0

1

1

0

4

1

4

1

6

7

0

3

0

4

0

2

0

0

1

2

3

0

1

0

1

2

1

0

5

3

1

2

3

4

5

6

7

Partition 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

a'

b

c

C3

a

b'

c'

C2

0

1

2

4

3

5

The 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

3 = (0,3,5)(1,2,4)

5 = (0,5)(1,4)

1 = (2,4)(3,5)

0 = 

4 = (0,5,3)(1,4,2)

2 = (0,3)(1,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
Pruning 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|  log2|Aut(G)|
• We prune away subtrees guaranteed to yield symmetries that we can already generate with previously discovered symmetries
saucy : 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 >50,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

Positive

0

0

Negative

Clauses

0

0

1

1

1

1

1

0

0

1

0

0

1

1

1

1

0

0

1

1

0

0

0

0

0

0

saucy : 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
saucy : Asymptotic Performance
• Partition refinement
• nauty implementation: O(n3)
• saucy improvement #4: O(n2 log n)
• Search tree size
• Worst case: exponential
• In practice: O(n)
• Complete algorithm
• Worst case: exponential
• No “bad leaves”: O(n5 log n)
• Much lower in practice
Conclusions 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 refinement—a surprisingly general framework for distinguishing objects in a finite domain
saucy : 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
saucy : 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

Positive

0

0

Negative

Clauses

0

0

1

1

1

1

1

0

0

1

0

0

1

1

1

1

0

0

1

1

0

0

0

0

0

0

saucy 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
saucy : 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 >50,000 vertices
• saucy improvement #1: sparse representation
• Input graph is represented in adjacency-list format
saucy : 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

C1

C1

C2

c

a'

b

a'

b

c

a

c'

b'

C3

C3

c'

a

b'

C3

a

b'

c'

a'

c

b

C2

C2

C1

Symmetry 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,c',b')(a',c,b)
• = (a,a')(b,c')(b',c)(C1,C2)
The 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)
The 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

 =

3 = (0,3,5)(1,2,4)

5 = (0,5)(1,4)

1 = (2,4)(3,5)

0 = 

4 = (0,5,3)(1,4,2)

2 = (0,3)(1,2)

saucy : 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
Ordered 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!

1

2

3

4

5

6

7

Partition 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

a'

b

c

C3

a

b'

c'

C2