SAT and CSP/CP Solvers [complete search]
-
Upload
lois-mullen -
Category
Documents
-
view
23 -
download
0
description
Transcript of SAT and CSP/CP Solvers [complete search]
CSP-SAT Workshop, June 2011
IBM Watson Research Center, 2011 © 2011 IBM Corporation
A General Nogood-Learning Frameworkfor Pseudo-Boolean Multi-Valued SAT*
Siddhartha Jain Brown UniversityAshish Sabharwal IBM WatsonMeinolf Sellmann IBM Watson
* to appear at AAAI-2011
IBM Research
© 2011 IBM Corporation
SAT and CSP/CP Solvers [complete search]
CP Solvers:– work at a high level: multi-valued variables, linear inequalities, element
constraints, global constraint (knapsack, alldiff, …)– have access to problem structure and specialized inference algorithms!
SAT:– problem crushed down to one, fixed, simple input format:
CNF, Boolean variables, clauses– very simple inference at each node: unit propagation– yet, translating CSPs to SAT can be extremely powerful!
E.g., SUGAR (winner of CSP Competitions 2008 & 2009)
How do SAT solvers even come close to competing with CP?
A key contributor: efficient and powerful “nogood learning”
2 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation3 June 18, 2011 A General Nogood-Learning Framework
SAT Solvers as Search Engines
Systematic SAT solvers have becomereally efficient at searching fast and learning from “mistakes”
E.g., on an IBM model checking instance from SAT Race 2006, with~170k variables, 725k clauses, solvers such as MiniSat and RSat roughly:
– Make 2000-5000 decisions/second– Deduce 600-1000 conflicts/second– Learn 600-1000 clauses/second (#clauses grows rapidly)– Restart every 1-2 seconds (aggressive restarts)
IBM Research
© 2011 IBM Corporation
An Interesting Line of Work: SAT-X Hybrids
Goal: try to bring more structure to SAT and/or bring SAT-style techniques to CSP solvers
Examples:– Pseudo-Boolean solvers: inequalities over binary variables– SAT Module Theories (SMT): “attach” a theory T to a SAT solver– Lazy clause generation: record clausal reasons for domain changes in a
CP solver– Multi-valued SAT: incorporate multi-valued semantics into SAT
preserve the benefits of SAT solvers in a more general context strengthen unit propagation: unit implication variables (UIV) strengthen nogood-learning! [Jain-O’Mahony-Sellmann, CP-2010]
4 June 18, 2011 A General Nogood-Learning Framework
Starting point for this work
IBM Research
© 2011 IBM Corporation
Conflict Analysis: Example
Consider a CSP with 5 variables: X1, X2, X4 {1, 2, 3} X3 {1, …, 7} X5 {1, 2}
Pure SAT encoding: variables x11, x12, x13, x21, x22, x23, x31, …, x37, x51, x52
What happens when we set X1 = 1, X2 = 2, X3 = 1?
5 June 18, 2011 A General Nogood-Learning Framework
x11 = true
x22 = true
x31 = true x51 = trueC5
No more propagation,no conflict… really?
IBM Research
© 2011 IBM Corporation
Conflict Analysis: Incorporating UIVs
Unit implication variable (UIV):a multi-valued clause is “unit”as soon as all unassigned “literals”in it regard the same MV variable
SAT encoding, stronger propagation using UIVs:
6 June 18, 2011 A General Nogood-Learning Framework
x11 = true
x22 = true
x31 = true x51 = true
x41 ≠ true
x32 ≠ true
C5
C2
C1
x43 = trueC4
x42 = trueC3
conflict
IBM Research
© 2011 IBM Corporation
What Shall We Learn?
Not a good idea to set x41 ≠ true and x31 = true learn the nogood (x41 = true || x31 = false)
Problem? When we backtrack and set, say, X3 to anything in {2, 3, 4, 5}, we end up performing exactly the same analysis again and again!
Solution: represent conflict graph nodes as variable inequations only
7 June 18, 2011 A General Nogood-Learning Framework
x11 = true
x22 = true
x31 = true x51 = true
x41 ≠ true
x32 ≠ true
C5
C2
C1
x43 = trueC4
x42 = trueC3
conflict
IBM Research
© 2011 IBM Corporation
CMVSAT-1
Use UIV rather than UIP
Use variable inequations as thecore representation:X1 = 1, X2 = 2, X3 = 1represented as X1 ≠ 2, X1 ≠ 3, …
finer granularity reasoning!X3 doesn’t necessarily need to be 1for a conflict, it just cannot be 6 or 7
Stronger learned multi-valued clause:(X4 = 1 || X3 = 6 || X3 = 7)
– Upon backtracking, we immediatelyinfer X3 ≠ 1, 2, 3, 4, 5 !
8 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation
This Work: Generalize This Framework
Core representation in implication graph
– CMVSAT-1: variable inequations (X4 ≠ 1)
– in general: primitive constraints of the solver
– example: linear inequalities (Y2 ≤ 5, Y3 ≥ 1)
Constraints
– CMVSAT-1: multi-valued clauses (X4 = 1 || X3 = 6 || X3 = 7)
– in general: secondary constraints supported by the solver
– example: (X1 = true || Y3 ≤ 4 || X3 = Michigan)
Propagation of a secondary constraint Cs:entailment of a new primitive constraint from Cs and known primitives
9 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation
This Work: Generalize This Framework
Learned nogoods
– CMVSAT-1: multi-valued clauses (X4 = 1 || X3 = 6 || X3 = 7)
– in general: disjunctions of negations of primitives(with certain desirable properties)
– example: (X1 = true || Y3 ≤ 4 || X3 = Michigan)
Desirable properties of nogoods?– The “unit” part of the learned nogood that is implied upon
backtracking must be representable as a set of primitives!– E.g., if Y3 is meant to become unit upon backtracking, then
(X1 = true || Y3 ≤ 4 || Y3 ≥ 6 || X3 = Michigan) is NOT desirable• cannot represent Y3 ≤ 4 || Y3 ≥ 6 as a conjunction of primitives • upon backtracking, cannot propagate the learned nogood
10 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation
Sufficient Conditions
1. System distinguishes between primitive and secondary constraints
2. Secondary constraint propagators:– Entail new primitive constraints
– Efficiently provide a set of primitives constraints sufficient for the entailment
3. Can efficiently detect conflicting sets of primitives– and represent the disjunction of their negations (the “nogood”)
as a secondary constraint
4. Certain sets of negated primitives (e.g., those arising from propagation upon backtracking) succinctly representable as a set of primitives
5. Branching executed as the addition of one or more* primitives
Under these conditions, we can efficiently learn strong nogoods!
11 June 18, 2011 A General Nogood-Learning Framework
[details in AAAI-2011 paper]
IBM Research
© 2011 IBM Corporation
Abstract Implication Graph (under sufficient conditions)
12 June 18, 2011 A General Nogood-Learning Framework
Cp: primary constraints branched upon or entailed at various decision levelsLearned nogood: disjunction of negations of primitives in shaded nodes
IBM Research
© 2011 IBM Corporation
General Framework: Example
X1 {true, false}X3 {NY, TX, FL, CA}X5 {r, g, b}X2, X4, X6, X7 {1, …, 100}
Branch on X1 ≠ true, X2 ≤ 50:
Learn: (X3 = FL || X4 ≥ 31)
13 June 18, 2011 A General Nogood-Learning Framework
Notes:1. The part of the nogood that is unit upon backtracking
need not always regard the same variable! (e.g., when X ≤ Y is primitive)2. Neither is regarding the same variable sufficient for being a valid nogood!
(e.g., X ≤ 4 || X ≥ 11 wouldn’t be representable)
IBM Research
© 2011 IBM Corporation
Empirical Evaluation
Ideas implemented in CMVSAT-2
Currently supported:– usual domain variables, and range variables
– linear inequalities, e.g. (X1 + 5 X2 – 13 X3 ≤ 6)
– disjunctions of equations and range constraintse.g. (X1 [5…60] || X2 [37…74] || X5 = b || X10 ≤ 15)
Comparison against:– SAT solver: Minisat [Een-Sorensson 2004, version 2.2.0]
– CSP solver: Mistral [Hebrard 2008]
– MIP solver: SCIP [Achterberg 2004, version 2.0.1]
Encodings generated using Numberjack [Hebrard et al 2010, version 0.1.10-11-24]
14 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation
Empirical Evaluation
Benchmark domains (100 instances of each)
– QWH-C: weighted quasi-group with holes / Latin square completion• random cost cik {1, …, 10} assigned to cell (i,k)• cost constraint: sumik (cik Xik) ≤ (sum of all costs) / 2• size 25 x 25, 40% filled entries, all satisfiable
– MSP-3: market split problem• notoriously hard for constraint solvers• partition 20 weighted items into 3 equal sets, 10% satisfiable
– NQUEENS-W: weighted n-queens, 30x30• average weight of occupied cells ≥ 70% of weightmax
• size 30 x 30, random weights {1,…,10}
15 June 18, 2011 A General Nogood-Learning Framework
IBM Research
© 2011 IBM Corporation
Empirical Evaluation: Results
CMVSAT-2 shows good performance across a variety of domains– Solved all 300 instances in < 4 sec on average
MiniSat not suitable for domains like QWH-C– Encoding (even “compact” ones like in Sugar) too large to generate or solve
– 20x slower on MSP-3
Mistral explores a much larger search space than needed– Lack of nogood learning becomes a bottleneck:
e.g.: 3M nodes for QWH-C (36% solved), compared to 231 nodes for CMVSAT-2
SCIP takes 100x longer on QWH-c, 10x longer on NQUEENS-W
16 June 18, 2011 A General Nogood-Learning Framework
SAT solver CSP solver MIP solver
IBM Research
© 2011 IBM Corporation
Summary
A generalized framework for SAT-style nogood-learning– extends CMVSAT-1– low-overhead process, retains efficiency of SAT solvers– sufficient conditions:
• primitive constraints• secondary constraints, propagation as entailment of primitives• valid cutsets in conflict graphs: facilitate propagation upon backtracking• other efficiency / representation criteria
CMVSAT-2: robust performance across a variety of problem domains– compared to a SAT solver, a CSP solver, a MIP solver
– open: more extensive evaluation and comparison against, e.g., lazy clause generation, pseudo-Boolean solvers, SMT solvers
– nonetheless, a promising and fruitful direction!
17 June 18, 2011 A General Nogood-Learning Framework