Project Title Research Contact SWG Contacts / Catcher

Download Report

Transcript Project Title Research Contact SWG Contacts / Catcher

CSP-SAT Workshop, June 2011
A General Nogood-Learning Framework
for Pseudo-Boolean Multi-Valued SAT*
Siddhartha Jain
Ashish Sabharwal
Meinolf Sellmann
Brown University
IBM Watson
IBM Watson
* to appear at AAAI-2011
IBM Watson Research Center, 2011
© 2011 IBM Corporation
IBM Research
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
© 2011 IBM Corporation
IBM Research
SAT Solvers as Search Engines
 Systematic SAT solvers have become
really 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:
–
–
–
–
3
Make
Deduce
Learn
Restart
2000-5000
600-1000
600-1000
June 18, 2011
decisions/second
conflicts/second
clauses/second (#clauses grows rapidly)
every 1-2 seconds (aggressive restarts)
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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]
Starting point for this work
4
June 18, 2011
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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?
x11 = true
x22 = true
x31 = true
5
C5
No more propagation,
no conflict… really?
x51 = true
June 18, 2011
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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:
x11 = true
x22 = true
x31 = true
C1
x41 ≠ true
C2
x32 ≠ true
C5
x51 = true
C3
6
June 18, 2011
C4
x43 = true
conflict
x42 = true
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
What Shall We Learn?
x11 = true
x22 = true
x31 = true
C1
x41 ≠ true
C2
x32 ≠ true
C5
x51 = true
C3
C4
x43 = true
conflict
x42 = true
 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
© 2011 IBM Corporation
IBM Research
CMVSAT-1
 Use UIV rather than UIP
 Use variable inequations as the
core representation:
X1 = 1, X2 = 2, X3 = 1
represented as X1 ≠ 2, X1 ≠ 3, …
 finer granularity reasoning!
X3 doesn’t necessarily need to be 1
for a conflict, it just cannot be 6 or 7
 Stronger learned multi-valued clause:
(X4 = 1 || X3 = 6 || X3 = 7)
– Upon backtracking, we immediately
infer X3 ≠ 1, 2, 3, 4, 5 !
8
June 18, 2011
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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:
– in general:
– example:
multi-valued clauses (X4 = 1 || X3 = 6 || X3 = 7)
secondary constraints supported by the solver
(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
© 2011 IBM Corporation
IBM Research
This Work: Generalize This Framework
 Learned nogoods
– CMVSAT-1:
– in general:
– example:
multi-valued clauses (X4 = 1 || X3 = 6 || X3 = 7)
disjunctions of negations of primitives
(with certain desirable properties)
(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
© 2011 IBM Corporation
IBM Research
Sufficient Conditions
[details in AAAI-2011 paper]
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
© 2011 IBM Corporation
IBM Research
Abstract Implication Graph (under sufficient conditions)
Cp: primary constraints branched upon or entailed at various decision levels
Learned nogood: disjunction of negations of primitives in shaded nodes
12
June 18, 2011
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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)
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)
13
June 18, 2011
A General Nogood-Learning Framework
© 2011 IBM Corporation
IBM Research
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 constraints
e.g. (X1  [5…60] || X2  [37…74] || X5 = b || X10 ≤ 15)
 Comparison against:
– SAT solver:
– CSP solver:
Minisat [Een-Sorensson 2004, version 2.2.0]
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
© 2011 IBM Corporation
IBM Research
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
© 2011 IBM Corporation
IBM Research
Empirical Evaluation: Results
SAT solver
CSP solver
MIP solver
 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
© 2011 IBM Corporation
IBM Research
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
© 2011 IBM Corporation