1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems
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.
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.
Optimal Rectangle Packing: A Meta-CSP Approach Chris Reeson Advanced Constraint Processing Fall 2009 By Michael D. Moffitt and Martha E. Pollack, AAAI.
Foundations of Constraint Processing More on Constraint Consistency 1 Foundations of Constraint Processing CSCE421/821, Spring
1 Directional consistency Chapter 4 ICS-179 Spring 2010 ICS Graphical models.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
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.
1 Directional consistency Chapter 4 ICS-275 Spring 2007.
©2007 Tarik Hadzic1 Lecture 11: Consistency Techniques 1. Arc Consistency 2. Directional Consistency 3. Generalized Arc Consistency Efficient AI Programming.
Constraint Satisfaction Problems
1 Binary C ONSTRAINT P ROCESSING Chapter 2 ICS-275A Fall 2007.
Jean-Charles REGIN Michel RUEHER ILOG Sophia Antipolis Université de Nice – Sophia Antipolis A global constraint combining.
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)
© J. Christopher Beck Lecture 11: Constraint Programming 1.
General search strategies: Look-ahead Chapter 5 Chapter 5.
Advanced Constraint Processing, Fall 2009 An Efficient Consistency Algorithm for the Temporal Constraint Satisfaction Problem Berthe Y. Choueiry & Lin.
ICS-270A:Notes 6: 1 Notes 6: Constraint Satisfaction Problems ICS 270A Spring 2003.
Constraint Satisfaction Problems
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Slide 1 CSPs: Arc Consistency & Domain Splitting Jim Little UBC CS 322 – Search 7 October 1, 2014 Textbook §
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
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.
Constraint Networks Overview. Suggested reading Russell and Norvig. Artificial Intelligence: Modern Approach. Chapter 5.
CSC 8520 Spring Paula Matuszek Based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are based on Russell, aima.eecs.berkeley.edu/slides-pdf.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Search 3: Constraint Satisfaction Problems Paula Matuszek Spring, 2013.
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
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
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”
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Eliminating non- binary constraints Toby Walsh Cork Constraint Computation Center.
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
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (CSPs) Introduction
Constraint Programming
Computer Science cpsc322, Lecture 13
The minimum cost flow problem
Constraint Satisfaction Problems (CSPs) Introduction
Advanced Artificial Intelligence
CS 188: Artificial Intelligence
Constraint Propagation
Computer Science cpsc322, Lecture 13
Constraints and Search
Path Consistency & Global Consistency Properties
Notes 6: Constraint Satisfaction Problems
Chapter 5: General search strategies: Look-ahead
Advanced consistency methods Chapter 8
Constraint satisfaction problems
CS 8520: Artificial Intelligence
Directional consistency Chapter 4
Constraint Satisfaction Problems
Constraint Graph Binary CSPs
Constraint satisfaction problems
Consistency algorithms
Presentation transcript:

1 Consistency algorithms Chapter 3

Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy Methods that transform the original network into a tighter and tighter representations

Spring 2007 ICS 275A - Constraint Networks 3 Arc-consistency 32,1, 32,1,32,1, 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ 32,1,  =  

Spring 2007 ICS 275A - Constraint Networks 4 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ  =   Arc-consistency

Spring 2007 ICS 275A - Constraint Networks 5 Arc-consistency

Spring 2007 ICS 275A - Constraint Networks 6 Arc-consistency Only domain constraints are recorded: Example:

Spring 2007 ICS 275A - Constraint Networks 7 Revise for arc-consistency

Spring 2007 ICS 275A - Constraint Networks 8 Figure 3.3: (a) Matching diagram describing a network of constraints that is not arc-consistent (b) An arc-consistent equivalent network.

Spring 2007 ICS 275A - Constraint Networks 9 AC-1 Complexity ( Mackworth and Freuder, 1986 ): e = number of arcs, n variables,k values (ek^2, each loop, nk number of loops), best-case = ek, Arc-consistency is:

Spring 2007 ICS 275A - Constraint Networks 10 AC-3 Complexity: Best case O(ek), since each arc may be processed in O(2k)

Spring 2007 ICS 275A - Constraint Networks 11 Example: A three variable network, with two constraints: z divides x and z divides y (a) before and (b) after AC-3 is applied.

Spring 2007 ICS 275A - Constraint Networks 12 AC-4 Complexity: (Counter is the number of supports to ai in xi from xj. S_(xi,ai) is the set of pairs that (xi,ai) supports)

Spring 2007 ICS 275A - Constraint Networks 13 Example applying AC-4

Spring 2007 ICS 275A - Constraint Networks 14 Distributed arc-consistency (Constraint propagation) Implement AC-1 distributedly. Node x_j sends the message to node x_i Node x_i updates its domain: Messages can be sent asynchronously or scheduled in a topological order

Spring 2007 ICS 275A - Constraint Networks 15 Exercise: make the following network arc-consistent Draw the network’s primal and dual constraint graph Network = Domains {1,2,3,4} Constraints: y < x, z < y, t < z, f<t, x<=t+1, Y<f+2

Spring 2007 ICS 275A - Constraint Networks 16 Arc-consistency Algorithms AC-1: brute-force, distributed AC-3, queue-based AC-4, context-based, optimal AC-5,6,7,…. Good in special cases Important: applied at every node of search (n number of variables, e=#constraints, k=domain size) Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)…

Spring 2007 ICS 275A - Constraint Networks 17 Is arc-consistency enough? Example: a triangle graph-coloring with 2 values. Is it arc-consistent? Is it consistent? It is not path, or 3-consistent.

Spring 2007 ICS 275A - Constraint Networks 18 Path-consistency

Spring 2007 ICS 275A - Constraint Networks 19 Path-consistency

Spring 2007 ICS 275A - Constraint Networks 20 Revise-3 Complexity: O(k^3) Best-case: O(t) Worst-case O(tk)

Spring 2007 ICS 275A - Constraint Networks 21 PC-1 Complexity: O(n^3) triplets, each take O(k^3) steps  O(n^3 k^3) Max number of loops: O(n^2 k^2).

Spring 2007 ICS 275A - Constraint Networks 22 PC-2 Complexity: Optimal PC-4: (each pair deleted may add: 2n-1 triplets, number of pairs: O(n^2 k^2)  size of Q is O(n^3 k^2), processing is O(k^3))

Spring 2007 ICS 275A - Constraint Networks 23 Example: before and after path- consistency PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly?

Spring 2007 ICS 275A - Constraint Networks 24 Path-definition of path- consistency

Spring 2007 ICS 275A - Constraint Networks 25 Path-consistency Algorithms Apply Revise-3 (O(k^3)) until no change Path-consistency (3-consistency) adds binary constraints. PC-1: PC-2: PC-4 optimal:

Spring 2007 ICS 275A - Constraint Networks 26 I-consistency

Spring 2007 ICS 275A - Constraint Networks 27 Higher levels of consistency, global-consistency

Spring 2007 ICS 275A - Constraint Networks 28 Revise-i Complexity: for binary constraints For arbitrary constraints:

Spring 2007 ICS 275A - Constraint Networks 29 4-queen example

Spring 2007 ICS 275A - Constraint Networks 30 I-consistency

Spring 2007 ICS 275A - Constraint Networks 31 Path-consistency vs 3- consistency

Spring 2007 ICS 275A - Constraint Networks 32 Arc-consistency for non-binary constraints: Generalized arc-consistency Complexity: O(t k), t bounds number of tuples. Relational arc-consistency:

Spring 2007 ICS 275A - Constraint Networks 33 Examples of generalized arc-consistency x+y+z = 13 implies x<=2, y<=2 Example of relational arc-consistency

Spring 2007 ICS 275A - Constraint Networks 34 More arc-based consistency Global constraints: e.g., all-different constraints Special semantic constraints that appears often in practice and a specialized constraint propagation. Used in constraint programming. Bounds-consistency: pruning the boundaries of domains

Spring 2007 ICS 275A - Constraint Networks 35 Sudoku – Constraint Satisfaction Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints Variables: empty slots Domains = {1,2,3,4,5,6,7,8,9} Constraints: 27 all-different Constraint Propagation Inference

Spring 2007 ICS 275A - Constraint Networks 36 Global constraints

Spring 2007 ICS 275A - Constraint Networks 37 Example for alldiff A = {3,4,5,6} B = {3,4} C= {2,3,4,5} D= {2,3,4} E = {3,4} Alldiff (A,B,C,D,E} Arc-consistency does nothing Apply GAC to sol(A,B,C,D,E)?  A = {6}, F = {1}…. Alg: bipartite matching kn^1.5 (Lopez-Ortiz, et. Al, IJCAI-03 pp 245 (A fast and simple algorithm for bounds consistency of alldifferent constraint)

Spring 2007 ICS 275A - Constraint Networks 38 Global constraints Alldifferent Sum constraint (variable equal the sum of others) Global cardinality constraint (a value can be assigned a bounded number of times to a set of variables) The cummulative constraint (related to scheduling tasks)

Spring 2007 ICS 275A - Constraint Networks 39 Bounds consistency

Spring 2007 ICS 275A - Constraint Networks 40 Bounds consistency for Alldifferent constraints

Spring 2007 ICS 275A - Constraint Networks 41 Boolean constraint propagation (A V ~B) and (B) B is arc-consistent relative to A but not vice-versa Arc-consistency by resolution: res((A V ~B),B) = A Given also (B V C), path-consistency: Res((A V ~B),(B V C) = (A V C) What will generalized arc-consistency can do to cnfs? Relational arc-consistency rule = unit-resolution

Spring 2007 ICS 275A - Constraint Networks 42 Boolean constraint propagation If Alex goes, then Becky goes: If Chris goes, then Alex goes: Query: Is it possible that Chris goes to the party but Becky does not? Example: party problem

Spring 2007 ICS 275A - Constraint Networks 43 Gausian and Boolean propagation Linear inequalities Boolean constraint propagation

Spring 2007 ICS 275A - Constraint Networks 44 Constraint propagation for Boolean constraints: Unit propagation

Spring 2007 ICS 275A - Constraint Networks 45 Arc-consistency for non-binary constraints: Generalized arc-consistency (reminder) Complexity: O(t k), t bounds number of tuples. Relational arc-consistency:

Spring 2007 ICS 275A - Constraint Networks 46 Algorithms for relational and generalized arc-cnsistency Think about the following: GAC-i apply AC-i to the dual problem when singleton variables are explicit: the bi-partite representation. What is the complexity? Relational arc-consistency: imitate unit propagation. Apply AC-1 on the dual problemwhere each subset of a scope is presented. Is unit propagation equivalent to AC-4?

Spring 2007 ICS 275A - Constraint Networks 47 Consistency for numeric constraints

Spring 2007 ICS 275A - Constraint Networks 48 Tractable classes

Spring 2007 ICS 275A - Constraint Networks 49 Changes in the network graph as a result of arc-consistency, path-consistency and 4- consistency.

Spring 2007 ICS 275A - Constraint Networks 50 Distributed arc-consistency (Constraint propagation) Implement AC-1 distributedly. Node x_j sends the message to node x_i Node x_i updates its domain: Generalized arc-consistency can be implemented distributedly: sending messages between constraints over the dual graph :

Spring 2007 ICS 275A - Constraint Networks 51 Distributed Arc-Consistency Arc-consistency can be formulated as a distributed algorithm: A BC DF G a Constraint network

Spring 2007 ICS 275A - Constraint Networks 52 A AC AB BCF ABD DFG Relational Arc-consistency A BC DF G The message that R2 sends to R1 is R1 updates its relation and domains and sends messages to neighbors

Spring 2007 ICS 275A - Constraint Networks 53 A AC AB BCF ABD DFG A ABAC ABDBCF DFG B B D F A A A C 1 DRAC on the dual join-graph

Spring 2007 ICS 275A - Constraint Networks 54 Distributed Relational Arc-Consistency DRAC can be applied to the dual problem of any constraint network:

Spring 2007 ICS 275A - Constraint Networks 55 A AC AB BCF ABD DFG A ABAC ABDBCF DFG AB B D B F A A A A C 1 DR-AC on the dual graph A

Spring 2007 ICS 275A - Constraint Networks 56 Node 6 sends messagesNode 5 sends messagesNode 4 sends messagesNode 3 sends messagesNode 2 sends messages A AC AB BCF ABD DFG A A A A 1 3 A B 1 1 A 1 3 B A 1 3 B 1 2 D B 1 1 A 1 3 F D 2 C B 2 C B 1 3 F Iteration A A Node 1 sends messages A ABAC ABDBCF DFG AB B D B F A A A A C A 1 3 A A 1

Spring 2007 ICS 275A - Constraint Networks 57 A AC AB BCF ABD DFG A A A A 1 3 B B A D 1 2 F 1 3 D C 2 B C 2 F 1 3 A B Iteration 1 A ABAC ABDBCF DFG B B D F A A A C 1

Spring 2007 ICS 275A - Constraint Networks 58 A 1 3 AC AB BCF ABD DFG 213 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 1

Spring 2007 ICS 275A - Constraint Networks 59 A 1 3 AC AB BCF ABD DFG 213 A 1 3 A 1 3 A A 1 3 A 1 3 D 2 F 1 3 D 1 2 C 2 B 1 3 C 2 F 1 A B 1 3 B A ABAC ABDBCF DFG B B D F A A A C 1 Iteration B

Spring 2007 ICS 275A - Constraint Networks 60 A 1 3 AC AB BCF 321 ABD DFG 213 Iteration 2 A ABAC ABDBCF DFG B B D F A A A C 1

Spring 2007 ICS 275A - Constraint Networks 61 A 1 3 A 1 3 A 1 3 B 3 A 1 3 D 2 F 1 D 2 C 2 B 1 3 C 2 F 1 A 1 3 A 1 3 A 1 3 AC AB BCF 321 ABD DFG 213 B 1 3 B 1 3 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 3

Spring 2007 ICS 275A - Constraint Networks 62 A 1 3 AC AB 13 BCF 321 ABD DFG 213 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 3

Spring 2007 ICS 275A - Constraint Networks 63 A 1 3 A 1 3 A 1 B 3 A 1 3 D 2 F 1 D 2 C 2 B 3 C 2 F 1 A 1 3 A 1 3 A 1 3 AC AB 13 BCF 321 ABD DFG 213 B 1 3 B 1 3 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 4

Spring 2007 ICS 275A - Constraint Networks 64 A 1 AC AB 13 BCF 321 ABD 132 DFG 213 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 4

Spring 2007 ICS 275A - Constraint Networks 65 A 1 A 1 A 1 B 3 B 3 B 3 A 1 D 2 F 1 D 2 C 2 B 3 C 2 F 1 A 1 A 1 A 1 AC AB 13 BCF 321 ABD 132 DFG 213 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 5

Spring 2007 ICS 275A - Constraint Networks 66 A 1 AC 12 AB 13 BCF 321 ABD 132 DFG 213 A ABAC ABDBCF DFG B B D F A A A C 1 Iteration 5