CIS 391 - Intro to AI 1 Interpreting Line Drawings & Constraint Satisfaction II Mitch Marcus CIS 391 – Fall 2008.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept.
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems (Chapter 6). What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search.
Constraint Satisfaction Problems
Chapter 8 Topics in Graph Theory
Maintaining Arc Consistency We have a constraint graph G of variables X 1,...X n, and constraint relations {X i  X j}, and each Xi has a value set V (X.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Constraint Satisfaction Problems. 2 Intro Example: 8-Queens Generate-and-test: 8 8 combinations.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Graph Search Methods Spring 2007 CSE, POSTECH. Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u. A search method.
CS 206 Introduction to Computer Science II 10 / 31 / 2008 Happy Halloween!!! Instructor: Michael Eckmann.
Spanning Trees.
Spanning Trees. 2 Spanning trees Suppose you have a connected undirected graph Connected: every node is reachable from every other node Undirected: edges.
Connected Components, Directed Graphs, Topological Sort COMP171.
Constraint Satisfaction Problems
CS460 Fall 2013 Lecture 4 Constraint Satisfaction Problems.
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.
Constraint Propagation (Where a better exploitation of the constraints further reduces the need to make decisions) R&N: Chap. 5 + Chap. 24, p
Connected Components, Directed Graphs, Topological Sort Lecture 25 COMP171 Fall 2006.
Connected Components, Directed graphs, Topological sort COMP171 Fall 2005.
Chapter 5 Outline Formal definition of CSP CSP Examples
1 Pertemuan 20 Understanding Continued Matakuliah: T0264/Intelijensia Semu Tahun: Juli 2006 Versi: 2/1.
Spanning Trees. Spanning trees Suppose you have a connected undirected graph –Connected: every node is reachable from every other node –Undirected: edges.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
Constraint Satisfaction Problems
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Slide 1 CSPs: Arc Consistency & Domain Splitting Jim Little UBC CS 322 – Search 7 October 1, 2014 Textbook §
Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
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 Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
CS 162 Intro to Programming II Bubble Sort 1. Compare adjacent elements. If the first is greater than the second, swap them. Do this for each pair of.
CS270 Project Overview Maximum Planar Subgraph Danyel Fisher Jason Hong Greg Lawrence Jimmy Lin.
Chapter 5 Constraint Satisfaction Problems
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
Constraint Satisfaction Problems (Chapter 6)
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
COSC 2007 Data Structures II
1 Constraint Satisfaction Problems: Formulation, Arc Consistency & Propagation 1 Brian C. Williams October 13 th, 2004 Slides adapted from:
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.
2/22/2016© Hal Perkins & UW CSEP-1 CSE P 501 – Compilers Register Allocation Hal Perkins Winter 2008.
CIS Intro to AI 1 Interpreting Line Drawings (An Introduction to Constraint Satisfaction) Mitch Marcus CIS 391 Fall 2008.
Great Theoretical Ideas in Computer Science for Some.
Lecture 8CSE Intro to Cognitive Science1 Interpreting Line Drawings II.
COMPSCI 102 Introduction to Discrete Mathematics.
Graphs – Part III CS 367 – Introduction to Data Structures.
A vertex u is reachable from vertex v iff there is a path from v to u.
Lecture 7 Constraint Satisfaction Problems
Depth-First Search.
CS B551: Elements of Artificial Intelligence
Constraint Propagation
Planarity Testing.
Spanning Trees.
Outline This topic covers Prim’s algorithm:
Connected Components, Directed Graphs, Topological Sort
Great Theoretical Ideas In Computer Science
EMIS 8374 Search Algorithms Updated 9 February 2004
A vertex u is reachable from vertex v iff there is a path from v to u.
Discrete Mathematics for Computer Science
EMIS 8374 Search Algorithms Updated 12 February 2008
Constraint Graph Binary CSPs
Presentation transcript:

CIS Intro to AI 1 Interpreting Line Drawings & Constraint Satisfaction II Mitch Marcus CIS 391 – Fall 2008

CIS Intro to AI 2 Constraint Propagation Waltz’s insight:  Pairs of adjacent junctions (junctions connected by a line) constrain each other’s interpretations!  These constraints can propagate along the connected edges of the graph. Waltz Filtering :  Suppose junctions i and j are connected by an edge. Remove any labeling from i that is inconsistent with every labeling in the set assigned in j.  By iterating over the graph, the constraints will propagate.

CIS Intro to AI 3 When to Iterate, When to Stop? The crucial principle: Any algorithm must ensure that: If a label is removed from a junction i, then the labels on all of i’s neighbors will be reexamined. Why? Removing a label from a junction may result in one of the neighbors becoming edge inconsistent, so we need to check…

CIS Intro to AI 4 An Example of Constraint Propagation A1,A2, A3 L1,L2,L3, L4,L5, L6 A1,A2, A3 L1,L3, L5,L6 A1,A3 A1,A2, A3 L1,L3, L5,L6 A1,A2, A3 L1, L5,L6 A1,A3 L1, L5,L6 A1,A3 … Check Given

CIS Intro to AI 5 The Waltz/Mackworth Constraint Propagation Algorithm 1.Associate with each junction in the picture a set of all Huffman/Clowes junction labels appropriate for that junction type; 2.Repeat until there is no change in the set of labels associate with any junction: 3.For each junction i in the picture: 4.For each neighboring junction j in the picture: 5.Remove any junction label from i for which there is no edge-consistent junction label on j.

CIS Intro to AI 6 Inefficiencies 1.At each iteration, we only need to examine junctions i where at least one neighbor j has lost a label in the previous iteration, not all of them. 2.If j loses a label only because of edge inconsistencies with i, we don’t need to check i on the next iteration. 3.The only way in which i can be made edge- inconsistent by the removal of a label on j is with respect to j itself. Thus, we only need to check that the labels on the pair (i,j) are still consistent. These insights lead to a much better algorithm...

CIS Intro to AI 7 Arcs Given this notion of (i,j) junction pairs,  The crucial notion is an arc, where an arc is a directed pair of neighboring junctions.  For a neighboring pair of junctions i and j, there are two arcs that connect them: (i,j) and (j,i). ij (i,j) (j,i)

CIS Intro to AI 8 Arc Consistency We will define the algorithm for line labeling with respect to arc consistency as opposed to edge consistency:  An arc ( i,j ) is arc consistent if and only if every label on junction i is consistent with some label on junction j.  To make an arc ( i,j ) arc consistent, for each label l on junction i, if there is no label on j consistent with l then remove l from i (Any consistent assignment of labels to the junctions in a picture must assign the same line label to an arc ( i,j ) as to the inverse arc ( j,i ) ).

CIS Intro to AI 9 The AC-3 Algorithm (for Line Labeling) 1.Associate with each junction in the picture a set of all Huffman/Clowes junction labels for that junction type; 2.Make a queue of all the arcs ( i,j ) in the picture; 3. Repeat until the queue is empty: a.Remove an arc ( i,j ) from the queue; b.For each label l on junction i, if there is no label on j consistent with l then remove l from i c.If any label is removed from i then for all arcs ( k,i ) in the picture except ( j,i ), put ( k,i ) on the queue if it isn’t already there.

CIS Intro to AI 10 Queue:(1,2)(2,1)(2,3)(3,2) (3,4)(4,3) (4,1)(1,4)(1,3)(3,1) a.Removing (1,2). b.All labels on 1 consistent with 2, so no labels removed from 1. c.No arcs added. Example of AC-3: Iteration 1 (derived from old CSE 140 slides by Mark Steedman)

CIS Intro to AI 11 AC-3: Iteration 2 Queue: (2,1)(2,3)(3,2)(3,4)(4,3) (4,1)(1,4)(1,3)(3,1) a.Removing (2,1). b.L2 & L4 on 2 inconsistent with 1, so they are removed. c.All arcs (k,2) except for (1,2) considered to add, but already in queue, so no arcs added.

CIS Intro to AI 12 AC-3: Iteration 3 Queue: (2,3)(3,2)(3,4)(4,3)(4,1)(1,4) (1,3)(3,1) a.Removing (2,3). b.L3 on 2 inconsistent with 3, so it is removed. c.Of arcs (k,2), (1,2) is not on queue, so it is added.

CIS Intro to AI 13 AC-3: Iteration 4 Queue: (3,2)(3,4)(4,3)(4,1)(1,4)(1,3) (3,1) (1,2) a.Removing (3,2). b.A2 on 3 inconsistent with 2, so it is removed. c.Of arcs (k,3) excluding (2,3) are on queue, so nothing added to queue.

CIS Intro to AI 14 AC-3: Iteration 5 Queue: (3,4)(4,3)(4,1)(1,4)(1,3)(3,1) (1,2) a.Removing (3,4). b.All labels on 3 consistent with 4, so no labels removed from 3. c.No arcs added.

CIS Intro to AI 15 AC-3: After Remaining Iterations Queue: empty

CIS Intro to AI 16 AC-3: Worst Case Complexity Analysis  All junctions can be connected to every other junction, so each of n junctions must be compared against n-1 other junctions, so total # of arcs is n*(n-1), i.e. O(n 2 )  If there are d labels, checking arc (i,j) takes O(d 2 ) time  Each arc (i,j) can only be inserted into the queue d times  Worst case complexity: O(n 2 d 3 ) For planar pictures, where lines can never cross, the number of arcs can only be linear in N, so for our pictures, the time complexity is only O(nd 3 )