| 1 |
Chuffed - A lazy clause solver |
| 2 |
|
| 3 |
Geoffrey Chu, Peter J. Stuckey, Andreas Schutt, Thorsten Ehlers, Graeme Gange, Kathryn Francis |
| 4 |
|
| 5 |
Data61, CSIRO, Australia |
| 6 |
|
| 7 |
Department of Computing and Information Systems |
| 8 |
University of Melbourne, Australia |
| 9 |
|
| 10 |
|
| 11 |
Chuffed is a state of the art lazy clause solver designed from the ground up |
| 12 |
with lazy clause generation in mind. Lazy clause generation is a hybrid |
| 13 |
approach to constraint solving that combines features of finite domain |
| 14 |
propagation and Boolean satisfiability. Finite domain propagation is |
| 15 |
instrumented to record the reasons for each propagation step. This creates an |
| 16 |
implication graph like that built by a SAT solver, which may be used to create |
| 17 |
efficient nogoods that record the reasons for failure. These nogoods can be |
| 18 |
propagated efficiently using SAT unit propagation technology. The resulting |
| 19 |
hybrid system combines some of the advantages of finite domain constraint |
| 20 |
programming (high level model and programmable search) with some of the |
| 21 |
advantages of SAT solvers (reduced search by nogood creation, and effective |
| 22 |
autonomous search using variable activities). |
| 23 |
|
| 24 |
The FD components of Chuffed are very tightly integrated with a SAT solver. For |
| 25 |
"small" variables (|D| <= 1000), SAT variables representing [x = v] or [x >= v] |
| 26 |
are eagerly created at the start of the problem. Channelling constraints are |
| 27 |
natively enforced by the variable objects in order to keep the FD solver and |
| 28 |
the SAT solver's view of the domains fully consistent at all times. For "large" |
| 29 |
variables (|D| > 1000), the SAT variables are lazily generated as needed. Every |
| 30 |
propagator in Chuffed has been instrumented so that all propagation can be |
| 31 |
explained by some combination of the literals in the SAT solver. An explanation |
| 32 |
is of the form a_1 /\ ... /\ a_n -> d, where a_i represent domain restrictions |
| 33 |
which are currently true, and d represents the domain change that is implied. |
| 34 |
e.g. Suppose z >= x + y, and we have x >= 3, y >= 2. Then the propagator would |
| 35 |
propagate x >= 5 with explanation clause x >= 3 /\ y >= 2 -> z >= 5. |
| 36 |
|
| 37 |
The explanations for each propagation form an implication graph. This allows us |
| 38 |
to do three very important things. Firstly, we can derive a nogood to explain |
| 39 |
each failure. Such nogoods often allow us to avoid a very large amount of |
| 40 |
redundant work, thus producing search trees which are orders of magnitude |
| 41 |
smaller. Secondly, nogoods allow us to make informed choices about |
| 42 |
non-chronological back-jumping. When no literal from a decision level appears |
| 43 |
in the nogood, it is indicative of the fact that the decision made at that |
| 44 |
level was completely irrelevant to the search. Thus by back-jumping over such |
| 45 |
decisions, we retrospectively avoid making such bad decisions, and hopefully |
| 46 |
make good decisions instead which drive the search towards failure. Thirdly, by |
| 47 |
analysing the conflict, we can actively gain some information about what good |
| 48 |
decision choices are. The Variable State Independent Decaying Sum (VSIDS) |
| 49 |
heuristic is an extremely effective search heuristic for SAT problems, and is |
| 50 |
also extremely good for a range of CP problems. Each variables has an |
| 51 |
associated activity, which is increased whenever the variable is involved in |
| 52 |
the conflict. Variables with the highest activity is chosen as the decision |
| 53 |
variable at each node. The activities are decayed to reflect the fact that the |
| 54 |
set of important variables changes with time. |
| 55 |
|
| 56 |
Although Chuffed implements lazy clause generation, which is cutting edge and |
| 57 |
rather complex, the FD parts of Chuffed are relatively simple. In fact, it is |
| 58 |
quite minimalistic. Chuffed only supports 3 different propagator priorities. |
| 59 |
Chuffed implements a number of global propagators (alldiff, inverse, |
| 60 |
minimum, table, regular, mdd, cumulative, disjunctive, circuit, difference). |
| 61 |
It also only supports two kinds of integer variables. Small integer variables |
| 62 |
for which the domain is represented by a byte string. |
| 63 |
And large integer variables for which the domain is represented only by its |
| 64 |
upper and lower bound (no holes allowed). All boolean variables and boolean |
| 65 |
constraints are handled by the builtin SAT solver. |
| 66 |
|
| 67 |
Great pains have been taken to make everything as simple and efficient as |
| 68 |
possible. The solver, when run with lazy clause generation disabled, is |
| 69 |
somewhat comparable in speed with older versions of Gecode. The overhead from |
| 70 |
lazy clause generation ranges from negligible to perhaps around 100%. The |
| 71 |
search reduction, however, can reach orders of magnitude on appropriate |
| 72 |
problems. Thus lazy clause generation is an extremely important and useful |
| 73 |
technology. The theory behind lazy clause generation is described in much |
| 74 |
greater detail in various papers. |