250 likes | 372 Views
Maximum Density Still Life. Symmetries and Lazy Clause Generation Geoffrey Chu, Maria Garcia de la Banda, Chris Mears, Peter J. Stuckey. Symmetries and Lazy Clause Generation. Outline Definitions: CSP, symmetries, nogoods Symmetry Breaking During Search (SBDS)
E N D
Maximum Density Still Life Symmetries and Lazy Clause Generation Geoffrey Chu, Maria Garcia de la Banda, Chris Mears, Peter J. Stuckey
Symmetries and Lazy Clause Generation Outline • Definitions: CSP, symmetries, nogoods • Symmetry Breaking During Search (SBDS) • Lazy Clause Generation & 1UIP nogoods • Can we combine them? -> SBDS-1UIP • Experiments
CSP and Symmetries • Constraint Satisfaction Problem (V, D, C) • A set of variables V, a set of domains D, a set of constraints C • An assignment is a solution if it satisfies all constraints • A symmetry is a bijective mapping from assignments to assignments which preserves solutions, i.e., is a solution iff () is a solution
Nogood • A constraint n of form: l1 /\ ... /\ ln → false • Implied by original problem, i.e. C => n • Used as a clausal propagator to reduce search • If n-1 literals are true given current domain, then propagates to set last literal false
Symmetry Breaking During Search • A dynamic symmetry breaking technique • Reduce search by preventing solver from exploring nodes that are symmetric to previously explored nodes • Can be thought of in terms of symmetric nogoods • Suppose decisions d1, d2, …, dn lead to failure • Decision nogood: d1 /\ … /\ dn → false • Suppose is a symmetry • Symmetric nogood: (d1)/\ … /\ (dn) → false is also valid
Symmetry Breaking During Search (2) • x1 + x2 + x3 <= 5, alldiff(x1, x2, x3), xi {1,2,3} • Nogood: [x1 = 1] /\ [x2 = 2] →false • Since all variables are symmetric, we also have: • [x1 = 1] /\ [x3 = 2] →false • [x2 = 1] /\ [x1 = 2] →false, etc • SBDS adds: (d1)/\ … /\ (dn) → falseas a local constraint • Prevents any symmetric partial assignment from being explored
1UIP nogood • SAT and LCG solvers do not use decision nogoods • They use First Unique Implication Point (1UIP) nogood • Empirically, 1UIP nogoods found to be much stronger than dec nogoods (in non-symmetric case) • Key Idea: use 1UIP nogoods (SBDS-1UIP) instead of decision nogoods (SBDS-DEC) in SBDS
Lazy Clause Generation Instrument propagators to explaineach propagation e.g. x != y: [x = 3] → [y != 3] e.g. x <= y: [x >= 3] → [y >= 3] Explanations form an implication graph When conflict occurs, analyse implication graph Resolve explanation clauses together to derive a new nogood
1UIP Nogood • Start with conflict clause • While more than one literal from the last decision level remain, use resolution to eliminate the last one inferred • Suppose a /\ l1 /\ … /\ ln → false is current nogood • Want to eliminate a • Get the explanation for a: k1 /\ … /\ km → a • Resolve to get: k1 /\ … /\ km /\ l1 /\ … /\ ln → false
SBDS-1UIP vs SBDS-DEC • SBDS-DEC is a complete method: • Once we have visited some partial assignment d1,..., dn, any partial assignment containing a symmetric version will be pruned • Theorem: SBDS-1UIP also guarantees this, given that the propagation engine p is: • Monotonic, i.e., if D' => D, then p(D') => p(D) • Symmetric, i.e., p(σ(D)) <=> σ(p(D)) • Proof: • Let n1UIP ≡ (l1 /\ ... /\ lm→ false) be nogood from d1,..., dn • We have: p(d1 /\ ... /\ dn) => l1 /\ ... /\ lm • Suppose D => σ(d1) /\ ... /\ σ(dn) • Then p(D) => σ(l1) /\ ... /\ σ(lm), so D is pruned by σ(n1UIP)
SBDS-1UIP Example • 5-colour this graph (value sym) • Already coloured x1, x2, x3, x4, x5 • Some values knocked out
SBDS-1UIP Example (2) Set: x6 = 1
SBDS-1UIP Example (3) Set: x7 = 2
SBDS-* • 1UIP nogood: • [x8 != 1] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 1] /\ [x9 != 4] /\ [x9 != 5] → [x7 != 2] • Decision nogood: • [x1 = 1] /\ [x2 = 2] /\ [x3 = 3] /\ [x4 = 4] /\ [x5 = 5] /\ [x6 = 1] → [x7 != 2] • SBDS-1UIP uses symmetry 2 ↔ 3 to get: • [x8 != 1] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 1] /\ [x9 != 4] /\ [x9 != 5] → [x7 != 3] • Which immediately prunes 3 from x7’s domain. • SBDS-DEC cannot do this!
SBDS-1UIP Example (4) • Add in nogoods, backtrack, and propagate: • [x8 != 1] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 1] /\ [x9 != 4] /\ [x9 != 5] → [x7 != 2] • [x8 != 1] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 1] /\ [x9 != 4] /\ [x9 != 5] → [x7 != 3] • Conflict again!
SBDS-* (2) • 1UIP: [x7 != 4] /\ [x7 != 5] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 4] /\ [x9 != 5] → [x6 != 1] • DEC: [x1 = 1] /\ [x2 = 2] /\ [x3 = 3] /\ [x4 = 4] /\ [x5 = 5] → [x6 != 1] • SBDS-1UIP uses symmetry 1 ↔ 2 and 1 ↔ 3 to get: • [x7 != 4] /\ [x7 != 5] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 4] /\ [x9 != 5] → [x6 != 2] • [x7 != 4] /\ [x7 != 5] /\ [x8 != 4] /\ [x8 != 5] /\ [x9 != 4] /\ [x9 != 5] → [x6 != 3] • Which immediately prunes 2 and 3 from x6’s domain. • SBDS-DEC again cannot do this!
Search Tree • SBDS-DEC • 10 nodes • 6 failures • SBDS-1UIP • 3 nodes • 2 failures
Other symmetry breaking methods? • Can any other method exploit symmetries 1 ↔ 2 and 1 ↔ 3 here? • SBDD also uses decision nogoods, so can't • Static lex sym break is: min{i | x_i = 1} < ... < min(i | x_i = 5}, can't since all 5 values already used, so constraint already satisfied • Conditional symmetries can’t since 1 ↔ 2, 1 ↔ 3 are not symmetries of this subproblem (due to x10's domain) • SBDS-1UIP can because 1UIP nogoods tells us exactly which vars involved in conflict, and 1 ↔ 2 and 1 ↔ 3 hold over x6, x7, x8, x9
Beyond complete?! • SBDS-DEC, SBDD, Lex are all complete sym break methods for this example, i.e. for each set of symmetric assignments (an orbit), all but one assignment is pruned • How can SBDS-1UIP be stronger?? • With SBDS-DEC, SBDD, Lex, solver must visit at least one assignment in each orbit • With SBDS-1UIP it does not necessarily have to! • Used failure of x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 = 5, x6 = 1 to prune x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 = 5, x6 = 2 • Can correctly perform "cross orbital" pruning • Can wipe out entire orbit without examining any member
Experimental Results • Concert Hall Problem and the Graph Colouring Problem • Both have variable and value symmetries • Implemented SBDS in state of the art lazy clause solver Chuffed • Show results for no sym break, SBDS-DEC and SBDS-1UIP on Chuffed
Conclusion • We combined SBDS and LCG • Key Idea: use 1UIP nogoods in SBDS instead of decision nogoods • SDBS-1UIP is at least as strong as SBDS-DEC • Can be strictly stronger on some problems • Can exploit types of symmetries that no other general method we are aware of can exploit • Future Work: Try other kinds of nogoods in SBDS? • What is the theoretical limit of the power of sym break? Completeness is apparently not the limit!