Constraint Propagation CS121 – Winter 2003. Constraint Propagation2 Constraint Propagation … … is the process of determining how the possible values of.

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)
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
MBD and CSP Meir Kalech Partially based on slides of Jia You and Brian Williams.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
8 주 강의 Game Playing. Games as search problems Chess, Go Simulation of war (war game) 스타크래프트의 전투 Claude Shannon, Alan Turing  Chess program (1950 년대 )
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
This time: Outline Game playing The minimax algorithm
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Game Playing CSC361 AI CSC361: Game Playing.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
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
Constraint Satisfaction Problems Russell and Norvig: Chapter 5 CMSC 421 – Fall 2005.
Constraint Satisfaction Problems
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
CSPs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 9 of 14 Friday, 10 September.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
CS B551: E LEMENTS OF A RTIFICIAL I NTELLIGENCE Instructor: Kris Hauser 1.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
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
Computing & Information Sciences Kansas State University Monday, 11 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 8 of 42 Monday, 11 September.
Constraint Satisfaction Problems (Chapter 6)
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Computing & Information Sciences Kansas State University Friday, 08 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 7 of 42 Friday, 08 September.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
EXAMPLE: MAP COLORING. Example: Map coloring Variables — WA, NT, Q, NSW, V, SA, T Domains — D i ={red,green,blue} Constraints — adjacent regions must.
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.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Game Search & Constrained Search CMSC Artificial Intelligence January 18, 2005.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Last time: search strategies
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Iterative Deepening A*
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems Lecture # 14, 15 & 16
CS B551: Elements of Artificial Intelligence
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Propagation
Constraint Propagation
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Propagation
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Constraint Propagation CS121 – Winter 2003

Constraint Propagation2 Constraint Propagation … … is the process of determining how the possible values of one variable affect the possible values of other variables

Constraint Propagation3 Forward Checking After a variable X is assigned a value v, look at each unassigned variable Y that is connected to X by a constraint and deletes from Y’s domain any value that is inconsistent with v

Constraint Propagation4 Map Coloring WANTQNSWVSAT RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB T WA NT SA Q NSW V

Constraint Propagation5 Map Coloring WANTQNSWVSAT RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB RGBGBRGBRGBRGBRGBRGBRGBGBGBRGBRGB T WA NT SA Q NSW V

Constraint Propagation6 WANTQNSWVSAT RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB RGBGBRGBRGBRGBRGBRGBRGBGBGBRGBRGB RBGRBRBRGBRGBBRGBRGB Map Coloring T WA NT SA Q NSW V

Constraint Propagation7 Map Coloring WANTQNSWVSAT RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB RGBGBRGBRGBRGBRGBRGBRGBGBGBRGBRGB RBGRBRBRGBRGBBRGBRGB RBGRBRGBRGB Impossible assignments that forward checking do not detect T WA NT SA Q NSW V

Constraint Propagation8 constraint propagation  constraint propagation

Constraint Propagation9 Edge Labeling in Computer Vision Russell and Norvig: Chapter 24, pages

Constraint Propagation10 Edge Labeling

Constraint Propagation11 Edge Labeling

Constraint Propagation12 Edge Labeling + –

Constraint Propagation13 Edge Labeling

Constraint Propagation14 Junction Label Sets (Waltz, 1975; Mackworth, 1977)

Constraint Propagation15 Edge Labeling as a CSP A variable is associated with each junction The domain of a variable is the label set of the corresponding junction Each constraint imposes that the values given to two adjacent junctions give the same label to the joining edge

Constraint Propagation16 Edge Labeling

Constraint Propagation17 Edge Labeling

Constraint Propagation18 Edge Labeling

Constraint Propagation19 Edge Labeling

Constraint Propagation20 Removal of Arc Inconsistencies REMOVE-ARC-INCONSISTENCIES(J,K) removed  false X  label set of J Y  label set of K For every label y in Y do If there exists no label x in X such that the constraint (x,y) is satisfied then  Remove y from Y  If Y is empty then contradiction  true  removed  true Label set of K  Y Return removed

Constraint Propagation21 CP Algorithm for Edge Labeling Associate with every junction its label set contradiction  false Q  stack of all junctions while Q is not empty and not contradiction do J  UNSTACK(Q) For every junction K adjacent to J do  If REMOVE-ARC-INCONSISTENCIES(J,K) then STACK(K,Q) (Waltz, 1975; Mackworth, 1977)

Constraint Propagation22 General CP for Binary Constraints Algorithm AC3 contradiction  false Q  stack of all variables while Q is not empty and not contradiction do X  UNSTACK(Q) For every variable Y adjacent to X do  If REMOVE-ARC-INCONSISTENCIES(X,Y) then STACK(Y,Q)

Constraint Propagation23 General CP for Binary Constraints REMOVE-ARC-INCONSISTENCY(X,Y) removed  false For every value y in the domain of Y do If there exists no value x in the domain of X such that the constraints on (x,y) is satisfied then  Remove y from the domain of Y  If Y is empty then contradiction  true  removed  true Return removed Algorithm AC3 contradiction  false Q  stack of all variables while Q is not empty and not contradiction do X  UNSTACK(Q) For every variable Y adjacent to X do  If REMOVE-ARC-INCONSISTENCY(X,Y) then STACK(Y,Q)

Constraint Propagation24 Complexity Analysis of AC3 n = number of variables d = number of values per variable s = maximum number of constraints on a pair of variables Each variables is inserted in Q up to d times REMOVE-ARC-INCONSISTENCY takes O(d 2 ) time CP takes O(n s d 3 ) time

Constraint Propagation25 Is AC3 All What is Needed? NO! XY Z X  Y X  ZY  Z {1, 2}

Constraint Propagation26 Solving a CSP Interweave constraint propagation, e.g., forward checking AC3 and backtracking + Take advantage of the CSP structure

Constraint Propagation27 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation28 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation29 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation30 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation31 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation32 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation33 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation34 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation35 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation36 4-Queens Problem X1 {1,2,3,4} X3 {1,2,3,4} X4 {1,2,3,4} X2 {1,2,3,4}

Constraint Propagation37 Structure of CSP If the constraint graph contains multiple components, then one independent CSP per component T WA NT SA Q NSW V

Constraint Propagation38 Structure of CSP If the constraint graph contains multiple components, then one independent CSP per component If the constraint graph is a tree (no loop), then the CSP can be solved efficiently

Constraint Propagation39 Constraint Tree X YZ U V W  (X, Y, Z, U, V, W)

Constraint Propagation40 Constraint Tree Order the variables from the root to the leaves  (X 1, X 2, …, X n ) For j = n, n-1, …, 2 do REMOVE-ARC-INCONSISTENCY( X j, X i ) where X i is the parent of X j Assign any legal value to X 1 For j = 2, …, n do assign any value to X j consistent with the value assigned to X i, where X i is the parent of X j

Constraint Propagation41 Structure of CSP If the constraint graph contains multiple components, then one independent CSP per component If the constraint graph is a tree, then the CSP can be solved efficiently Whenever a variable is assigned a value by the backtracking algorithm, propagate this value and remove the variable from the constraint graph WA NT SA Q NSW V

Constraint Propagation42 Structure of CSP If the constraint graph contains multiple components, then one independent CSP per component If the constraint graph is a tree, then the CSP can be solved in linear time Whenever a variable is assigned a value by the backtracking algorithm, propagate this value and remove the variable from the constraint graph WA NT Q NSW V

Constraint Propagation43 Over-Constrained Problems Weaken an over-constrained problem by: Enlarging the domain of a variable Loosening a constraint Removing a variable Removing a constraint

Constraint Propagation44 Non-Binary Constraints So far, all constraints have been binary (two variables) or unary (one variable) Constraints with more than 2 variables would be difficult to propagate Theoretically, one can reduce a constraint with k>2 variables to a set of binary constraints by introducing additional variables

Constraint Propagation45 When to Use CSP Techniques? When the problem can be expressed by a set of variables with constraints on their values When constraints are relatively simple (e.g., binary) When constraints propagate well (AC3 eliminates many values) When the solutions are “densely” distributed in the space of possible assignments

Constraint Propagation46 Summary Forward checking Constraint propagation Edge labeling in Computer Vision Interweaving CP and backtracking Exploiting CSP structure Weakening over-constrained CSP

Game Playing

Constraint Propagation48 Games as search problems Chess, Go Simulation of war (war game) 스타크래프트의 전투 Claude Shannon, Alan Turing  Chess program (1950 년대 )

Constraint Propagation49 Contingency problems The opponent introduces uncertainty 마이티에서는 co-work 이 필요 고스톱에서는 co-work 방지가 필요 Hard to solve  in chess, possible nodes, different legal positions Time limits  how to make the best use of time to reach good decisions Pruning, heuristic evaluation function

Constraint Propagation50 Perfect decisions in two person games The initial state, A set of operators, A terminal test, A utility function (payoff function) Mini-max algorithm, Negmax algorithms

Constraint Propagation51 Mini-max algorithm (AND-OR tree)

Constraint Propagation52 상대방의 관점

Constraint Propagation53 Negmax Knuth and Moore (1975) F(n) = f(n), if n has no successors F(n) = max{-F(n 1 ), …, -F(n k )}, if n has successors n 1, …, n k

Constraint Propagation54 The Negmax formalism

Constraint Propagation55 Imperfect Decisions utility function  evaluation terminal test  cutoff test Evaluation function ::: an estimate of the utility of the game from a given position Chess  material value ( 장기도 유사 ) Weighted linear function  w 1 f 1 +w 2 f 2 +….+w n f n

Constraint Propagation56 Cutting off search To set a fixed depth limit, so that the cutoff test succeeds for all nodes at or below depth d  iterative deepening until time runs out  위험이 있을 수 있다 Quiescent posiiton ::: unlikely to exhibit wild swings in value in near future Quiescent search :: Non-quiescent search  extra search to find quiescent position Horizon problem

Constraint Propagation57 Alpha-beta pruning Eliminate unnecessary evaluations Pruning

Constraint Propagation58 Alpha-beta pruning Alpha cutoff Beta cutoff

Constraint Propagation59 Negmax representation

Constraint Propagation60 Example

Constraint Propagation61 Games with Chance Chance nodes  expected value Backgammon, 윷놀이 Expectimax value

Constraint Propagation62 A backgammon position

Constraint Propagation63 Comparision A 1 A A 1 A MAX DICE MIN

Constraint Propagation64 숙제 5.6, 5.8, 5.11, 5.15, 5.16, 5.17