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

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Constraint Programming Peter van Beek University of Waterloo.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Propositional Satisfiability (SAT) Toby Walsh Cork Constraint Computation Centre University College Cork Ireland 4c.ucc.ie/~tw/sat/
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh NICTA and University of New South Wales
10/7/2014 Constrainedness of Search Toby Walsh NICTA and UNSW
Modelling & Solving with Constraints Prof. Toby Walsh University College Cork/Uppsala University.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh NICTA and University of New South Wales
1 P, NP, and NP-Complete Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
Problems and Their Classes
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Constraint Programming Toby Walsh UNSW and NICTA.
Sep 15, 2014 Lirong Xia Computational social choice The easy-to-compute axiom.
Maintaining Arc Consistency We have a constraint graph G of variables X 1,...X n, and constraint relations {X i  X j}, and each Xi has a value set V (X.
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Max Cut Problem Daniel Natapov.
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala.
1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC.
The Theory of NP-Completeness
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
Global Constraints for Lexicographic Orderings Alan Frisch, Ian Miguel (University of York) Brahim Hnich, Toby Walsh (4C) Zeynep Kiziltan (Uppsala University)
Global Grammar Constraints Toby Walsh National ICT Australia and University of New South Wales Joint work with Claude-Guy Quimper.
Complexity Classes Kang Yu 1. NP NP : nondeterministic polynomial time NP-complete : 1.In NP (can be verified in polynomial time) 2.Every problem in NP.
Symmetry Breaking Ordering Constraints Zeynep Kiziltan Department of Information Science Uppsala University, Sweden A progress.
Entrance Slip: Quadratics 1)2) 3)4) 5)6) Complete the Square 7)
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
Preferences Toby Walsh NICTA and UNSW
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Incompleteness and incomparability in preference aggregation: complexity results M. Silvia Pini*, Francesca Rossi*, K. Brent Venable*, and Toby Walsh**
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
Automatic Test Generation
P & NP.
Chapter 10 NP-Complete Problems.
Constraint Programming
Chih-Fan Lai1, J.-H. Roland Jiang1, and Kuo-Hua Wang2
Consistency Methods for Temporal Reasoning
On the Complexity of Buffer Allocation in Message Passing Systems
SAT-Based Area Recovery in Technology Mapping
Constraints and Search
Richard Anderson Lecture 28 NP Completeness
NP-Complete Problems.
Constraint Satisfaction Problems
Constraints and Search
Constraint Satisfaction Problems. A Quick Overview
CSE 6408 Advanced Algorithms.
CS21 Decidability and Tractability
The Polynomial Hierarchy Enumeration Problems 7.3.3
RAIK 283 Data Structures & Algorithms
Consistency algorithms
Presentation transcript:

Global Constraints Toby Walsh National ICT Australia and University of New South Wales

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

Global constraints ● Hardcore algorithms – Data structures – Graph theory – Flow theory – Combinatorics – … ● Computational complexity – Global constraints are often balanced on the limits of tractability!

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

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

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

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!

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!

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!

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) – …

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

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”

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)

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

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!

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

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<j ● Since it is polynomial to propagate this decomposition – Decomposition hinders propagation (assuming P≠NP)

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}

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}

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

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?

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 …

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

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

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’ –..

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

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 –..