A General Nogood-Learning Framework for Pseudo-Boolean Multi-Valued SAT*

bugenigmaΛογισμικό & κατασκευή λογ/κού

30 Οκτ 2013 (πριν από 4 χρόνια και 2 μήνες)

123 εμφανίσεις

CSP
-
SAT Workshop, June 2011

IBM Watson Research Center, 2011

©
2011
IBM Corporation

A General
Nogood
-
Learning Framework

for Pseudo
-
Boolean Multi
-
Valued SAT*


Siddhartha Jain


Brown University

Ashish Sabharwal

IBM Watson

Meinolf 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
:


p
roblem 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 Corporation

3

June 18, 2011 A General Nogood
-
Learning Framework

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:



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:


X
1
,
X
2
,
X
4



{
1
,
2
,
3
}


X
3



{
1
, …,
7
}


X
5



{
1
,
2
}



Pure SAT encoding
: variables
x
11
,
x
12
,
x
13
,
x
21
,
x
22
,
x
23
,
x
31
, …,
x
37
,
x
51
,
x
52


What happens when we set
X
1

=
1
,
X
2

=
2
,
X
3

=
1
?

5

June
18
,
2011
A General Nogood
-
Learning Framework

x
11

= true

x
22

= true

x
31

= true

x
51

= true

C5

No more propagation,

n
o 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

x
11

= true

x
22

= true

x
31

= true

x
51

= true

x
41

≠ true

x
32

≠ true

C
5

C2

C
1

x
4
3

= true

C
4

x
42

= true

C3

conflict

IBM Research

©
2011
IBM Corporation

What Shall We Learn?


Not a good idea to set
x
41

≠ true and
x
31

= true



learn the
nogood

(
x
41

= true ||
x
31

= false)


Problem?

When we backtrack and set, say,
X
3

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

x
11

= true

x
22

= true

x
31

= true

x
51

= true

x
41

≠ true

x
32

≠ true

C
5

C
2

C1

x
4
3

= true

C
4

x
42

= true

C3

conflict

IBM Research

©
2011
IBM Corporation

CMVSAT
-
1


Use
UIV

rather than UIP


Use
variable
inequations

as the

core

representation
:

X
1

=
1
,
X
2

=
2
,
X
3

=
1

represented as
X
1


2
,
X
1


3
, …




finer granularity

reasoning!

X
3

doesn’t necessarily need to be
1

for a conflict, it just cannot be
6
or
7



Stronger learned multi
-
valued clause
:

(
X
4

=
1
||
X
3

=
6
||
X
3

=
7
)


Upon backtracking, we immediately

infer
X
3


1
,
2
,
3
,
4
,
5
!

8

June 18, 2011 A General Nogood
-
Learning Framework

IBM Research

©
2011
IBM Corporation

This Work: Generalize This Framework


C
ore representation in implication graph


CMVSAT
-
1
:
variable
inequations

(
X
4


1
)


i
n general:


primitive constraints

of the solver


example:


linear inequalities (
Y
2


5
,
Y
3


1
)



Constraints


CMVSAT
-
1
:

multi
-
valued clauses (
X
4

=
1
||
X
3

=
6
||
X
3

=
7
)


in general:


secondary constraints

supported by the solver


example:


(
X
1

= true ||
Y
3


4
||
X
3

= Michigan)



Propagation

of a secondary constraint C
s
:

entailment of a new primitive constraint
from C
s

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 (
X
4

= 1 ||
X
3

= 6 ||
X
3

= 7)


i
n general:


disjunctions of negations of primitives




(with certain desirable properties)


example:


(
X
1

= true ||
Y
3

≤ 4 ||
X
3

= 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
Y
3

is meant to become unit upon backtracking, then

(
X
1

= true ||
Y
3

≤ 4 ||
Y
3

≥ 6
||
X
3

= Michigan) is NOT desirable


cannot represent
Y
3

≤ 4 ||
Y
3

≥ 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

C
p
: primary constraints

branched upon or entailed at various decision levels

Learned
nogood
: disjunction of negations of primitives in
shaded

nodes

IBM Research

©
2011
IBM Corporation

General Framework: Example


X
1



{true, false}

X
3



{NY, TX, FL, CA}

X
5



{r, g, b}

X
2
,
X
4
,
X
6
,
X
7



{
1
, …,
100
}



Branch on
X
1

≠ true,
X
2


50
:


Learn:
(
X
3

= FL ||
X
4


31
)

13

June
18
,
2011
A General Nogood
-
Learning Framework

Notes:

1.
T
he 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.
(
X
1

+
5
X
2



13
X
3


6
)


disjunctions

of equations and range constraints

e.g.
(
X
1



[
5

60
] ||
X
2



[


74
] ||
X
5

= b ||
X
10


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


r
andom cost
c
ik



{
1
, …,
10
} assigned to cell (
i
,
k
)


c
ost constraint:
sum
ik

(
c
ik

X
ik
) ≤ (sum of all costs) /
2


s
ize
25
x
25
,
40
% filled entries, all satisfiable



MSP
-
3
: market split problem


n
otoriously hard for constraint solvers


p
artition
20
weighted items into
3
equal sets,
10
% satisfiable



NQUEENS
-
W
: weighted n
-
queens,
30
x
30


average weight of occupied cells ≥
70
% of
weight
max


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


20
x slower on MSP
-
3


Mistral

explores a much larger search space than needed


Lack of
nogood

learning becomes a bottleneck:

e.g.:
3
M nodes
for QWH
-
C
(
36
% solved)
, compared to
231
nodes
for CMVSAT
-
2


SCIP

takes
100
x longer on QWH
-
c,
10
x 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


s
econdary 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