750 likes | 885 Views
Maintaining Generalized Arc Consistency on Ad Hoc r-ary Constraints. Kenil Cheng and Roland Yap School of Computing National University of Singapore. Outline. GAC on an MDD constraint Implementation of O(1) incrementality Comparisons & empirical results. Multi-valued decision diagram (MDD).
E N D
Maintaining Generalized Arc Consistency on Ad Hoc r-ary Constraints Kenil Cheng and Roland Yap School of Computing National University of Singapore
Outline • GAC on an MDD constraint • Implementation of O(1) incrementality • Comparisons & empirical results
Multi-valued decision diagram (MDD) x 2 1 3 y y y 3 2 1 1 2 3 2 z z z 2 1 3
Multi-valued decision diagram (MDD) x 2 1 3 y y y 3 2 1 1 2 3 2 z z z 2 1 3
Outline • GAC on an MDD constraint • Implementation of O(1) incrementality • Comparisons & empirical results
mddc • Fast support checks • Prefix & suffix sharing • Built-in indexing • Depth-first traversal of the MDD • Time complexity is linear to size of MDD
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y Any support for (z=1)? y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y Found a support for (z=1) y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x I knew it’s consistent. y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z I knew it. z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
0 x 2 u 1 x pruned consistent v v x w w w x x x y y y MDD z z z
Outline • GAC on an MDD constraint • Implementation of O(1) incrementality • Comparisons & empirical results
Trailing of inconsistent MDD nodes “Is node X pruned?” during search “Prune X.” O(1) “Undo ‘prune X’.” backtracks
Trailing of inconsistent MDD nodes during search stack array T0 “Prune 3.” @ T0 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 “Prune 3.” @ T0 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 “Is 3 pruned?” “Prune 3.” @ T0 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 “Prune 6.” @ T0 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 “Prune 6.” @ T0 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 T1 “Prune 1.” @ T1 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 T1 T2 “Prune 5.” @ T2 sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array T0 T1 T2 “Backtracks to T0.” sparse set [BT93]
Trailing of inconsistent MDD nodes during search stack array “Is 6 pruned?” T0 “Is 5 pruned?” “Backtracks to T0.” sparse set [BT93]
Outline • GAC on an MDD constraint • Implementation of O(1) incrementality • Comparisons & empirical results
mddc vs state-of-the-art • For structural constraints, up to • r^2timesfaster than binary search [LS06] • dtimesfaster than hologram [LR05] • 2^r times faster than mtrie & nd-list [GJMN07] • N.B. arity (r) and domain size(d) dominate the time complexity O(rd^r) of generic GAC • Empirical comparison is not easy • Ease & quality of implementation • Dependence on other solver components
mddc vs regular (global constraint) sparse set (GeCode) bit vector (GeCode) [CY06] time stamp (GeCode) mimics SICStus Prolog’s case regular (GeCode) [P04] Solving Still-Life Problem using MDD constraints MDD size: Θ(0.9121n x 6.486n)
mddc vs regular (global constraint) • Solving Car Sequencing using MDD constraints (global sequence constraints) • Bottom-up labeling (worst for mddc) Incrementality is critical
mddc vs regular (global constraint) • Solving Car Sequencing using MDD constraints (global sequence constraints) • Top-down labeling (best for mddc) Incrementality is implicitly achieved
mddc vs state-of-the-art • For random constraints worst case for MDDs • Similar to [GJMN07] • Arity: 5, 7, …, 17 • # of variables: (arity+2), (arity+5), …, 30 • Domain size: 2, 3, …, 11 • # of constraints: based on RB model • Looseness: 20%, 50%, 80% • 1000 ≤ # of tuples ≤ 100K 36 ≤ MDD size ≤ 10588 • Time limit: 3 minutes • 5 instances per setting 1747 instances • Implemented in GeCode 2.1.1 Small MDDs Larger, harder benchmarks in paper