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

Slides:



Advertisements
Similar presentations
February 21, 2002 Simplex Method Continued
Advertisements

Thursday, March 7 Duality 2 – The dual problem, in general – illustrating duality with 2-person 0-sum game theory Handouts: Lecture Notes.
February 14, 2002 Putting Linear Programs into standard form
Graph of a Curve Continuity This curve is _____________These curves are _____________ Smoothness This curve is _____________These curves are _____________.
The Derivative in Graphing and Application
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Constraint Programming Peter van Beek University of Waterloo.
Maximal Independent Subsets of Linear Spaces. Whats a linear space? Given a set of points V a set of lines where a line is a k-set of points each pair.
Markov models and HMMs. Probabilistic Inference P(X,H,E) P(X|E=e) = P(X,E=e) / P(E=e) with P(X,E=e) = sum h P(X, H=h, E=e) P(X,E=e) = sum h,x P(X=x, H=h,
CS188: Computational Models of Human Behavior
ECBL: An Extended Corner Block List with Solution Space including Optimum Placement Shuo Zhou,Sheqin Dong, Xianlong Hong,Yici Cai Dept. of Computer Science.
Another example Max z=5x1+12x2+4x3-MR S.t. x1+2x2+x3+x4=10
Inverting a Singly Linked List Instructor : Prof. Jyh-Shing Roger Jang Designer : Shao-Huan Wang The ideas are reference to the textbook “Fundamentals.
Power Functions Lesson 9.1.
Constraint Satisfaction Problems Russell and Norvig: Chapter
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
10/7/2014 Constrainedness of Search Toby Walsh NICTA and UNSW
ZEIT4700 – S1, 2014 Mathematical Modeling and Optimization School of Engineering and Information Technology.
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
0 “Applications” of knapsack problems 10 September 2002.
Section 3.4 Objectives: Find function values
Global Constraints Toby Walsh National ICT Australia and University of New South Wales
Constraint Programming Toby Walsh UNSW and NICTA.
C&O 355 Lecture 5 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A.
1 Lecture 5 PRAM Algorithm: Parallel Prefix Parallel Computing Fall 2008.
16.410: Eric Feron / MIT, Spring 2001 Introduction to the Simplex Method to solve Linear Programs Eric Feron Spring 2001.
5 x4. 10 x2 9 x3 10 x9 10 x4 10 x8 9 x2 9 x4.
DIRECTIONAL ARC-CONSISTENCY ANIMATION Fernando Miranda 5986/M
Linear Programming – Simplex Method: Computational Problems Breaking Ties in Selection of Non-Basic Variable – if tie for non-basic variable with largest.
Variational Inference Amr Ahmed Nov. 6 th Outline Approximate Inference Variational inference formulation – Mean Field Examples – Structured VI.
Chapter 8: The Solver and Mathematical Programming Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
Computational Facility Layout
Section 3.4 The Traveling Salesperson Problem Tucker Applied Combinatorics By Aaron Desrochers and Ben Epstein.
(1) MAX X1+3X2+2X3+4X4 X1=AM PHONE, X2=AM RIDE, X3=AFT PHONE, X4=AFT RIDE CONSTRAINTS AM: X1+20X2 < 12(60)=720 AFT: 2X3+30X4 < 14(60) = 840 GAS: X2+X4.
Simplex (quick recap). Replace all the inequality constraints by equalities, using slack variables.
BINARY/MIXED-INTEGER PROGRAMMING ( A SPECIAL TYPE OF INTEGER PROGRAMMING)
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.
1 Cutting Plane Technique for Solving Integer Programs.
Graphs of Exponential and Logarithmic Functions
Sliding Constraints Toby Walsh National ICT Australia and University of New South Wales Joint work with Christian Bessiere, Emmanuel.
HELP ME WITH THE WEATHER REPORT. PRESS THE GREEN BUTTON TO START.
Matrix Modelling Alan M. Frisch and Ian Miguel (York) Brahim Hnich, Zeynep Kiziltan (Uppsala) Toby Walsh (Cork)
CAP 492 Course Dr. Souham Meshoul 1 CONSTRAINT SATISFACTION PROBLEMS Chapter 5.
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.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
What is the symmetry? f(x)= x 3 –x.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
Inverse Variation and Graphing
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
Maximum Density Still Life Symmetries and Lazy Clause Generation Geoffrey Chu, Maria Garcia de la Banda, Chris Mears, Peter J. Stuckey.
Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
Constraint Programming
South African Flag The South African flag contains the most colours of any national flag. Can you colour it in here? RED WHITE YELLOW WHITE BLACK GREEN.
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
Directional consistency Chapter 4
Constraint satisfaction problems
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

Value precedence ● Global constraint proposed to deal with value symmetry – Hot off the press! – Propagator first described here [ECAI 06] ● Good example of “global” constraint where we can use an efficient encoding – Encoding gives us GAC – Asymptotically optimal, achieve GAC in O(nd) time

Value symmetry ● Decision variables: – Col[Italy], Col[France], Col[Austria]... ● Domain of values: – red, yellow, green,... ● Constraints – binary relations like Col[Italy]=/=Col[France] Col[Italy]=/=Col[Austria] …

Value symmetry ● Solution: – Col[Italy]=green Col[France]=red Col[Spain]=green … ● Values (colours) are interchangeable: – Swap red with green everywhere will still give us a solution

Value symmetry ● Solution: – Col[Italy]=green Col[France]=red Col[Spain]=green … ● Values (colours) are interchangeable: – Col[Italy]=red Col[France]=green Col[Spain]=red …

Value precedence ● Old idea – Used in bin-packing and graph colouring algorithms – Only open the next new bin – Only use one new colour ● Applied now to constraint satisfaction

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1 – For X2, we need only consider two choices ● X2=1 or X2=2

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1 – For X2, we need only consider two choices – Suppose we try X2=2

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1 – For X2, we need only consider two choices – Suppose we try X2=2 – For X3, we need only consider three choices ● X3=1, X3=2, X3=3

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1 – For X2, we need only consider two choices – Suppose we try X2=2 – For X3, we need only consider three choices – Suppose we try X3=2

Value precedence ● Suppose all values from 1 to m are interchangeable – Might as well let X1=1 – For X2, we need only consider two choices – Suppose we try X2=2 – For X3, we need only consider three choices – Suppose we try X3=2 – For X4, we need only consider three choices ● X4=1, X4=2, X4=3

Value precedence ● Global constraint – Precedence([X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) for all j<k – In other words ● The first time we use j is before the first time we use k

Value precedence ● Global constraint – Precedence([X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) for all j<k – In other words ● The first time we use j is before the first time we use k – E.g ● Precedence([1,1,2,1,3,2,4,2,3]) ● But not Precedence([1,1,2,1,4])

Value precedence ● Global constraint – Precedence([X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) for all j<k – In other words ● The first time we use j is before the first time we use k – E.g ● Precedence([1,1,2,1,3,2,4,2,3]) ● But not Precedence([1,1,2,1,4]) – Proposed by [Law and Lee 2004] ● Pointer based propagator (alpha, beta, gamma) but only for two interchangeable values at a time

Value precedence ● Precedence([i,j],[X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) ● Of course – Precedence([X1,..Xn]) iff Precedence([i,j],[X1,..Xn]) for all i<j

Value precedence ● Precedence([i,j],[X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) ● Of course – Precedence([X1,..Xn]) iff Precedence([i,j],[X1,..Xn]) for all i<j – Precedence([X1,..Xn]) iff Precedence([i,i+1],[X1,..Xn]) for all i

Value precedence ● Precedence([i,j],[X1,..Xn]) iff min({i | Xi=j or i=n+1}) < min({i | Xi=k or i=n+2}) ● Of course – Precedence([X1,..Xn]) iff Precedence([i,j],[X1,..Xn]) for all i<j ● But this hinders propagation – GAC(Precedence([X1,..Xn])) does strictly more pruning than GAC(Precedence([i,j],[X1,..Xn])) for all i<j – Consider X1=1, X2 in {1,2}, X3 in {1,3} and X4 in {3,4}

Puget’s method ● Introduce Zj to record first time we use j ● Add constraints – Xi=j implies Zj <= i – Zj=i implies Xi=j – Zi < Zi+1

Puget’s method ● Introduce Zj to record first time we use j ● Add constraints – Xi=j implies Zj < I – Zj=i implies Xi=j – Zi < Zi+1 ● Binary constraints – easy to implement

Puget’s method ● Introduce Zj to record first time we use j ● Add constraints – Xi=j implies Zj < I – Zj=i implies Xi=j – Zi < Zi+1 ● Unfortunately hinders propagation – AC on encoding may not give GAC on Precedence([X1,..Xn]) – Consider X1=1, X2 in {1,2}, X3 in {1,3}, X4 in {3,4}, X5=2, X6=3, X7=4

Propagating Precedence ● Simple ternary encoding ● Introduce sequence of variables, Yi – Record largest value used so far – Y1=0

Propagating Precedence ● Simple ternary encoding ● Post sequence of constraints C(Xi,Yi,Yi+1) for each 1<=i<=n These hold iff Xi<=1+Yi and Yi+1=max(Yi,Xi)

Propagating Precedence ● Simple ternary encoding ● Post sequence of constraints ● Easily implemented within most solvers ● Implication and other logical primitives ● GAC-Schema (alias “table” constraint) ● …

Propagating Precedence ● Simple ternary encoding ● Post sequence of constraints – C(Xi,Yi,Yi+1) for each 1<=i<=n – This decomposition is Berge-acyclic – Constraints overlap on one variable and form a tree

Propagating Precedence ● Simple ternary encoding ● Post sequence of constraints – C(Xi,Yi,Yi+1) for each 1<=i<=n – This decomposition is Berge-acyclic – Constraints overlap on one variable and form a tree – Hence enforcing GAC on the decomposition achieves GAC on Precedence([X1,..Xn]) – Takes O(n) time – Also gives excellent incremental behaviour

Propagating Precedence ● Simple ternary encoding ● Post sequence of constraints – C(Xi,Yi,Yi+1) for each 1<=i<=n – These hold iff Xi<=1+Yi and Yi+1=max(Yi,Xi) – Consider Y1=0, X1 in {1,2,3}, X2 in {1,2,3} and X3=3

Precedence and matrix symmetry ● Alternatively, could map into 2d matrix – Xij=1 iff Xi=j ● Value precedence now becomes column symmetry – Can lex order columns to break all such symmetry – Alternatively view value precedence as ordering the columns of a matrix model

Precedence and matrix symmetry ● Alternatively, could map into 2d matrix – Xij=1 iff Xi=j ● Value precedence now becomes column symmetry ● However, we get less pruning this way – Additional constraint that rows have sum of 1 – Consider, X1=1, X2 in {1,2,3} and X3=1

Precedence for set variables ● Social golfers problem – Each foursome can be represented by a set of cardinality 4 – Values (golfers) within this set are interchangeable ● Value precedence can be applied to such set variables – But idea is now conceptually more complex!

Precedence for set variables ● We might as well start with X1={1,2,3}

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Now 1, 2, 3 and 4 are still symmetric

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={2,5,6,7}

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={2,5,6,7} ● But if we permute 1 with 2 we get – X1’={1,2,3,4} and X2’={1,5,6,7} – And X2’ is lower than X2 in the multiset ordering

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={1,5,6,7}

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={1,5,6,7} ● Let’s try X3={1,2,4,5}

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={1,5,6,7} ● Let’s try X3={1,2,4,5} ● But if we permute 3 with 4 we get – X1’={1,2,3,4}, X2’={1,5,6,7} and X3’={1,2,3,5} – This is again lower in the multiset ordering

Precedence for set variables ● We might as well start with X1={1,2,3,4} ● Let’s try X2={1,5,6,7} ● Let’s try X3={1,2,3,5} ● …

Precedence for set variables ● Precedence([S1,..Sn]) iff min(i, {i | j in Si & not(k in Si) or i=n+1}) < min(i, {i | k in Si & not(j in Si) or i=n+2}) for all j<k ● In other words – The first time we distinguish apart j and k (by one appearing on its own), j appears and k does not

Precedence for set variables ● Precedence([S1,..Sn]) iff min(i, {i | j in Si & not(k in Si) or i=n+1}) < min(i, {i | k in Si & not(j in Si) or i=n+2}) for all j<k ● To enforce BC – Consider 2d matrix, Xij=1 iff j in Si – This has column symmetry – Apply lex to this! – No longer row sum=1 and no loss in pruning

Precedence for set variables ● Precedence([S1,..Sn]) iff min(i, {i | j in Si & not(k in Si) or i=n+1}) < min(i, {i | k in Si & not(j in Si) or i=n+2}) for all j<k ● To enforce BC – Consider 2d matrix, Xij=1 iff j in Si – This has column symmetry – Apply lex to this! – {1} subseteq S1 subseteq {1,2}, S2={2}, S3={1,2,3}

Precedence for set variables ● Set variables may have cardinality information – E.g. every set variable has 4 values – Solvers often include finite domain variable for the cardinality of a set variable ● If we add such cardinality information, enforcing BC on Precedence([S1,..Sn]) is NP-hard! – More about this in the Complexity lecture

Partial value precedence ● Values may partition into equivalence classes ● Values within each equivalence class are interchangeable ● E.g. Shift1=nursePaul, Shift2=nursePeter, Shift3=nurseJane, Shift4=nursePaul..

Partial value precedence ● Values may partition into equivalence classes ● Values within each equivalence class are interchangeable ● E.g. Shift1=nursePaul, Shift2=nursePeter, Shift3=nurseJane, Shift4=nursePaul.. If Paul and Jane have the same skills, we might be able to swap them (but not with Peter who is less qualified) Shift1=nurseJane, Shift2=nursePeter, Shift3=nursePaul, Shift4=nurseJane …

Partial value precedence ● Values may partition into equivalence classe ● Value precedence easily generalized to cover this case – Within each equivalence class, vi occurs before vj for all i<j (ignore values from other equivalence classes)

Partial value precedence ● Values may partition into equivalence classe ● Value precedence easily generalized to cover this case – Within each equivalence class, vi occurs before vj for all i<j (ignore values from other equivalence classes) – For example ● Suppose vi are one equivalence class, and ui another

Partial value precedence ● Values may partition into equivalence classe ● Value precedence easily generalized to cover this case – Within each equivalence class, vi occurs before vj for all i<j (ignore values from other equivalence classes) – For example ● Suppose vi are one equivalence class, and ui another ● X1=v1, X2=u1, X3=v2, X4=v1, X5=u2

Partial value precedence ● Values may partition into equivalence classe ● Value precedence easily generalized to cover this case – Within each equivalence class, vi occurs before vj for all i<j (ignore values from other equivalence classes) – For example ● Suppose vi are one equivalence class, and ui another ● X1=v1, X2=u1, X3=v2, X4=v1, X5=u2 ● Since v1, v2, v1 … and u1, u2, …

Wreath value precedence ● Variables are assigned pair of values in D1 x D2 ● Values in D1 are interchangeable ● Given a fixed value in D1, values in D2 are interchangeable

Wreath value precedence ● Variables are assigned pair of values in D1 x D2 – Values in D1 are interchangeable – Given a fixed value in D1, values in D2 are interchangeable ● For example, – Scheduling a conference – Days of week might be interchangeable – Given a day of week, rooms might then be interchangeable

Wreath value precedence ● Variables are assigned pair of values in D1 x D2 – Values in D1 are interchangeable – Given a fixed value in D1, values in D2 are interchangeable ● For example, – Scheduling a conference – Session1=, Session2=, Session3= …

Wreath value precedence ● Variables are assigned pair of values in D1 x D2 – Values in D1 are interchangeable – Given a fixed value in D1, values in D2 are interchangeable ● For example, – Scheduling a conference – Session1=, Session2=, Session3= …

Wreath value precedence ● Variables are assigned pair of values in D1 x D2 – Values in D1 are interchangeable – Given a fixed value in D1, values in D2 are interchangeable ● Value precedence again generalizes to this case min(i, {Xi[1]=uj or i=n+1}) < min(i, {Xi[1]=uj+1 or i=n+2}) and min(i, {Xi=(uj,vk) or i=n+1}) < min(i, {Xi=(uj,vk+1) or i=n+2})

Variable and value precedence ● Value precedence compatible with other symmetry breaking methods – Interchangeable values and lex ordering of rows and columns in a matrix model

Variable and value precedence ● Value precedence compatible with other symmetry breaking methods – Interchangeable values and lex ordering of rows and columns in a matrix model – Interchangeable values and variables ● But does not break all symmetry ● Consider [1.2,2] and [1,1,2] ● Use instead IncreasingSeq([X1,…Xn]) ● Values and number of occurrences increase

Variable and value precedence ● Value precedence compatible with other symmetry breaking methods – Interchangeable values and lex ordering of rows and columns in a matrix model – Interchangeable values and variables ● But does not break all symmetry ● Consider [1.2,2] and [1,1,2] ● Use instead IncreasingSeq([X1,…Xn]) ● Values and number of occurrences increase – Interchangeable values and rotation symmetry on variables ● But does not break all symmetry: [1,1,2,1,2] and [1,2,1,2,2]

Conclusions ● Symmetry of interchangeable values can be broken with value precedence constraints ● Value precedence can be decomposed into ternary constraints – Efficient and effective method to propagate ● Closely related to lex ordering columns – But combines row sum=1 ● Can be generalized in many directions – Partial interchangeability – Set variables – …