Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”,...
-
Upload
malcolm-gaines -
Category
Documents
-
view
223 -
download
0
Transcript of Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”,...
![Page 1: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/1.jpg)
Constraint Satisfaction Basics
strongly influenced by
Rina Dechter, “Constraint Processing” , 2003
![Page 2: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/2.jpg)
complete search space of a problem
variables V = {v1, v2, …., vn}
domains D = {D1, D2, …., Dn}, vi Di
search space T = D1 X D2 X…. X Dn
size of search space |D1|.|D2|.…..|Dn|
if there are no constraints,
any solution in T is feasible
![Page 3: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/3.jpg)
constraint satisfaction problems
variables V = {v1, v2, …., vn} domains D = {D1, D2, …., Dn}, vi Di constraints C = {C1, C2, …., Ck}
Ci is a relation on scope Si V Ci puts constraints on some variables in the problem
search space T = D1 X D2 X…. X Dn
a solution in the search space Twhose values violate a constraint is infeasible
a constraint satisfaction problem is often called a constraint network
![Page 4: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/4.jpg)
example: Sudoku puzzle variables V = {v11, v12, v13, ..., v99} domains D1= D2= D3= ... = D99 = {1,2,3,4,5,6,7,8,9} constraints: “no repeated values in row, columns or
squares; pre-assigned values” C = {C1, C2, …., C810} Ci is a relation on scope Si = {vi1, vi2}
algebraic: { (vi1,vi2) | vi1 ≠ vi2} Cj on Sj = {vj1}: { vj1 | vj1 = k }
for particular puzzle:
![Page 5: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/5.jpg)
example: Sudoku puzzle
4 8 2 5
5 3 4
7 ●● 8
5 9
2 7 1
2 6
8 9
9 7 6
8 1 7 4
81 variables Vi
Di = {1,2,3,4,5,6,7,8,9} i∀
each square is subject to 20 binary constraints of form Vi ≠ Vj
total = 81 * 20 / 2 = 810
a particular game also has ~ 25 constraints of form Vi = k
![Page 6: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/6.jpg)
describing constraints
scope Si:the set of variables on which a constraint Ci is defined
scheme S = {S1, S2, …, Sk } set of all scopes on which constraints are defined
arity of a constraint Ci is size of its scope |Si| unary constraint on one variable binary constraint on two variables n-ary constraint on n variables*
*n-ary constraints can be rewritten as (many) binaries
![Page 7: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/7.jpg)
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
![Page 8: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/8.jpg)
simple scheduling problem
five tasks to schedule, T1, T2, T3, T4, T5 variables? domains? constraints? scopes? arity?
![Page 9: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/9.jpg)
constraint graphs
vertices: variables edges: (binary) variable scopes
TSP scheduling problem
v1v1 v2v2
v4v4 v3v3
T1T1
T2T2
T3T3
T4T4
T5T5
![Page 10: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/10.jpg)
crossword puzzle (after Dechter)
HOSES LASER SHEET SNAIL
STEER ALSO EARN HIKE
IRON SAME EAT LET
RUN SUN TEN YES
ME IT NO US
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
![Page 11: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/11.jpg)
crossword puzzleHOSES LASER SHEET SNAIL
STEER ALSO EARN HIKE
IRON SAME EAT LET
RUN SUN TEN YES
ME IT NO US
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
variables: 13 (letters)
domains: alphabet
constraints:
S1 {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)}
![Page 12: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/12.jpg)
crossword puzzleHOSES LASER SHEET SNAIL
STEER ALSO EARN HIKE
IRON SAME EAT LET
RUN SUN TEN YES
ME IT NO US
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
S1 {1,2,3,4,5} arity 5
S2 {3,6,9,12}
S3 {5,7,11}
S4 {8,9,10,11}
S5 {10,13}
S6 {12,13}
![Page 13: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/13.jpg)
crossword puzzleHOSES LASER SHEET SNAIL
STEER ALSO EARN HIKE
IRON SAME EAT LET
RUN SUN TEN YES
ME IT NO US
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
partial solution
satisfying C4 and C5
over S4 S5 {8,9,10,11,13}
{(S,A,M,E,E)}
![Page 14: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/14.jpg)
graphs for arity > 2
hypergraph multiple nodes per “hyperedge”
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
![Page 15: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/15.jpg)
graphs for arity > 2
hypergraph
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
![Page 16: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/16.jpg)
graphs for arity > 2
dual of hypergraph nodes are constraints edges are common variables 11 22 33 44 55
7766
88 99
1212
1010 1111
1313
1,2,3,4,5
5,7,11
3,6,9,12
8,9,10,11
12,13
10,13
3
11
12
10
5 9 13
![Page 17: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/17.jpg)
crossword puzzleanother formulation
HOSES LASER SHEET SNAIL
STEER ALSO EARN HIKE
IRON SAME EAT LET
RUN SUN TEN YES
ME IT NO US
11 22 33 44 55
7766
88 99
1212
1010 1111
1313
variables: 6: 1 3 5 8 10 12
domains: words by length
constraints: crossings
S1 {1,3} S2 {1,5} S3 {10,12}
S4 {3,8} S5 {3,12} S6 {5,8}
S7 {10,8}
all binary constraints
![Page 18: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/18.jpg)
binary constraint networksonly unary and binary constraints
constraint deduction inferring new constraints from initial set
1. constraints between unconstrained variables
2. tightening of existing constraints
![Page 19: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/19.jpg)
constraint deduction example:
V = { v1,v2,v3}
D1 = D2 = D3 = { red, green}
C1: {(v2,v1)|v2 ≠v1} = {(red, green),(green, red)}
C2: {(v1,v3)|v1 ≠v3} = {(red, green),(green, red)}solutions: {(red, green, green), (green, red, red)}
redgreen
redgreen
redgreen
v1
v2 v3
![Page 20: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/20.jpg)
constraint deduction example:
new constraint network with same solutions--> better for partial solutions (more later)
redgreen
redgreen
redgreen
v1
v2 v3
redgreen
redgreen
redgreen
v1
v2 v3
inferred constraint: v2 = v3
![Page 21: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/21.jpg)
constraint composition
given two binary* constraints C1, C2
on scopes S1 = {x,y} and S2 = {y,z} then
the composition C3 =C1.C2 is defined on S3 = {x,z}
C3 = {(a,b)| a Dx, b Dz, cDy such that (a,c) C1 and (c,b) C2}
e.g., C1 = {(red, green),(green, red)}
C2 = {(red, green),(green, red)}
C3 =C1.C2 = {(red, red), (green, green)}
*also works for a unary and a binary
![Page 22: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/22.jpg)
inferring with constraints
Who owns the zebra? p.225
variables
domains
constraints
constraint graph
![Page 23: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/23.jpg)
Who owns the zebra?
variables
![Page 24: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/24.jpg)
Who owns the zebra?
variables and domains 25 variables
5 cars 5 pets 5 house colours 5 drinks 5 nationalities
the houses?? they are the elements of the domains
![Page 25: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/25.jpg)
Who owns the zebra?
variables and domains 25 variables, D = {1, 2, 3, 4, 5} for each variable
5 cars 5 pets 5 house colours 5 drinks 5 nationalities
![Page 26: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/26.jpg)
Who owns the zebra?
constraints explicit implicit assuming all binary, how many?
![Page 27: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/27.jpg)
Who owns the zebra?
constraints explicit 14 implicit 50 assuming all unary or binary,
how many?64
![Page 28: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/28.jpg)
Who owns the zebra?
binary constraint graph a 5-permutation as 10 binary constraints
milk
o.j.water
cocoaeggnog
![Page 29: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/29.jpg)
Who owns the zebra? binary constraint graph
5 permutations
drinks
colours
cars
petsnationalities
![Page 30: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/30.jpg)
Who owns the zebra? binary constraint graph
14 explicit constraints
drinks
colours
cars
petsnationalities
![Page 31: Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.](https://reader030.fdocuments.net/reader030/viewer/2022020417/56649ed55503460f94be5a99/html5/thumbnails/31.jpg)
Who owns the zebra?
drinks
colours
cars
pets
nationalities
1 2 3 4 5
horse
snail
dog
fox
zebra