20
Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

  • View
    336

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Consistency & Propagation with Multiset Constraints

Toby Walsh4C, UCC & Uppsala

Page 2: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Outline

Multiset varsvars which take a multiset (or bag) of values

Representing multiset vars Consistency of multiset vars Global constraints over multiset vars Conclusions

Page 3: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Multiset variables

Assigned a multiset or bag of values Useful in design & configuration

E.g. template design (prob002 in CSPLib)

Multiset of labels on each printing template:

{{tuna, tuna, tuna, chicken, liver, liver}}

Page 4: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Multiset variables

Assigned a multiset or bag of values Useful in design & configuration

E.g. ILOG’s ConfiguratorMultiset of components in home cinema system: {{plasma screen, DVD, amplifier, speaker, speaker, speaker, speaker, woofer}}

Page 5: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Representing multiset vars

Naïve, explicit representation Finite domain of all possible multisets BUT exponential

More compact (but less expressive) Bounds Occurrences Fixed cardinality

Page 6: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Bounds representation

Upper and lower bounds on multiset Lower bound = must contain Upper bound = can contain

E.g lb is {{DVD, speaker, speaker}}

ub is {{DVD, plasma, TV, satellite dish, amplifier, speaker, speaker, speaker, speaker, woofer}}

Similar bounds representationused for set vars in [Gervet 97]

Page 7: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Occurrence representation

Integer variable representing #occurrences of each value

E.g. DVD = {1}, Plasma={0,1}, Speaker={2,3,4}, Woofer={0,1}, …

Page 8: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Fixed cardinality representation

For multisets with fixed (or bounded) cardinality

Finite-domain variable for each element in the multiset Introduce “don’t care” value if needed E.g. M1=M2=M3= … = {Video, DVD, plasma,

TV, speaker, woofer, satellite}

Page 9: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Expressivity

Disjunctive choice cannot be fully expressed E.g. none of the 3 can represent just:

{{0,0,0}} or {{1,1,1}}

Nested multisets are also problematic Especially for occurrence representation

Page 10: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Consistency

Central notion in CP How do we define it

for multiset vars? Also for mixed

constraints containing multiset, set and/or integer vars?

Slogan of the local Beamish brewery:“Consistency in a world gone mad”

Page 11: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Consistency

Set of solutions for a var in a constraint C Sol(Xi) = {di | C(d1,..,dn)}

C is bounds consistent iff Sol(Xi) ≠ {} For each (multi)set var

lub(Xi)= di, glb(Xi)= di where di Sol(Xi) For each integer var

lub(Xi)=max(di), glb(Xi)=min(di) where di Sol(Xi)

Page 12: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Bounds consistency

Representation doesn’t matter BC on bounds representation is equivalent to usual notion of BC on occurrence

Existence of BC domains

If problem has solution, there exist unique lub and glb that makes constraints BC

Page 13: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Multiset constraints

Simple predicates XY, XY, X=Y, XY, |X|=N, occ(N,X)=M, … Arguments can be multiset or set expressions

Var, ground multiset or set XY, XY, X-Y, …

Global constraints disjoint(X1,..,Xn), partition(X1,…,Xn,X), …

Page 14: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Normal form

Multiset constraints can be put in simple normal form Each constraint is at most ternary E.g. (XY)Z W is transformed to

S=XY, T=SZ, T W

Propagation algorithms therefore only need deal with a limited class of constraints

Similar to normal form used with sets vars in [Gervet 97]

Page 15: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Normal form

Normalization hurts propagation BC on arbitrary set of constraints is strictly

stronger than BC on normalized form

But not always BC on normalized form is equivalent if there

are no repeated variables

Page 16: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Global constraints

Important aspect of (finite-domain) CP Identify common patterns Efficient and effective propagators

Decomposition usually hurts E.g. all-different = clique of not-equals GAC(all-different) > AC(not-equals)

Page 17: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Global multiset constraints

Decomposition does not always hurt BC(disjoint(X1,..,Xn) = BC(Xi Xj={}) BC(partition(X1,..,Xn,X)=BC(Xi Xj={}) &

BC(Xi .. Xn = X)

But can on other global constraints non-empty partition distinct(X1,..,Xn) iff Xi ≠ Xj for all i<j

Page 18: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

Future directions

Multiset OPL Extend OPL to support

set and multiset vars Compile down into OPL

using occurrence or fixed cardinality representations (or both)

Global constraint propagators distinct, non-empty

partition, …

Page 19: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

What do you take home?

Representing multiset vars Bounds, occurrence and

fixed cardinality Consistency of multiset vars

Containing multiset, set and integer vars

Global constraints over multiset vars Decomposition does not

always hurt

Page 20: Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala

What’s the bigger picture?

Why stop with multisets? Strings [Golden & Pang,

CP03] Fri 10.15 Sequences Trees …

Why should CP have only fixed variable types? Abstract variable types