1 / 21

Global Constraints

Toby Walsh National ICT Australia and University of New South Wales www.cse.unsw.edu.au/~tw. Global Constraints . Course outline. Introduction All Different Lex ordering Value precedence Complexity GAC-Schema Soft Global Constraints Global Grammar Constraints Roots Constraint

cindy
Télécharger la présentation

Global Constraints

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Toby Walsh National ICT Australia and University of New South Wales www.cse.unsw.edu.au/~tw Global Constraints

  2. Course outline • Introduction • All Different • Lex ordering • Value precedence • Complexity • GAC-Schema • Soft Global Constraints • Global Grammar Constraints • Roots Constraint • Range Constraint • Slide Constraint • Global Constraints on Sets

  3. GAC Schema • Not all global constraints have nice semantics we can exploit to devise an efficient propagator • Consider product configuration • Compatibility constraints on hardware components • Only certain combinations of components work together • Compatibility may not be a simple pairwise relationship • Video cards supported function of motherboard, CPU, clock speed, O/S ..

  4. GAC Schema 5-ary global constraint: • Compatible(motherboard345,intelCPU,2GHz,1GBRam,80GBdrive) • Compatible(motherboard346,intelCPU,3GHz,2GBRam,100GBdrive) • Compatible(motherboard346,amdCPU,2GHz,2GBRam,100GBdrive) • …

  5. Crossword puzzle Word([X1,X2,X3,X4]) Word([X2,X15,X17]) … No simple way to decide acceptable words other than to put them in a table

  6. GAC schema • Generic propagator • Enforces GAC on global constraint given by • Set of allowed tuples OR • Set of disallowed tuples OR • Predicate answering if a constraint is satisfied or not • .. • Sometimes called the “table” constraint (e.g. user supplies table of acceptable values)

  7. GAC-Schema • Bessiere and Regin, IJCAI’97 • You just have to say how to compute a solution. • Works incrementally (notion of support) • Keeps supports found to save re-finding them • Exploits multi-directionality • If we find support for X=a and this contains Y=b • Then we automatically have a support for Y=b

  8. GAC-Schema • Idea: tuple = solution of the constraintsupport = valid tuple- while the tuple remains: do nothing - if the tuple is no longer possible, then search for a new support for the values it contains • a solution (support) can be computed by any algorithm

  9. Example • X(C)={x1,x2,x3} D(xi)={a,b} • T(C)={(a,a,a),(a,b,b),(b,b,a),(b,b,b)}

  10. Example • X(C)={x1,x2,x3} D(xi)={a,b} • T(C)={(a,a,a),(a,b,b),(b,b,a),(b,b,b)} • Support for (x1,a): (a,a,a) is computed and (a,a,a) is added to S(x2,a) and S(x3,a), (x1,a) in (a,a,a) is marked as supported.

  11. Example • X(C)={x1,x2,x3} D(xi)={a,b} • T(C)={(a,a,a),(a,b,b),(b,b,a),(b,b,b)} • Support for (x1,a): (a,a,a) is computed and (a,a,a) is added to S(x2,a) and S(x3,a), (x1,a) in (a,a,a) is marked as supported. • Support for (x2,a): (a,a,a) is in S(x2,a) it is valid, therefore it is a support. (Multidirectionnality). No need to compute a solution

  12. Example • X(C)={x1,x2,x3} D(xi)={a,b} • T(C)={(a,a,a),(a,b,b),(b,b,a),(b,b,b)} • Support for (x1,a): (a,a,a) is computed and (a,a,a) is added to S(x2,a) and S(x3,a), (x1,a) in (a,a,a) is marked as supported. • Value a is removed from x1, then all the tuples in S(x1,a) are no longer valid: (a,a,a) for instance. The validity of the values supported by this tuple must be reconsidered.

  13. Example • X(C)={x1,x2,x3} D(xi)={a,b} • T(C)={(a,a,a),(a,b,b),(b,b,a),(b,b,b)} • Support for (x1,a): (a,a,a) is computed and (a,a,a) is added to S(x2,a) and S(x3,a), (x1,a) in (a,a,a) is marked as supported. • Support for (x1,b): (b,b,a) is computed, and updated ...

  14. GAC-Schema: complexity • In worst case, GAC schema enforces GAC in • O(d^k) time and • O(k^2d) space • Hence, k cannot be too large! • ILOG Solver limits it to 3 or so • Recall want local consistency to be O(d^2) or less • Hence all this work on specialized propagators that exploit the constraint semantics to be faster than O(d^k) for k>3

  15. Exploiting constraint semantics • Speed-up the search for a support

  16. Exploiting constraint semantics • Speed-up the search for a support • x < y, D(x)=[0..10000], D(y)=[0..10000] • support for (x,9000) • immediate any value greater than 9000 in D(y)

  17. Semantics of a constraint • Design of an ad-hoc filtering algorithm:x < y : • Two invariants (a) max(x) = max(y) -1(b) min(y) = min(x) +1

  18. Exploiting constraint semantics • Design of an ad-hoc filtering algorithm:x < y : • Two invariants (a) max(x) = max(y) -1(b) min(y) = min(x) +1 • Triggering of the filtering algorithm:no possible pruning of D(x) while max(y) is not modifiedno possible pruning of D(y) while min(x) is not modified

  19. Building constraint propagators • When to wake constraint? • Only want this to happen when it is likely to prune • When any domain changes? • When upper bound changes? • … • When is a constraint no longer useful? • If a constraint is logically entailed, it can no longer prune • Never want it to wake up • Set flag and ignore till backtrack out of this point

  20. Building constraint propagators • How to avoid re-doing work? • When constraint re-awakes, how do we re-build all the data structures it needs • Remember the network flow for the GCC constraint or the Hall intervals in the AllDifferent constraint • Remember the pointers used in the LEX constraint to avoid re-traversing the vectors

  21. Conclusions • GAC Schema is a generic propagator for global constraints • Useful when constraints lacks any special semantics we can exploit • Time complexity is O(d^k) in general where k is the constraint arity • Only useful than for relatively small k • Useful nevertheless for product configuration and other real world domans

More Related