Presentation is loading. Please wait.

Presentation is loading. Please wait.

Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”

Similar presentations


Presentation on theme: "Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”"— Presentation transcript:

1 Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”

2 complete search space of a problem  variables V = {v 1, v 2, …., v n }  domains D = {D 1, D 2, …., D n }, v i  D i  search space T = D 1 X D 2 X…. X D n  size of search space |D 1 |. |D 2 |. ….. |D n | if there are no constraints, any solution in T is feasible

3 constraint satisfaction problems  variables V = {v 1, v 2, …., v n }  domains D = {D 1, D 2, …., D n }, v i  D i  constraints C = {C 1, C 2, …., C k } C i is a relation on scope S i  V C i puts constraints on some variables in the problem  search space T = D 1 X D 2 X…. X D n a solution in the search space T whose values violate a constraint is infeasible a constraint satisfaction problem is often called a constraint network

4 example: 4 queens problem column version  variables V = {v 1, v 2, v 3, v 4 }  domains D 1 = D 2 = D 3 = D 4 = {1,2,3,4}  constraints: “no two queens should attack one another” C = {C 1, C 2, …., C 6 } C 1 is a relation on scope S 1 = {v 1, v 2 } (constraint between first and second queens) enumerated: {(1,3),(1,4),(2,4),(3,1),(4,1),(4,2)} algebraic: { (v 1,v 2 ) | v 1 ≠ v 2, v 1 ≠ v 2 ± 1 }  others defined likewise v 1 v 2 v 3 v 4 12341234

5 describing constraints  scope S i :the set of variables on which a constraint C i is defined  scheme S = {S 1, S 2, …, S k } set of all scopes on which constraints are defined  arity of a constraint C i is the size of its scope |S i | unary constraint on one variable binary constraint on two variables (4 queens eg) n-ary constraint on n variables* *n-ary constraints can be rewritten as (many) binaries

6 simple scheduling problem five tasks to schedule, T1, T2, T3, T4, T5  each lasts one hour  each may start at 1PM, 2PM, 3PM  tasks can be executed simultaneously except: T1 starts after T3 T3 starts before T4 and after T5 T2 cannot be concurrent with T1 or T4 T4 cannot start at 2PM

7 simple scheduling problem five tasks to schedule, T1, T2, T3, T4, T5  variables? domains?  constraints? scopes? arity?

8 constraint graphs  vertices: variables  edges: (binary) variable scopes 4 queensscheduling problem v1v1 v1v1 v2v2 v2v2 v4v4 v4v4 v3v3 v3v3 T1 T2 T3 T4 T5

9 crossword puzzle (after Dechter) HOSESLASERSHEETSNAIL STEERALSOEARNHIKE IRONSAMEEATLET RUNSUNTENYES MEITNOUS 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13

10 crossword puzzle HOSESLASERSHEETSNAIL STEERALSOEARNHIKE IRONSAMEEATLET RUNSUNTENYES MEITNOUS 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13 variables: 13 (letters) domains: alphabet constraints: S 1 {1,2,3,4,5} C1 {(H,O,S,E,S), (L,A,S,E,R), (S,H,E,E,T), (S,N,A,I,L), (S,T,E,E,R)}

11 crossword puzzle HOSESLASERSHEETSNAIL STEERALSOEARNHIKE IRONSAMEEATLET RUNSUNTENYES MEITNOUS 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13 S 1 {1,2,3,4,5} arity 5 S 2 {3,6,9,12} S 3 {5,7,11} S 4 {8,9,10,11} S 5 {10,13} S 6 {12,13}

12 crossword puzzle HOSESLASERSHEETSNAIL STEERALSOEARNHIKE IRONSAMEEATLET RUNSUNTENYES MEITNOUS 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13 partial solution satisfying C 4 and C 5 over S 4  S 5 {8,9,10,11,13} {(S,A,M,E,E)}

13 graphs for arity > 2  hypergraph multiple nodes per “hyperedge” 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13

14 graphs for arity > 2  dual of hypergraph nodes are constraints edges are common variables 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13 1,2,3,4,5 5,7,11 3,6,9,12 8,9,10,11 12,13 10,13 3 11 12 10 59 13

15 crossword puzzle another formulation HOSESLASERSHEETSNAIL STEERALSOEARNHIKE IRONSAMEEATLET RUNSUNTENYES MEITNOUS 1 1 2 2 3 3 4 4 5 5 7 7 6 6 8 8 9 9 12 10 11 13 variables: 6 domains: words by length constraints: crossings S 1 {1,3}S 2 {1,5}S 3 {10,12} S 4 {3,8}S 5 {3,12}S 6 {5,8} S 7 {10,8} all binary constraints

16 binary constraint networks only unary and binary constraints  constraint deduction inferring new constraints from initial set 1.constraints between unconstrained variables 2.tightening of existing constraints

17 constraint deduction example: V = { v 1,v 2,v 3 } D 1 = D 2 = D 3 = { red, green} C 1 : {(v 2,v 1 )|v 2 ≠v 1 } = {(red, green),(green, red)} C 2 : {(v 1,v 3 )|v 1 ≠v 3 } = {(red, green),(green, red)} solutions: {(red, green, green), (green, red, red)} red green red green red green v1v1 v2v2 v3v3

18 constraint deduction example: new constraint network with same solutions --> better for partial solutions (more later) red green red green red green v1v1 v2v2 v3v3 red green red green red green v1v1 v2v2 v3v3 inferred constraint: v 2 = v 3

19 constraint composition given two binary* constraints C 1, C 2 on scopes S 1 = {x,y} and S 2 = {y,z} then the composition C 3 =C 1. C 2 is defined on S 3 = {x,z} C3 = {(a,b)| a  D x, b  D z,  c  Dy such that (a,c)  C 1 and (c,b)  C 2 } e.g.,C 1 = {(red, green),(green, red)} C 2 = {(red, green),(green, red)} C 3 =C 1. C 2 = {(red, red), (green, green)} *also works for a unary and a binary

20 inferring with constraints who owns the zebra? variables domains constraints constraint graph


Download ppt "Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”"

Similar presentations


Ads by Google