Constraint Networks ( slides courtesy of Natalia Flerova, based on slides courtesy of Rina Dechter)

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems
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.
Constraint Satisfaction problems (CSP)
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter 3/25/20131Constraint Optimization.
Lecture 5: Constraint Satisfaction
Constraint Satisfaction Problems. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
CONSTRAINT Networks Chapters 1-2 Compsci-275 Spring 2009 Spring
Anagh Lal Monday, April 14, Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE Advanced Constraint Processing.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Constraint Satisfaction Problems
1 Binary C ONSTRAINT P ROCESSING Chapter 2 ICS-275A Fall 2007.
Constraint Satisfaction
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
Constraint Satisfaction Problems Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
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 Satisfaction Problem Solving Chapter 5.
General search strategies: Look-ahead Chapter 5 Chapter 5.
Chapter 5 Outline Formal definition of CSP CSP Examples
ICS-270A:Notes 6: 1 Notes 6: Constraint Satisfaction Problems ICS 270A Spring 2003.
Constraint Satisfaction Problems
1 Constraint Satisfaction Problems Slides by Prof WELLING.
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language.
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.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
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.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
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.
C ONSTRAINT Networks Chapters 1-2 Compsci-275 Fall
Constraint Satisfaction Problems (Chapter 6)
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
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.
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.
Constraint Satisfaction Problems Rich and Knight: 3.5 Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Lecture 5: Constraint Satisfaction Problems
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Introduction to graphical models. Outline Course goals and policies Overview of graphical models, examples Constraint networks Probabilistic networks.
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)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction
Constraint Propagation
Notes 6: Constraint Satisfaction Problems
Chapter 5: General search strategies: Look-ahead
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Consistency algorithms
Presentation transcript:

Constraint Networks ( slides courtesy of Natalia Flerova, based on slides courtesy of Rina Dechter)

Reading Russell and Norvig Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Chapter 7 (for Tuesday) Chapter 8 (for Thursday)

3 Good source of advanced information Rina Dechter, Constraint Processing, Morgan Kaufmann

4 Outline Constraint Satisfaction Problems (CSPs): Definition, and simple modeling examples Representing constraints Consistency algorithms (arc-, path- and i-consistency) General search strategy  Look-ahead methods

AB redgreen redblack greenred greenblack blackgreen black red Constraint Satisfaction Example: map coloring Variables - countries (A,B,C,etc.) Values - colors (e.g., red, green, black) Constraints: C A B D E F G

6 Constraint Network; Definition A constraint network is: R= (X,D,C) X variables D domains C constraints R expresses allowed tuples over scopes A solution is an assignment to all variables that satisfies all constraints (join of all relations). Tasks: consistency?, one or all solutions, counting, optimization

Spring Example: The N-queens problem The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables.

Example The 4-queen problem Q Q Q Q Q Q Q Q Place 4 Queens on a chess board of 4x4 such that no two queens reside in the same row, column or diagonal. Standard CSP formulation of the problem: Variables: each row is a variable. Q Q Q Q Domains: Constraints: There are = 6 constraints involved: 4 2 ( ) Constraint Graph :

A solution and a partial consistent tuple Spring Not all consistent instantiations are part of a solution: (a)A consistent instantiation that is not part of a solution. (b) The placement of the queens corresponding to the solution (2, 4, 1,3). c) The placement of the queens corresponding to the solution (3, 1, 4, 2).

Spring Example: configuration and design

Spring Configuration and design Want to build: recreation area, apartments, houses, cemetery, dump Recreation area near lake Steep slopes avoided except for recreation area Poor soil avoided for developments Highway far from apartments, houses and recreation Dump not visible from apartments, houses and lake Lots 3 and 4 have poor soil Lots 3, 4, 7, 8 are on steep slopes Lots 2, 3, 4 are near lake Lots 1, 2 are near highway

12 Outline CSP: Definition, and simple modeling examples Representing constraints Consistency algorithms (arc-, path- and i-consistency) General search strategy  Look-ahead methods

Spring Constraint’s representations Relation: allowed tuples Algebraic expression: Propositional formula:

14 Operations with relations Intersection Union Difference Selection Projection Join Composition

Spring Figure 1.8: Example of set operations intersection, union, and difference applied to relations.

Spring selection, projection, and join operations on relations.

Spring Constraint Graphs: Primal, Dual and Hypergraphs A (primal) constraint graph: a node per variable arcs connect constrained variables. A dual constraint graph: a node per constraint’s scope, an arc connect nodes sharing variables =hypergraph

18 Outline CSP: Definition, and simple modeling examples Representing constraints Consistency algorithms (arc-, path- and i-consistency) General search strategy  Look-ahead methods

19 Consistency methods Constraint propagation – inferring new constraints Can get such an explicit network that the search will find the solution without dead-ends. Approximation of inference:  Arc, path and i-consistency Methods that transform the original network into a tighter and tighter representations

20 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,  =   - infer constraints based on pairs of variables Insures that every legal value in the domain of a single variable has a legal match In the domain of any other selected variable

21 1  X, Y, Z, T  3 X  Y Y = Z T  Z X  T XY TZ  =   Arc-consistency

22 Arc-consistency

23 Revise for arc-consistency

24 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:

25 AC-3 Complexity: Best case O(ek), since each arc may be processed in O(2k) e = number of arcs, n variables, k values

26 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

27 Distributed Arc-Consistency  Arc-consistency can be formulated as a distributed algorithm: A BC DF G a Constraint network

28 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

29 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

30 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

31 Path-consistency

32 Path-consistency

33 Revise-3 Complexity: O(k^3) Best-case: O(t) Worst-case O(tk) e = number of arcs, n variables, k values, t = tightness: number of tuples in the constraint relation

34 PC-1 Complexity: e = number of arcs, n variables, k values, t = tightness: number of tuples in the constraint relation

35 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)) e = number of arcs, n variables, k values, t = tightness: number of tuples in the constraint relation

36 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?

37 I-consistency

38 Outline CSP: Definition, and simple modeling examples Representing constraints Consistency algorithms (arc-, path- and i-consistency) General search strategy  Look-ahead methods

39 Backtracking algorithm No matter how much we reason about the problem – we are still left with choices → need to search the space of possible choices. Backtracking search – assign values to each variable in turn, making sure each assigned value is consistent with values assigned thus far. Encounter variable with no domain value consistent with previous assignment – dead-end → backtrack – change the value of previous variables.

Backtracking

The search space A tree of all partial solutions A partial solution: (a1,…,aj) satisfying all relevant constraints The size of the underlying search space depends on:  Variable ordering  Level of consistency possessed by the problem

Search space and the effect of ordering 20 legal states 1 dead-end leaf 48 legal states 18 dead-end leaves Z evenly divides x,y,l

Dependency on consistency level After arc-consistency z=5 and l=5 are removed After path-consistency  R’_zx  R’_zy  R’_zl  R’_xy  R’_xl  R’_yl

Backtrack-free network

Backtracking Complexity of extending a partial solution:  Complexity of consistent O(e log t), t bounds tuples, e constraints  Complexity of selectvalue O(e k log t)

Improving backtracking Before search: (reducing the search space)  Arc-consistency, path-consistency  Variable ordering (fixed) During search :  Look-ahead schemes: value ordering, variable ordering (if not fixed)  Look-back schemes: Backjump Constraint recording Dependency-directed backtracking

51 Outline CSP: Definition, and simple modeling examples Representing constraints Consistency algorithms (arc-, path- and i-consistency) General search strategy  Look-ahead methods

Improving backtracking Before search: (reducing the search space)  Arc-consistency, path-consistency  Variable ordering (fixed) During search:  Look-ahead schemes: value ordering - first assign value that maximizes the number of options for future assignments variable ordering (if not fixed)- first instantiate most highly constrained variable

Look-ahead: value orderings Intuition:  Choose value least likely to yield a dead-end  Approach: apply propagation at each node in the search tree Forward-checking  (check each unassigned variable separately) Maintaining arc-consistency (MAC)  (apply full arc-consistency) Full look-ahead  One pass of arc-consistency (AC-1) Partial look-ahead  directional-arc-consistency

Generalized look-ahead

Forward-checking The most limited form of constraint propagation during search Propagates the effect of a tentative value selection to each future variable separately If domain of one of the future variables becomes empty – value is not selected → try next value.

Forward-checking example

Forward-checking Complexity of selectValue-forward-checking at each node:

Arc-consistency look-ahead (Gashnig, 1977) Applies full arc-consistency on all un-instantiated variables following each value assignment to the current variable. Complexity:  If optimal arc-consistency is used: SelectValue-Arc-Consistency: The repeat...until loop – essentially AC-1 with some variables instantiated. Maintaining-Arc-Consistency (MAC): Performs full arc-consistency after each domain value is rejected.

Arc-consistency look-ahead: (maintaining arc-consistency MAC)

Full and partial look-ahead Full looking ahead:  Make one full pass through future variables (remove repeat-until from selectValue-arc- consistency) Partial look-ahead:  Applies (similar-to) directional arc-consistency to future variables. - future variables are only compared with those variables following them.  Complexity: also  More efficient than MAC

Example of partial look-ahead

62 Outline CSP: Definition, and simple modeling examples Representing constraints Consistency algorithms (acr-, path- and i-consistency) General search strategy  Look-ahead methods  Branching-ahead

Branching-ahead: Dynamic Value Ordering Rank order the promise in non-rejected values  Rank functions MC (min conflict) – chooses value that removes the smallest number of values from domains of future variables MD (min domain) – chooses value that creates the largest minimum domain size in future variables SC (expected solution counts) – computes upper bound on number of solutions by multiplying the domains sizes of each future variable after incompatible values are removed.

Branching-ahead: Dynamic Variable Ordering (DVO) Following constraint propagation, choose the most constrained variable Intuition: early discovery of dead-ends Highly effective: the single most important heuristic to cut down search space Most popular with FC Dynamic search rearrangement (Bitner and Reingold, 1975) (Purdon,1983)