©2007 Tarik Hadzic1 Lecture 11: Consistency Techniques 1. Arc Consistency 2. Directional Consistency 3. Generalized Arc Consistency Efficient AI Programming.

Slides:



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

Constraint Satisfaction Problems Russell and Norvig: Chapter
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Wednesday, January 29, 2003CSCE Spring 2003 B.Y. Choueiry Constraint Consistency Chapter 3.
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter 3/25/20131Constraint Optimization.
Foundations of Constraint Processing More on Constraint Consistency 1 Foundations of Constraint Processing CSCE421/821, Spring
Answer Set Programming vs CSP: Power of Constraint Propagation Compared Jia-Huai You ( 犹嘉槐 ) University of Alberta Canada.
1 Directional consistency Chapter 4 ICS-179 Spring 2010 ICS Graphical models.
1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali.
Anagh Lal Monday, April 14, Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE Advanced Constraint Processing.
1 Advanced consistency methods Chapter 8 ICS-275 Spring 2007.
Constraint Satisfaction CSE 473 University of Washington.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
1 Directional consistency Chapter 4 ICS-275 Spring 2007.
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
Constraint Propagation (Where a better exploitation of the constraints further reduces the need to make decisions) R&N: Chap. 5 + Chap. 24, p
1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.
M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2.
Constraint Networks ( slides courtesy of Natalia Flerova, based on slides courtesy of Rina Dechter)
General search strategies: Look-ahead Chapter 5 Chapter 5.
26 April 2013Lecture 5: Constraint Propagation and Consistency Enforcement1 Constraint Propagation and Consistency Enforcement Jorge Cruz DI/FCT/UNL April.
Chapter 5 Outline Formal definition of CSP CSP Examples
Advanced Constraint Processing, Fall 2009 An Efficient Consistency Algorithm for the Temporal Constraint Satisfaction Problem Berthe Y. Choueiry & Lin.
1 Chapter 8 Advanced Consistency Methods Yaling Zheng CSCE : Advanced Constraint Processing.
ICS-270A:Notes 6: 1 Notes 6: Constraint Satisfaction Problems ICS 270A Spring 2003.
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.
Constraint Satisfaction Read Chapter 5. Model Finite set of variables: X1,…Xn Variable Xi has values in domain Di. Constraints C1…Cm. A constraint specifies.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
Constraint Networks Overview. Suggested reading Russell and Norvig. Artificial Intelligence: Modern Approach. Chapter 5.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
Problem Solving with Constraints Lookahead Schemas 1 Foundations of Constraint Processing CSCE496/896, Fall
1 Directional consistency Chapter 4 ICS-275 Spring 2009 ICS Constraint Networks.
Wednesday, January 29, 2003CSCE Spring 2003 B.Y. Choueiry Directional Consistency Chapter 4.
Chapter 5 Constraint Satisfaction Problems
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics.
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
CS 175 Project in AI. 2 Lectures: ICS 180 Tuesday, Thursday Hours: am Discussion: DBH 1300 Wednesday Hours: pm Instructor: Natalia.
Constraint Propagation influenced by Dr. Rina Dechter, “Constraint Processing”
Arc Consistency and Domain Splitting in CSPs CPSC 322 – CSP 3 Textbook Poole and Mackworth: § 4.5 and 4.6 Lecturer: Alan Mackworth October 3, 2012.
Lecture 5: Constraint Satisfaction Problems
Constraint Satisfaction CSE 473 University of Washington.
IBM Labs in Haifa © 2005 IBM Corporation Assumption-based Pruning in Conditional CSP Felix Geller and Michael Veksler.
Constraint Propagation CS121 – Winter Constraint Propagation2 Constraint Propagation … … is the process of determining how the possible values of.
Constraint Satisfaction
CS B551: Elements of Artificial Intelligence
Class #17 – Thursday, October 27
Constraint Propagation
Graphplan/ SATPlan Chapter
Constraints and Search
Class #19 – Monday, November 3
More on Constraint Consistency
Chapter 5: General search strategies: Look-ahead
Advanced consistency methods Chapter 8
Graphplan/ SATPlan Chapter
Arc Consistency – AC-1 PROCEDURE AC-1(Z, D, C) BEGIN
Graphplan/ SATPlan Chapter
Directional consistency Chapter 4
Constraint Graph Binary CSPs
Consistency algorithms
Presentation transcript:

©2007 Tarik Hadzic1 Lecture 11: Consistency Techniques 1. Arc Consistency 2. Directional Consistency 3. Generalized Arc Consistency Efficient AI Programming

©2007 Tarik Hadzic2 Today’s Program Arc-Consistency - AC-1 - AC-3, - AC-4 Directional Consistency –DAC-1 –Backtrack-free search Global Constraints – Generalized Arc Consistency – Domain Store Propagation

©2007 Tarik Hadzic3 Bounded Constraint Inference Guarantee: any consistent instantiation of i-1 variable is extendible to any i-th variable Algorithms: –i=2: Arc-Consistency –i=3: Path-Consistency –i≥4: i-consistency i-consistency algorithms exponential in i. Trade-off between preprocessing and subsequent search

©2007 Tarik Hadzic4 Arc-Consistency

©2007 Tarik Hadzic5 Arc-Consistency Guarantee: any value in the domain of a single variable can be extended consistently by any other variable Example: network X={x,y}, R xy : x<y, D x =D y ={1,2,3} x < y x y

©2007 Tarik Hadzic6 Example Network X={x,y}, R xy : x<y, D x =D y ={1,2,3} Not Arc-Consistent y x < y x x y Arc-Consistent

©2007 Tarik Hadzic7 Definition Given constraint problem and constraint C ij (S ij,R ij ) in C An arc (x i, x j ) is arc-consistent iff for every a i  D i there exists a j  D j such that (a i,a j )  R ij If (x i, x j ) is arc-consistent, it doesn’t imply that (x j, x i ) is arc-consistent. A CSP is arc-consistent iff all of its arcs are arc-consistent

©2007 Tarik Hadzic8 Revise ((x i ),x j ) 1.deleted  false 2. for each a i  D i 3. if there is no a j  D j, (a i,a j )  R ij 4. then delete a i from D, deleted  true 5. endif 6. endfor 7. return deleted Complexity? O(k 2 ) where k bounds the domain size

©2007 Tarik Hadzic9 Revise ((x i ),x j ) x < y x y x y x y Revise((x),y) Revise((y),x)

©2007 Tarik Hadzic10 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z)

©2007 Tarik Hadzic11 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((y),x)

©2007 Tarik Hadzic12 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((z),y) Revise((y),x)

©2007 Tarik Hadzic13 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((z),y) Revise((x),z) Revise((y),x)

©2007 Tarik Hadzic14 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((z),y) Revise((x),z) Revise((y),x)

©2007 Tarik Hadzic15 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((z),y) Revise((x),z) Revise((y),x) Revise((z),y) Revise((y),x)

©2007 Tarik Hadzic16 Revise ((x i ),x j ) To achieve arc-consistency, apply Revise until no change in the domain of any variable in the network x y z Revise((x),z) Revise((z),y) Revise((x),z) Revise((y),x) Revise((z),y) Revise((y),x)

©2007 Tarik Hadzic17 AC-1 (  ) 1. repeat 2. for every {x i,x j } participating in a constraint 3. Revise((x i ),x j ) 4. Revise((x j ),x i ) 5. endfor 6. until no domain changed Complexity? O(enk 3 ) where n variables, e binary constraints, k bounds the domain size

©2007 Tarik Hadzic18 AC-3 (  ) Improvement over AC-1 –No need to process all constraints –Revise((x i ),x j ) is processed only when D j is reduced –queue maintains pairs (x i,x j ) involved in a constraint where D j is reduced –Initially, for every constraint C ij, (x i,x j ) and (x j,x i ) are added to queue

©2007 Tarik Hadzic19 AC-3 (  ) 1. for every constraint C ij 2. Q ← Q U {(x i,x j ),(x j,x i )} 3. endfor 4. while Q ≠ {} 5. select and delete (x i,x j ) from Q 6. Revise((x i ),x j ) 7. if Revise((x i ),x j )=true then 8. Q ← Q U {(x k,x i ), k ≠i, k≠j} 9. endif 10. endwhile

©2007 Tarik Hadzic20 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R y z : “z divides y” 2,5 2,4 x z y Q = {(z,x),(x,z),(z,y),(y,z)}

©2007 Tarik Hadzic21 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R xz : “z divides y” 2,5 2,4 x z y Q = {(z,x),(x,z),(z,y),(y,z)} Revise((z),x) No effect!

©2007 Tarik Hadzic22 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R xz : “z divides y” 2,5 2,4 x z y Q = {(x,z),(z,y),(y,z)} Revise((x),z) No effect!

©2007 Tarik Hadzic23 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R yz : “z divides y” 2 2,5 2,4 x z y Q = {(y,z),(x,z)} Revise((y),z) No effect!

©2007 Tarik Hadzic24 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R xz : “z divides y” 2 2,5 2,4 x z y Q = {(x,z)} Revise((x),z) Delete 5 from Dx No constraints added to queue!

©2007 Tarik Hadzic25 Example: AC-3 (  ) X = {x,y,z}, D z ={2,5}, D x ={2,5}, D y ={2,4}; R zx : ”z divides x”; R xz : “z divides y” 2 2 2,4 x z y Q = {} AC-3 terminates!

©2007 Tarik Hadzic26 AC-4 (  ) Optimal performance O(ek 2 ) Does not use Revise For every value a  D i maintains counter(x i, x j, a) : number of values in Dj consistent with x i =a 2,5 2,4 x z y counter(z,y,2) = counter(z,y,5) = counter(z,x,2) = counter(z,x,5) = 2 0! 1 1 No counters between x and y

©2007 Tarik Hadzic27 AC-4 (  ) If counter(x i,x j,a)=0 then (x i,a) is unsupported List Q: maintains unsupported (x i,a) pairs S(x j,a) : all values in other variable domains supported by (x j,a) In each step AC-4: –Picks and removes unsupported value from Q –Updates counters of potentially affected values

©2007 Tarik Hadzic28 AC-4 (  )

©2007 Tarik Hadzic29 AC-4 (  )

©2007 Tarik Hadzic30 Example: AC-4 (  ) 2, 5 2,4 x z y List = {(z,5)} M = {} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 1 counter(y,2,z) = 1 counter(y,4,z) = 1

©2007 Tarik Hadzic31 Example: AC-4 (  ) 2 2,5 2,4 x z y List = {} M = {(z,5)} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 1 counter(y,2,z) = 1 counter(y,4,z) = 1 for each (x j,a j ) in S (z,5) counter(x j,a j,z)-- if counter(x j,a j,x i )=0 then add (x j,a j ) to List S(z,5) = (x,5)

©2007 Tarik Hadzic32 Example: AC-4 (  ) 2 2,5 2,4 x z y List = {} M = {(z,5)} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 0 counter(y,2,z) = 1 counter(y,4,z) = 1

©2007 Tarik Hadzic33 Example: AC-4 (  ) 2 2, 5 2,4 x z y List = {(x,5)} M = {(z,5)} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 0 counter(y,2,z) = 1 counter(y,4,z) = 1

©2007 Tarik Hadzic34 Example: AC-4 (  ) 2 2 2,4 x z y List = {} M = {(x,5),(z,5)} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 0 counter(y,2,z) = 1 counter(y,4,z) = 1 for each (x j,a j ) in S (x,5) counter(x j,a j,x)-- if counter(x j,a j,x i )=0 then add (x j,a j ) to List S(x,5) = (z,5)

©2007 Tarik Hadzic35 Example: AC-4 (  ) 2 2 2,4 x z y List = {} M = {(x,5),(z,5)} counter(z,2,y) = 2 counter(z,5,y) = 0 counter(z,2,x) = 1 counter(z,5,x) = 1 counter(x,2,z) = 1 counter(x,5,z) = 0 counter(y,2,z) = 1 counter(y,4,z) = 1 S(x,5) = (z,5) (z,5) already in M, and not processed Nothing is added to List and AC-4 terminates!

©2007 Tarik Hadzic36 AC-4 (  ) Time complexity O(ek 2 ) Space complexity O(ek 2 )

©2007 Tarik Hadzic37 Directional Arc Consistency

©2007 Tarik Hadzic38 Motivation Determining amount of inference for backtrack-free guarantee Restrict inference relative to a given ordering Arc consistency unnecessary when solution generated along a fixed ordering

©2007 Tarik Hadzic39 Directional Arc-Consistency A network is directional arc-consistent relative to order d=(x 1,…,x n ) iff every arc (x i,x j ) is arc-consistent whenever i < j in the ordering DAC( ) for i=n to 1 by -1 for each j<i such that C ij  C Revise((x j ),x i )

©2007 Tarik Hadzic40 Example, X={x 1,x 2,x 3,x 4 } D 1 ={red,white,black}, D 2 ={green,white,black}, D 3 ={red,white,blue}, D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 d = (x 1,x 2,x 3,x 4 ) x4x4 x3x3 x2x2 x1x1

©2007 Tarik Hadzic41 Example x4x4 x3x3 x2x2 x1x1 D 1 ={red,white,black} D 2 ={green,white,black} D 3 ={red,white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4

©2007 Tarik Hadzic42 Example D 1 ={red,white,black} D 2 ={green,white,black} D 3 ={red,white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 Revise((x 3 ),x 4 )

©2007 Tarik Hadzic43 Example D 1 ={red,white,black} D 2 ={green,white,black} D 3 ={ red,white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 Delete red from D 3 !

©2007 Tarik Hadzic44 Example D 1 ={red,white,black} D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 Revise((x 1 ),x 3 )

©2007 Tarik Hadzic45 Example D 1 ={ red,white, black } D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 Delete red, black from D 1 !

©2007 Tarik Hadzic46 Example D 1 ={white} D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 Revise((x 1 ),x 2 )

©2007 Tarik Hadzic47 Example D 1 ={white} D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 No effect!

©2007 Tarik Hadzic48 Example D 1 ={white} D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 x4x4 x3x3 x2x2 x1x1 DAC terminates!

©2007 Tarik Hadzic49 Example D 1 ={white} D 2 ={green,white,black} D 3 ={white,blue} D 4 ={white,blue,black} R 12 : x 1 = x 2 R 13 : x 1 = x 3 R 34 : x 3 = x 4 Backtrack-free assignment: 1. x 1 = white 2. x 2 = white 3. x 3 = white 4. x 4 = white

©2007 Tarik Hadzic50 Directional Arc-Consistency DAC( ) for i=n to 1 by -1 for each j<i such that C ij  C Revise((x j ),x i ) Complexity: O(ek 2 )

©2007 Tarik Hadzic51 Global Constraints and Generalized Arc-Consistency

©2007 Tarik Hadzic52 Definition Given constraint problem and (n- ary) constraint C’  C, C’ = (R,S) Variable x is (generalized) arc-consistent relative to constraint (R,S) iff for every a  D x there exists a tuple in the domains of variables in S, t  R such that t[x] = a

©2007 Tarik Hadzic53 Example D x = [0,15], D y = [0,15], D z = [0,15] x+y+z  15, z ≥ 13 D x ← [0,2], D y ← [0,2] Alldiff(x 1,…,x n )

©2007 Tarik Hadzic54 Modern Solver Architecture D 1, D 2, …, D n C1C1 C2C2 C3C3 1.Each Global Constraint Prunes Domains (highest level of pruning is GAC) 2.Constraint Store ”notifies” affected global constraints Global Constraints Constraint Store (Domain Store)

©2007 Tarik Hadzic55 Backtrack-free search A constraint network is backtrack-free relative to a given ordering d={x 1,…,x n } if for every i  n, every partial solution of (x 1,…,x n ) can be consistently extended to include x n+1

©2007 Tarik Hadzic56 Width A B C A B C C B A d 1 =(C,B,A) w(A) = 2 w(B)=0 w(C)=0 w(d 1 ) = 2 d 2 =(A,B,C) w(A) = 0 w(B)=1 w(C)=1 w(d 1 ) = 1 w(G) = min(w(d i )) w(G) = 1

©2007 Tarik Hadzic57 Induced Width A B C d 1 =(C,B,A) w(A) = 2 w(B)=0 w(C)=0 w(d 1 ) = 2 Process nodes bottom-up Connect parrents of a processed node

©2007 Tarik Hadzic58 Induced Width A B C d 1 =(C,B,A) w(A) = 2 w(B)=0 w(C)=0 w(d 1 ) = 2 Process nodes bottom-up Connect parrents of a processed node

©2007 Tarik Hadzic59 Induced Width A B C d 1 =(C,B,A) w(A) = 2 w(B)=0 w(C)=0 w(d 1 ) = 2 Process nodes bottom-up Connect parrents of a processed node

©2007 Tarik Hadzic60 Induced Width A B C d 1 =(C,B,A) w(A) = 2 w(B)=0 w(C)=0 w(d 1 ) = 2 Process nodes bottom-up Connect parrents of a processed node

©2007 Tarik Hadzic61 Induced Width A B C d 1 =(C,B,A) w(A) = 2 w(B)=1 w(C)=0 w(d 1 ) = 2 w*(d 1 )=2 Process nodes bottom-up Connect parrents of a processed node Induced graph (G*,d 1 ) of an ordered graph (G,d 1 ) Induced width of (G,d 1 ) w*(d 1 )=2 Induced width of G is: w*=min(w*(d i )) G*