4
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

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

Embed Size (px)

Citation preview

Page 1: 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

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?

Page 2: 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

Example of a CSP Problem

• 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[1,1]

T[8,8]

Page 3: 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

Graph Coloring• Given a graph, we want to:

1. Assign a color to each node

2. No two nodes that are connected have the same color assigned to them

3. We want to use the minimum number of colors possible that satisfiers 1 and 2

Page 4: 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

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 problemShow 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)