240 likes | 358 Views
Interchangeability in CSPs. Foundations of Constraint Processing CSCE421/821, Fall 2004: www.cse.unl.edu/~choueiry/F04-421-821/ Anagh Lal Avery Hall, Room 123D alal@cse.unl.edu. Outline. Exploiting problem structure Interchangeability: Introduction Interchangeability: Types
E N D
Interchangeability in CSPs Foundations of Constraint Processing CSCE421/821, Fall 2004: www.cse.unl.edu/~choueiry/F04-421-821/ Anagh Lal Avery Hall, Room 123D alal@cse.unl.edu Interchangeability in CSPs
Outline • Exploiting problem structure • Interchangeability: Introduction • Interchangeability: Types • Search with Interchangeability • Non-binary CSPs: Challenges and approach • Databases: Challenges and approach 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 Interchangeability in CSPs
{c, d, e, f } V2 {d} V1 V4 V3 {a, b, d} {a, b, c} Idea Consider V2 Interchangeability in CSPs
{ c d e, f } V2 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 Interchangeability in CSPs
S S V1 V1 d d V2 V2 c e f d c e, f d Advantages • 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. Interchangeability in CSPs
{c, d, e, f } V2 {d} V1 V4 V3 {a, b, d} {a, b, c} Full Interchangeability • Full Interchangeability (FI) • All constraints 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 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 {c, d, e, f } V2 {d} V1 V4 V3 {a, b, d} {a, b, c} 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 Interchangeability in CSPs
Building the DT • Let us work with an example on the board. Interchangeability in CSPs
S S S V1 V1 V1 d d d Static bundling V2 V2 V2 c e f d c e, f d c d, e, f Dynamic bundling Static versus Dynamic NI • Static: Bundles computed prior to search • Dynamic: Bundles computed during search Interchangeability in CSPs
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 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 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 Interchangeability in CSPs
Constraint Variable {1, 2, 3} {1, 2, 3, 4, 5, 6} C2 C1 {1, 2, 3} {1, 2, 3} C3 {1, 2, 3} C4 Non-binary CSPs • Informal introduction • Representation 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 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 Interchangeability in CSPs
V {1, 2} {1, 2} A {1, 3} {3} B {3} {3} C {3} No-good bundle {3} D Solution bundle 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 Interchangeability in CSPs
1200 First Bundle Size 1000 800 600 First Bundle Size # NV in FC 400 # NV in DynBndl 200 0 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 Tightness n = 20, a = 10 p2 = 0.25 c3 = 3 c4 = 2 Some results Interchangeability in CSPs
Maximum gains occur around phase-transition area n = 20, a = 10 2000 p2 = 0.25 c3 = 3 c4 = 2 1500 CPU time [ms] DynBndl 1000 FC 500 Overhead due to large FBS (upto 1200) at low tightness 0 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 Tightness Some results [2] Interchangeability in CSPs
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 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!! 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) Interchangeability in CSPs
Computing a bundle of R1.A R1 A B C Current bundle of R1.A = {1, 5} 1 12 23 Partition 1 13 23 1 14 23 Unequal partitions 2 10 25 Bundle {1, 5} Symmetric partitions 5 12 23 5 13 23 5 14 23 Interchangeability in CSPs