Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSPs Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.

Similar presentations


Presentation on theme: "CSPs Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew."— Presentation transcript:

1 CSPs Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew Moore, Percy Liang, Luke Zettlemoyer

2 Constraint Satisfaction Problems (Chapter 6)

3 What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search for planning – The path to the goal is the important thing – Paths have various costs, depths Search for assignment – Assign values to variables while respecting certain constraints – The goal (complete, consistent assignment) is the important thing

4 Constraint satisfaction problems (CSPs) Definition: – X i is a set of variables {X 1,… X n } – D i is a set of domains {D 1,... D n } one for each variable – C is a set of constraints that specify allowable combinations of values – Solution is a complete, consistent assignment How does this compare to the “generic” tree search formulation? – A more structured representation for states, expressed in a formal representation language – Allows useful general-purpose algorithms with more power than standard search algorithms by eliminating large portions of search space (identifying var/val combinations that violate constraints).

5 Example: Map Coloring Variables: WA, NT, Q, NSW, V, SA, T Domains: {red, green, blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA, NT) in {(red, green), (red, blue), (green, red), (green, blue), (blue, red), (blue, green)}

6 Example: Map Coloring Solutions are complete and consistent assignments, e.g., WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green

7 Example: n-queens problem Put n queens on an n × n board with no two queens in the same row, column, or diagonal

8 Example: N-Queens Variables: X ij Domains: {0, 1} Constraints:  i,j X ij = N (X ij, X ik )  {(0, 0), (0, 1), (1, 0)} (X ij, X kj )  {(0, 0), (0, 1), (1, 0)} (X ij, X i+k, j+k )  {(0, 0), (0, 1), (1, 0)} (X ij, X i+k, j–k )  {(0, 0), (0, 1), (1, 0)} X ij

9 N-Queens: Alternative formulation Variables: Q i Domains: {1, …, N} Constraints:  i, j non-threatening (Q i, Q j ) Q2Q2 Q1Q1 Q3Q3 Q4Q4

10 Example: Cryptarithmetic Variables: T, W, O, F, U, R X 1, X 2 Domains: {0, 1, 2, …, 9} Constraints: O + O = R + 10 * X 1 W + W + X 1 = U + 10 * X 2 T + T + X 2 = O + 10 * F Alldiff(T, W, O, F, U, R) T ≠ 0, F ≠ 0 X 2 X 1

11 Example: Sudoku Variables: X ij Domains: {1, 2, …, 9} Constraints: Alldiff(X ij in the same unit) X ij


Download ppt "CSPs Tamara Berg CS 590-133 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew."

Similar presentations


Ads by Google