multi-domain logic and its applications to sat implementation issues tudor jebelean, johannes kepler...
TRANSCRIPT
Multi-Domain Logic and its Multi-Domain Logic and its Applications to SATApplications to SATImplementation IssuesImplementation Issues
Tudor Jebelean, Johannes Kepler Unversity LinzGábor Kusper, Eszterházy Károly College Eger
SYNASC 2008
OutlineOutline
History Implementation issues
– Data structure: Spare literal matrix with pointers– Branching: Propagate as much information as possible!
Clustering– Test results
Deletion of Weaker Assignments– Test results
Future work
HistoryHistory
Philosophy: Propagate as much information as possible at once!
Gábor Kusper: Investigation of Binary Representations of SAT especially 2-Literal Representation.Proceedings of CSCS-2002, 2002.
Gábor Kusper: Solving the Resolution-Free SAT Problem by Hyper-Unit Propagation in Linear Time.Annals of Mathematics and Artificial Intelligence 43, 129-136, 2005.
Gábor Kusper: Solving and Simplifying the Propositional Satisability Problem by Sub-Model Propagation. PhD thesis. Johannes Kepler University Linz, RISC, 2005.
Gábor Kusper, Lajos Csőke: Better Test Results for the Graph Coloring and the Pigeonhole Problems using DPLL with k-Literal Representation. Proceedings of ICAI-2007, Volume II. 127-135, 2007.
Literal in Multi-Domain LogicLiteral in Multi-Domain Logic
A literal is the set of the Boolean assignments which make the function true.
The representation:{} FALSE {0} a {1} a {0,1} TRUE
{ } FALSE {00} ab {11} ab {00,11} ab{10} ab {00,10} b {10,11} a {00,10,11} ab {01} ab {00,01} a {01,11} b {00,01,11} ab {01,10} ab {00,01,10} ab {01,10,11} ab {00,01,10,11} TRUE
a b0 1 00 0 11 0 01 1 1
Literal RepresentationLiteral Representation
Note that we need 2k bits. The representation:
00 FALSE 10 a 01 a 11 TRUE
0000 FALSE 1000 ab 0001 ab 1001 ab 0010 ab 1010 b 0011 a 1011 ab 0100 ab 1100 a 0101 b 1101 ab 0110 ab 1110 ab 0111 ab 1111 TRUE
a b0 1 00 0 11 0 01 1 1
Literal RepresentationLiteral Representation
A literal is represented as an integer array.
This allows us to use bitwise operations: Intersection bitwise and (&) Union bitwise or (|)
Based on these fast methods we can implement– Unit Propagation– Deletion of Weak Assignments
Unit Propagation on Literal LevelUnit Propagation on Literal Level
Up to 5 prop. variables / multi-variablewe can represent a literal by 1 integer (32 bits).
In this case we need only 3 elementary operations:– public void unitPropagation(int unit) {
bits &= unit;if ( bits == unit ) { subsumed =
true; }}
Unit Propagation on Literal LevelUnit Propagation on Literal Level
In general a literal is an integer array. Then we need O(3 * 2k / 32) elementary operations: public void unitPropagation(Literal unit) {
intersection(unit);if (equals(unit)) { subsumed = true; }
}
public void intersection(Literal lit) {int[] input = lit.getBits();
for (int i=0; i<bits.length; i++) { bits[i] &= input[i]; }}
public boolean equals(Literal lit) {boolean isEqu = true; int[] input = lit.getBits();
for (int i=0; i<bits.length; i++) { if (bits[i] != input[i]) { isEqu = false; break; } }return isEqu;
}
Details of the implementationDetails of the implementation
Data structure: Spare literal matrix with pointers
Branching: Propagate as much information as possible!
Data structureData structure
Spare literal matrix with pointers Example: ( a ¬b ) (¬a c ) (¬a ¬c )
01 10
10 01
10 10
1011
1100 0011
1100 1100
Multi-var_1 … 2 var. / multi-var:
11 10 11 1011 1111Domains:
Clause_1
Clause_2…
Literal Representation, Once moreLiteral Representation, Once more
Note that we need 2k bits. The representation:
00 FALSE 10 a 01 a 11 TRUE
0000 FALSE 1000 ab 0001 ab 1001 ab 0010 ab 1010 b 0011 a 1011 ab 0100 ab 1100 a 0101 b 1101 ab 0110 ab 1110 ab 0111 ab 1111 TRUE
a b0 1 00 0 11 0 01 1 1
Granularity of Unit PropagationGranularity of Unit Propagation
A unit has exactly one literal, which is an integer array (with k = 2^number of prop. var / multi-var bits).
With this representation we may propagate:1, 2, …, k-1 bits at once
Most coarse grained UP (lot of information): 1 bit … Normal UP (half of the information): k/2 bits … Most fine grained UP (very little information): k-1 bits
We may mix kind of UPs when we branch!
Propagate as much as possiblePropagate as much as possible
Use always the most coarse grained UP for branching, i.e., propagate as much information as you can!
00011000
0010
1011
1100 0011
1100 1100
Test resultsTest results
We tested our Java implementation on unsatisfiable SAT problems from the SATLIB page:http://www.cs.ubc.ca/~hoos/SATLIB/
What is the value of Multi-Domain Logic?What is the value of Multi-Domain Logic?
Multi-Domain Logic brings new ideas, which result in new simplification techniques:– Clustering– Deletion of Weak Assignments– Variable merging
We implemented DPLL using Multi-Domain Logic to judge these techniques.
ClusteringClustering
Clustering is a method which shuffles the propositional variables in order to have more multi-variable units at the beginning of the search.
Search SpaceSearch Space
BRANCHINGBRANCHING
UNIT PROPAGATIONUNIT PROPAGATION
Early UNIT Early UNIT PROPAGATIONSPROPAGATIONS
small search space! small search space!
Does Multi-Domain Logic allow early units?Does Multi-Domain Logic allow early units?
YES! Do this:– Take the shortest clause.– Merge its variables.– Now it is a unit!
BUT! – The number of bits grows exponential by
increasing the number of merged Boolean variables!
The solution!– Cluster the input clause set before the search
starts!
Clustering uuf50-010.cnf, rate = 7Clustering uuf50-010.cnf, rate = 7
Before clustering:
34 28 4 0 %TERNARY -43 -19 48 0 %BINARY 12 6 33 0 %TERNARY 22 21 10 0 %TERNARY 11 -5 48 0 %TERNARY -24 -29 49 0 %BINARY -45 26 -35 0 %TERNARY -49 -14 -37 0 %TERNARY 3 48 8 0 %TERNARY 20 -23 26 0 %BINARY…
After clustering:
33 37 29 0 %BINARY -34 -30 13 0 %BINARY 16 2 19 0 %BINARY 18 51 3 0 %TERNARY 45 -44 13 0 %BINARY -31 -38 35 0 %BINARY -49 53 -55 0 %BINARY -35 -17 -56 0 %TERNARY 8 13 9 0 %UNIT 4 -52 53 0 %BINARY…
Borders are at: 1, 8, 15, 22, 29, 36, 43, 50, 57, …
Test Result, ClusteringTest Result, Clustering
UUF050: Unsatisfiable Uniform Random-3-SATProblems with 50 propositional variables
Average running time with and without CLUSTERING, 100 files from UUF050 problems
010002000300040005000
1 2 3 4 5 6 7
Propositional variables / multi-variable
Ru
nn
ing
tim
e (m
s)
Running time without clustering Running time with clustering
The same result in table formThe same result in table form
Propositional variables / multi-variable: 1 2 3 4 5 6 7 Running time without clustering (ms): 325 429 532 648 672 1096 4702 Running time with clustering (ms): 325 336 319 342 351 627 758
Clustering gives significant speed-up! Best running time (319 ms) is in case of clustering
and 3 prop. var. / multi-var. Note that the longest clause is 3-clause!
Weaker AssignmentsWeaker Assignments
Let F be a formula, D be a domain and v, w elements of D. Then w is weaker than v iff v occurs in any literal where w occurs.
The weaker assignment w can be eliminated from D, because any solution using w can be transformed in a solution using v.
1011
1100 0011
1100 1100
Search Space after Deleting the Search Space after Deleting the Weaker AssignmentsWeaker Assignments
1 0 0 0
1 0 0 0
Test ResultsTest Results
The effect of Deletion of Weaker Assignments (DoWA) in case of hole6.cnf
0
50
100
150
200
250
300
350
400
450
500
1 2 3 4 5 6 7 8 9
Propositional variables / multi-variable
Ru
nn
ing
tim
e (m
s)
presearch DoWA exhaustive DoWA no DoWA
Pigeon Hole Problemwith 6 holes and 7 pigeons
hole6.cnf:6 5 4 3 2 1 012 11 10 9 8 7 018 17 16 15 14 13 024 23 22 21 20 19 030 29 28 27 26 25 0 36 35 34 33 32 31 042 41 40 39 38 37 0 -1 -7 0-1 -13 0-1 -19 0-1 -25 0-1 -31 0-1 -37 0-7 -13 0…
The same result in table formThe same result in table form
Propositional variables / multi-variable: 1 2 3 4 5 6 7 8 9 Running time (ms) with no Deletion of Weaker Assignments (DoWA): 1000 375 469 235 203 172 203 219 297 Running time (ms) with DoWA only once in the preprocessing: 1000 375 469 219 187 79 94 110 110 Running time (ms) with DoWA also after a new unit is found: 1000 203 156 109 93 62 78 94 109
Deletion of Weaker Assignments gives significant speed-up! Best running times is in case of 6 prop. var. / multi-var. Note that the longest clause is 6-clause!
The same table for hole7.cnfThe same table for hole7.cnf
Propositional variables / multi-variable: 1 2 3 4 5 6 7 8 9 Running time (ms) with no Deletion of Weaker Assignments (DoWA): 22781 4766 3313 2281 2188 2265 2125 2125 2781 Running time (ms) with DoWA only once in the preprocessing: 22781 4828 3203 2187 2078 2250 640 797 1047 Running time (ms) with DoWA also after a new unit is found: 22781 2078 1219 922 813 859 547 703 860
Deletion of Weaker Assignments gives significant speed-up! Best running times is in case of 7 prop. var. / multi-var. Note that the longest clause is 7-clause!
Future workFuture work
Now it is implemented in Java.– Migrate it to C / C++.
We would like to implement – Variable merging,– Lazy data structure,– Watch literals,– Pure literal elimination.