50 likes | 217 Vues
Constraint Satisfaction. Definition . A constraint is a formula of the form: (x = y) (x y) (x = red) (x red) Where x and y are variables that can take values from a set (e.g., {yellow, white, black, red, …}) Definition . A constraint formula is a collection of constraints.
E N D
Constraint Satisfaction • Definition. A constraint is a formula of the form: • (x = y) • (x y) • (x = red) • (x red) • Where x and y are variables that can take values from a set (e.g., {yellow, white, black, red, …}) • Definition. A constraint formula is a collection of constraints. • Definition. Given a constraint formula is there an instantiation of the variables that makes the formula true • Example: ( x = y) ( x z) (y z) • Definition.Constraint-SAT: given a constraint formula, is there an instantiation of the variables that makes the conjunction true?
Example of a CSP Problem T[1,1] • 8-queens problem: • Put 8 queens in a chess board such that no queen is threatening another queen • Modeling the 8-queens problem as a CSP problem: • Make 8 variables, one for every queen: Q1, Q2, …, Q8 • Assume that each variable can take a value T[1,1]…T[8,8] • Constraints: homework. See slide 4 T[8,8]
Graph Coloring • Given a graph, we want to: • Assign a color to each node • No two nodes that are connected have the same color assigned to them • We want to use the minimum number of colors possible that satisfiers 1 and 2
Homework Part I: Nov. 15 • CSE 435: Write the constraints for the 8-queen problem. To make things easier use more expressive constraints: • i j : Q4 = A[i,j] • k if Q3 = A[i,j] then k j • CSE 335: write pseudo-code of program that receives Q1,…,Q8 and checks if it solves the 8-queen problem • CSE 435: • Formulate Graph coloring as a decision problem • Show that Constraint-SAT can be polynomially transformed into Graph Coloring (that is, we can transform constraint-SAT into a Graph coloring problem, and this transformation can be done in polynomialm time)