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

Slides:



Advertisements
Similar presentations
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Advertisements

Non-binary Constraints Toby Walsh
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
Course Summary What have we learned and what are we expected to know?
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
Global Constraints Toby Walsh NICTA and University of New South Wales
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Constraint Programming Toby Walsh UNSW and NICTA.
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
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
Interactive Configuration
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.
Non-binary constraints: modelling Toby Walsh Cork Constraint Computation Center.
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
/425 Declarative Methods - J. Eisner1 Constraint Programming.
Consistency & Propagation with Multiset Constraints Toby Walsh 4C, UCC & Uppsala.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Soft constraints. Classical (hard) Constraints Variables {X 1,…,X n }=X Variables {X 1,…,X n }=X Domains {D(X 1 ),…,D(X n )}=D Domains {D(X 1 ),…,D(X.
Global Grammar Constraints Toby Walsh National ICT Australia and University of New South Wales Joint work with Claude-Guy Quimper.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic Range Allocation.
Introduction to Job Shop Scheduling Problem Qianjun Xu Oct. 30, 2001.
Chapter 3 Functions Functions provide a means of expressing relationships between variables, which can be numbers or non-numerical objects.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
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.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Chapter 5 Constraint Satisfaction Problems
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
1 Chapter 3: Finite Constraint Domains Where we meet the simplest and yet most difficult constraints, and some clever and not so clever ways to solve them.
G51IAI Introduction to Artificial Intelligence
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 9: Test Generation from Models.
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,
Lecture 9: Query Complexity Tuesday, January 30, 2001.
1 Chapter 1: Constraints What are they, what do they do and what can I use them for.
© 2012 IBM Corporation Perfect Hashing and CNF Encodings of Cardinality Constraints Yael Ben-Haim Alexander Ivrii Oded Margalit Arie Matsliah SAT 2012.
Automatic Test Generation
P & NP.
XML: Extensible Markup Language
Constraint Programming
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
Recovering and Exploiting Structural Knowledge from CNF Formulas
Hard Problems Introduction to NP
Corky Cartwright January 18, 2017
CS21 Decidability and Tractability
Lecture 24 NP-Complete Problems
Richard Anderson Lecture 28 NP-Completeness
Chapter 3: Finite Constraint Domains
Richard Anderson Lecture 28 NP Completeness
Finite Model Theory Lecture 6
NP-Complete Problems.
Constraints and Search
Chapter 3: Finite Constraint Domains
Richard Anderson Lecture 26 NP-Completeness
CS21 Decidability and Tractability
Constraint satisfaction problems
CS21 Decidability and Tractability
Richard Anderson Lecture 27 Survey of NP Complete Problems
Social Practice of the language: Describe and share information
CS 8520: Artificial Intelligence
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

ROOTS and RANGE ● Large catalog of global constraints – but very little taxonomy? – global grammar constraints specify a “family” of useful global constraints ● ROOTS and RANGE let us define many counting and occurrence constraints

Counting and Occurrence Constraints ● Many (resource bounded) optimization & decision problems contain: – occurrence constraints (on values that occur)

Counting and Occurrence Constraints ● Many (resource bounded) optimization & decision problems contain: – occurrence constraints (on values that occur) – E.g. the value “Thur 3-5pm” should occur once in the timetable of any PhD student following the course on global constraints

Counting and Occurrence Constraints ● Many (resource bounded) optimization & decision problems contain: – counting constraints (on number of vals or vars satisfying a condition)

Counting and Occurrence Constraints ● Many (resource bounded) optimization & decision problems contain: – counting constraints (on number of vals or vars satisfying a condition) – E.g. the value “night shift” can be used by at most 3 variables in any 7!

Using ROOTS and RANGE ● Simple, declarative language for specifying many counting & occurrence constraints ● two new primitives: ● ROOTS and RANGE global constraints ● Executable language ● propagate primitives ● need just to provide propagators within the constraint solver for ROOTS and RANGE

Specification language ● Based around properties of functions – consider sequence of vars X1,..,Xn each taking a value in a D – then one view of X1,..,Xn is a function: X : [1,n] -> D – For example X1=a, X2=b, X3=a …

Specification language ● Based around properties of functions – consider sequence of vars X1,..,Xn each taking a value in a D – then one view of X1,..,Xn is a function: X : [1,n] -> D – For example X1=a, X2=b, X3=a … X(1)=a, X(2)=b, X(3)=a …

Specification language ● Based around properties of functions – consider sequence of vars X1,..,Xn each taking a value in a D – then one view of X1,..,Xn is a function: X : [1,n] -> D – This view is useful for specifying global constraints – NV ALUES ([X1,..,Xn],N) is equivalent to |R ANGE (X)|=N

R ANGE constraint ● Restricts range of function to a given subset – R ANGE ([X1,..,Xn],S,T) iff X(S)=T [1,n] ST

R ANGE constraint ● Restricts range of function to a given subset – R ANGE ([X1,..,Xn],S,T) iff X(S)=T e.g. RANGE([1,3,1,2,5],{2,4,5},{2,3,5}) [1,n] ST

R ANGE constraint ● Restricts range of function to a given subset – R ANGE ([X1,..,Xn],S,T) iff X(S)=T – useful to describe values used (when values are resources) – Some examples ● RANGE([X1,..Xn],{1,..n},T) and |T|=N is NValues ● RANGE([X1,..Xn],{1,..n},T) and |T|=n is AllDifferent ● …

R ANGE constraint ● RANGE constraint involves both finite- domain variables (X1,..,Xn) and set variables(S,T) – to describe propagation, need to define new type of local consistency – hybrid consistency is a local consistency property for global constraints involving both finite domain and set variables

Hybrid Consistency ● Constraint is “hybrid consistent (HC) – for each a in dom(X), there is a support – each a in ub(S) appears in one support – each a in lb(S) appears in all supports ● Reduces to GAC on finite domain vars,and BC on set vars

Hybrid Consistency ● Constraint is “hybrid consistent (HC) – for each a in dom(X), there is a support – each a in ub(S) appears in one support – each a in lb(S) appears in all supports ● Consider RANGE([X1,..X4],S,T) where – X1,X2 in {1,2,5}, X3 in {3,4} and X4 in {1} – {4} subseteq S subseteq {1,2,3,4} – {} subseteq T subseteq {1,2}

R ANGE constraint ● Restricts range of function to a given subset – R ANGE ([X1,..,Xn],S,T) iff X(S)=T ● Polynomial to make HC – O( nd+nt^3/2 ) where d=max(dom(Xi)) and t=|lb(T)|

R OOTS constraint ● Restricts domain to those mapping to a given subset – R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) [1,n] ST

R OOTS constraint ● Restricts domain to those mapping to a given subset – R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – E.g. ROOTS([3,1,2,3,0],{1,4,5},{0,3}) [1,n] ST

R OOTS constraint ● Restricts domain to those mapping to a given subset – R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – E.g. RANGE([3,1,2,3,0],{1,5},{0,3}) [1,n] ST

R OOTS constraint ● Restricts domain to those mapping to a given subset – R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) ● Useful to describe variables using particular values ● An example – R OOTS ([X1,..,Xn],S,{d1,..,dm}) & |S|=N is AMONG constraint

R OOTS constraint ● Restricts domain to those mapping to a given subset – R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – NP-hard to make HC – but O( nd ) when Xi or T are ground (all cases here!)

R OOTS constraint ● R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – Reduction from 3SAT in N vars and M clauses ● n=N+M ● Xi in {i,-i} for 1<=i<=N – Xi = i iff xi is false

R OOTS constraint ● R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – Reduction from 3SAT in N vars and M clauses ● n=N+M ● Xi in {i,-i} for 1<=i<=N ● XN+j in {i,-k,l} iff jth clause is (xi or -xk or xl)

R OOTS constraint ● R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – Reduction from 3SAT in N vars and M clauses ● n=N+M ● Xi in {i,-i} for 1<=i<=N ● XN+j in {i,-k,l} iff jth clause is (xi or -xk or xl) ● {} subseteq T subsetqe Union_i {i, -i}

R OOTS constraint ● R OOTS ([X1,..,Xn],S,T) iff S=X -1 (T) – Reduction from 3SAT in N vars and M clauses ● n=N+M ● Xi in {i,-i} for 1<=i<=N ● XN+j in {i,-k,l} iff jth clause is (xi or -xk or xl) ● {} subseteq T subseteq Union_i {i, -i} ● S={N+1, … N+M}

Specification language ● Equalities and inequalities – X≤ N, X=N,... ● Set constraints – S subseteq T, |S|=N,... ● Two global constraints – R OOTS and R ANGE

Some examples ● A LL D IFFERENT ([X1,..,Xn]) iff R ANGE ([X1,..,Xn],{1,..,n},T) & |T|=n – unfortunately enforcing HC on decomposition does not make A LL D IFFERENT constraint GAC ● E.g. X1, X2 in {1,2}, X3 in {1,2,3,4} ● {1,2} subseteq T subseteq {1,2,3,4} – so sometimes worth developing specialized propagators

Some examples ● P ERMUTATION ([X1,..,Xn]) iff R ANGE ([X1,..,Xn],{1,..,n},{1,..,n}) – special case of A LL D IFFERENT – clearly enforcing HC on “decomposition” makes constraint GAC – so sometimes this specification language is a good way to implement specific global constraints

Some examples ● NV ALUES ([X1,..,Xn,N]) – |{Xi | 1≤i≤n }|=N – R ANGE ([X1,..,Xn],{1,..,n},T) & |T|=N – enforcing HC on decomposition does not enforce GAC on NV ALUES – but this is to be expected as it is NP-hard to do so! – one way (at least) to implement this global constraint

Some examples ● A MONG ([X1,..,Xn],[d1,..,dm],N) – |{i | Xi=dj }|=N – R OOTS ([X1,..,Xn],S,{d1,..,dm}) & |S|=N – enforcing HC on decomposition enforces GAC on A MONG – again example of where specification language is a good way to implement a specific global constraint

Some examples ● C OMMON (N,M,[X1,..,Xn],[Y1,..,Ym]) – |{i | ∃ j. Xi=Yj }|=N and |{j | ∃ i. Xi=Yj }|=M R ANGE ([Y1,..,Ym],{1,..m},T) & R OOTS ([X1,..,Xn],S,T) & |S|=N & R ANGE ([X1,..,Xn],{1,..n},V) & R OOTS ([Y1,..,Yn],U,V) & |U|=M

Some examples ● C OMMON (N,M,[X1,..,Xn],[Y1,..,Ym]) – |{i | ∃ j. Xi=Yj }|=N and |{j | ∃ i. Xi=Yj }|=M Enforcing HC on decomposition does not enforce GAC on C OMMON – but to be expected as NP-hard to do so!

Some examples ● LINKSET2BOOLEANS(S,[B1,..Bn]) holds iff Bi=j iff j in S ● ROOTS([B1,..Bn],S,{1}) ● Decomposition clearly does not hinder propagation ● ROOTS is polynomial to enforce HC

Some examples ● NOTALLEQUAL([X1,..Xn]) ● Nasty large disjunction ● RANGE([X1,..Xn],{1,..n},T) & |T|>1

Other examples G CC S YM A LL D IFFERENT E LEMENT D OMAIN C ONTIGUITY ●... Whilst we can express many such global constraints, not all give effective propagators (e.g. GCC).

Global grammar constraints ● Filtering algorithms from finite sized automata/membership of a regular language – How do they compare? ● Such approaches are complementary – these automata can specify C ONTIGUITY – but not P ERMUTATION

Conclusions ● Counting and Occurrence constraints can be specified using simple declarative language – needs two new global constraints: ROOTS and RANGE ● Efficient and effective means to implement a number of such constraints: – when propagating specification achieves GAC – or constraint is NP-hard to propagate – however, we may still need to design a specialized propagator (e.g. gcc)