Interchangeability in CSPs Foundations of Constraint Processing CSCE
Interchangeability in CSPs Foundations of Constraint Processing CSCE 421/821, Fall 2004: www. cse. unl. edu/~choueiry/F 04 -421 -821/ Anagh Lal Avery Hall, Room 123 D alal@cse. unl. edu Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Outline • • • Exploiting problem structure Interchangeability: Introduction Interchangeability: Types Search with Interchangeability Non-binary CSPs: Challenges and approach • Databases: Challenges and approach Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Exploit problem structure • Declared symmetries [Glaisher 1874; Ellman 1993] – Applies to specific class of problems – Requires that a user or designer know the structure of the problem • Discover symmetries – Solver discovers symmetries called interchangeability – Symmetry detection partitions the domain of variables Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Idea Consider V 2 Domain value Consiste nt with V 1 c V 3(a, b, d) V 4(a, b) V 3 d V 3(a, b) V 4(a, b, c) e, f V 3(a, b, d) V 4(a, b, d) {d} {a, b, d} Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs V 2 {c, d, e, f } V 4 {a, b, c}
Interchangeability: Basics • Two interchangeable values of a variable behave in the same way – Globally (likely intractable) or – Locally (tractable) • Interchangeable values are redundant • Interchangeable values can be placed in a bundle and treated as a single value V 2 { c d e, f } Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Advantages S V 1 S d V 1 V 2 d V 2 c e f d c e, f d • Cluster or club together values e and f to form a bundle. • Search effort reduces – Fewer nodes are visited • Solutions produced may represent more than one solution – Solution space is compacted. Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Full Interchangeability • Full Interchangeability (FI) – All constraints are considered • Even when they do not apply to the variable – Two values of a variable are Full Interchangeable if on replacing one with the other gives another solution – Computing FI requires finding all solutions V 1 {d} V 2 {c, d, e, f } V 4 V 3 {a, b, d} {a, b, c} Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Neighborhood Interchangeability • Restricted to neighborhood of a variable • Easier to compute NI than FI • Compute bundles and store for use during search V 1 {d} V 2 {c, d, e, f } V 4 V 3 {a, b, d} {a, b, c} Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Computing NI • Discrimination Tree (DT) – Data structure for computing bundles of a variable. • Only the constraints that apply to the variable are considered • Requires an ordering of values to be followed Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Building the DT • Let us work with an example on the board. Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Static versus Dynamic NI • Static: Bundles computed prior to search • Dynamic: Bundles computed during search S S S V 1 d V 2 c V 2 e f d c e, f d Static bundling Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs c d, e, f Dynamic bundling
Finding all solutions • Dynamic bundling has strong results – Guaranteed no more expensive than forward checking – Guaranteed no more expensive than static bundling – Guaranteed to produce larger bundles than static bundling Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Finding one solution • Traditionally dynamic bundling was thought to be an overkill for finding one solution • Theoretical claims can not be made • Show empirically that dynamic bundling is effective for finding one solution also Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Extending to non-binary • Now we start getting into my work, finally! • Non-binary CSP: CSP with at least one constraint of arity greater than 2. • Many problems modeled more naturally by non-binary constraints – Theoretically all non-binary CSPs can be decomposed to binary – Binary version may not be a good choice all the time Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Non-binary CSPs • Informal introduction • Representation {1, 2, 3, 4, 5, 6} C 2 Constraint Variable {1, 2, 3} C 1 {1, 2, 3} C 3 {1, 2, 3} C 4 {1, 2, 3} Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
The Challenges • Constraints of different arities cause problems – Not possible to make one composite DT like structure – Comparing different length tuples (set of variable-value pairs) is awkward • Handling “Partially instantiated” constraints Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Bundling non-binary CSPs • Data structure used: non-binary Discrimination Tree (DT) • For bundling nb-CSP variables – Create a non-binary DT for each constraint that applies to the variable • Note difference from binary: All constraints were in one DT – Intersect the bundles from all the nb-DTs to get the bundles Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
The reason behind the gains • A no-good is a partial instantiation that does not lead to a solution • When search with bundling BTs on a no good a larger search space is eliminated • Of course, the same logic applies to a solution bundle V {1, 2} A {1, 3} {3} B {3} C No-good D Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs bundle {3} Solution bundle
Some results 1200 First Bundle Size 1000 800 600 n = 20, a = 10 p 2 = 0. 25 c 3 = 3 c 4 = 2 First Bundle Size # NV in FC # NV in Dyn. Bndl 400 200 0 0. 35 0. 45 0. 55 Tightness Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs 0. 65 0. 7
Some results [2] n = 20, a = 10 p 2 = 0. 25 c 3 = 3 c 4 = 2 Maximum gains occur around phasetransition area CPU time [ms] 2000 1500 1000 500 Dyn. Bndl FC Overhead due to large FBS (upto 1200) at low tightness 0 0. 35 0. 45 0. 55 Tightness Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs 0. 65 0. 7
Moving on to databases • Observations – The gains due to dynamic bundling are more for larger domain sizes – For finding all solutions bundling is always better – Bundling produces compact solution spaces • Deduction – Lets try it in Databases Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Database facts & challenges • Database is about I/O, CPU comparisons don’t matter • Data does not fit in memory • Memory efficiency is key to database algorithms • Database query processing algorithms provide an iterator interface to the query engine • Dynamic bundling as is, does not fit!! Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
How did we handle it for DB • A new bundling algorithm – No DTs – Sort constraints (the tables of the DB), use the structure introduced by sorting to detect bundles • Model search with bundling to fit the framework of query processing algorithms (join algorithm, in particular) Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs
Computing a bundle of R 1. A R 1 Current bundle of R 1. A = {1, 5} Bundle {1, 5} Partition Unequal partitions Symmetric partitions A B C 1 12 23 1 13 23 1 14 23 2 10 25 5 12 23 5 13 23 5 14 23 Foundations of Constraint Processing, Fall 2004 October 3, 2004 Interchangeability in CSPs 24
- Slides: 24