Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Global Constraints Toby Walsh National ICT Australia and University of New South Wales www.cse.unsw.edu.au/~tw."— Presentation transcript:

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

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 Global constraints ● Hardcore algorithms – Data structures – Graph theory – Flow theory – Combinatorics – … ● Computational complexity – Global constraints are often balanced on the limits of tractability!

4 Global constraints are NP-hard ● Can solve 3SAT using a single global constraint! – Given 3SAT problem in N vars and M clauses – 3SAT([X1,…Xn]) where n=N+3M+2 – Constraint holds iff X1=N, X2=M, – X_2+i is 0/1 representing value assigned to xi – X_2+N+3j, X_2+N+3j+1 and X_2+N+3j+2 represents jth clause

5 Our hammer ● Use tools of computational complexity to study global constraints

6 Limits of Global Constraints Also study limits of reasoning with symmetries, nogoods, meta-constraints like cardinality ● Enforce lesser consistency ● Constraints cannot be combined ● Constraints cannot be generalized ● Decomposition will hurt pruning

7 Questions to ask? ● GACSupport? is NP-complete – Does this value have support? – Basic question asked within many propagators ● MaxGAC? is DP-complete – Are these domains the maximal generalized arc- consistent domains? – Termination test for a propagator – DP = NP u coNP – Propagation “harder” than solving the problem!

8 Questions to ask? ● IsItGAC? is NP-complete – Are the domains GAC? – Wakeup test for a propagator ● NoGACWipeOut? is NP-complete – If we enforce GAC, do we not get a wipeout? – Used in many reductions ● GACDomain? is NP-hard – Return the maximal GAC domains – What a propagator actually does!

9 Relationships between questions ● NoGACWipeOut = GACSupport = GACDomain – NoGACWipeOut in P GACDomain in P – NoGACWipeOut in NP GACDomain in NP ● GACDomain in P => MaxGAC in P => IsItGAC in P ● IsItGAC in NP => MaxGAC in NP => GACDomain in NP – Open if arrows cannot be reversed!

10 Constraints in practice ● Some constraints proposed in the past are intractable – NValues(N,X1,..Xn) – AtMost1(S1,..,Sn) – Card([C1,..,Cn],N) – CardPath(N,[X1,..,Xn],C) – …

11 NValues ● NValues(N,X1,..,Xm) – N values used in X1,…,Xm – Useful for resource allocation

12 NValues ● NValues(Y,X1,..,Xn) ● Reduction of 3SAT to NValues – 3SAT problem in N vars, M clauses – Xi in {i,-i} for 1 ≤ i ≤ N – XN+s in {i,-j,k} if s-th clause is: (i or -j or k) – Y= N – Hence 3SAT has a solution => NoGACWipeOut answers “yes”

13 NValues ● NValues(N,X1,..,Xm) ● Reduction of 3SAT to NValues – 3SAT problem in n vars, l clauses – Xi in {i,-i} for 1 ≤ i ≤ n – Xn+s in {i,-j,k} if s-th clause is: (i or -j or k) – N = n – Hence 3SAT has a solution NoGACWipeOut answers “yes” – Enforce lesser level of local consistency (e.g. BC)

14 Composing constraints ● Take some tractable constraints – E.g. Intersect(S1,…,Sn,k), |S1|=c,…,|Sn|=c ● Could we combine them? – E.g. FixedCardIntersect(S1,…,Sn,k,c) – No, NP-hard to enforce BC! – AtMost1 with cardinality bounds on set variables is FixedCardIntersect Used in social golfers problem

15 Generalizing constraints ● Take a tractable constraint – GCC([X1,..,Xn],[l1,..,lm],[u1,..,um]) – Value j occurs between lj and uj times in X1,..,Xn ● Generalize some constants to variables – E.g. GCC([X1,..,Xn],[O1,..,Om]) – NP-hard to enforce GAC!

16 Generalizing constraints ● GCC([X1,..,Xn],[O1,..,Om]) ● Reduction from 1in3SAT on positive clauses ● If jth clause is (x or y or z) then Xj in {x,y,z} ● If x occurs k times in all clauses then Ox in {0,k} ● Hence 1in3SAT has a solution iff NoGACWipeOut answers “yes” ● Thus enforcing GAC is NP-hard

17 Decomposing constraints ● Consider a global constraint that is NP-hard to propagate – E.g. AtMost1(S1,…,Sn) with cardinality constraint on sets ● Decompose into polynomial number of constraints – |Si intersect Sj| ≤ 1 for all i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/2436326/8/slides/slide_16.jpg", "name": "Decomposing constraints ● Consider a global constraint that is NP-hard to propagate – E.g.", "description": "AtMost1(S1,…,Sn) with cardinality constraint on sets ● Decompose into polynomial number of constraints – |Si intersect Sj| ≤ 1 for all i

18 Decomposing constraints ● Consider a global constraint that is NP-hard – E.g. AtMost1(S1,…,Sn) – BC on sets = GAC on characteristic function – Reduction from 3SAT – Sets have cardinality = 2 – If jth clause is x or -y or z, introduce – {mj} subseteq Sj subseteq {mj, xj, -yj, zj} – Sj = {mj, xj} if x satisfied jth clause – Suppose kth clause contains -x, introduce two set vars – {mj} subseteq Tjk subseteq {mj, xj, -xk} – {-xk} subseteq Ujk subseteq {mj, mk, -xk}

19 Decomposing constraints ● Consider a global constraint that is NP-hard – E.g. AtMost1(S1,…,Sn) – BC on sets = GAC on characteristic function – Reduction from 3SAT – Sets have cardinality = 2 – If jth clause is x or -y or z, introduce – {mj} subseteq Sj subseteq {mj, xj, -yj, zj} – Sj = {mj, xj} if x satisfied jth clause – Suppose kth clause contains -x, introduce two set vars – {mj} subseteq Tjk subseteq {mj, xj, -xk} – {-xk} subseteq Ujk subseteq {mj, mk, -xk} – Tjk={mj,-xk}, Ujk={mk,-xk} and Sk/={mk,xk}

20 Symmetry breaking ● Symmetry is a major problem – Symmetric machines, symmetric orders… ● Often matrix of decision vars – Row and Cols symmetric

21 Symmetry breaking ● Add (global) constraints to eliminate symmetries – Prune symmetric branches of search tree – E.g. lex order rows, lex order cols ● Can we break all row & col symmetry this way?

22 Symmetry breaking ● Add (global) constraints to eliminate symmetries – Prune symmetric branches of search tree – E.g. lex order rows, lex order cols ● Can we break all row & col symmetry this way? ● Suppose we had a global constraint that broke all row and column symmetry – Enforcing GAC on such a constraint is NP-hard – Actually coNP-hard …

23 Meta-constraints ● Put together existing constraints – Card(N,[C1,…,Cm]) iff N of C1,..Cm are satisfied – implements conjunction, disjunction, negation … ● conjunction is N=m ● disjunction is N>0 ● negation is N=0 and m=1 ● But NP-hard to propagate – Typically delayed in most solvers

24 Meta-constraints ● Special case of Card is CardPath ● Useful for sequencing problems ● CardPath(C,[X1,..Xn],N) iff C(Xi,..Xi+k) holds N times – E.g. number of changes is CardPath(=/=,[X1,..Xn],N) ● Fixed parameter tractable – k fixed, GAC takes O(nd^k) time – k = O(n), GAC is NP-hard even when C is polynomial to test

25 Meta-constraints ● CardPath(C,[X1,..Xn],N) iff C(Xi,..Xi+k) holds N times – Reduce 3SAT in N variables and M clauses to CardPath where k=N+2 – NM vars Xi to represent repeated truth assignment – M vars Yj to represent jth clause – C(X1,..,XN,Yj,X1’) iff Yj=k and Xk=1 and X1=X1’ or Yj=-k and Xk=0 and X1=X1’ – C(X2,..,XM.Yj,X1’,X2’) iff X2=X2’ –..

26 Learning ● Arc-consistency is essentially learning (unary) nogoods ● Same tools apply to learning – NoGood? is coNP-complete – MinimalNoGood? is DP- complete

27 Conclusions ● Computational complexity is a useful hammer to study global constraints ● Uncovers fundamental limits of reasoning with global constraints – Lesser consistency needs to be enforced – Decomposition hurts pruning – Composition intractable – Generalization intractable –..


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

Similar presentations


Ads by Google