CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are...
-
Upload
anika-coleson -
Category
Documents
-
view
213 -
download
0
Transcript of CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are...
![Page 1: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/1.jpg)
CSP
Yaron KassnerWinter 2013
![Page 2: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/2.jpg)
Reminder
• Arc Consistency: the domains of pairs of variables are consistent.
• k-consistency: the domains of every k variables are consistent.
• AC3 – an algorithm that reduces the domains of variables by enforcing arc-consistency.
![Page 3: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/3.jpg)
Reminder
• CSP problems can be solved using search.• Heuristics:
– assign the variable with the minimum number of remaining values
– Most constraining variable – choose the variable that constrains the most variables.
– choose the least-constraining-value: the value that is inconsistent with as few other values as possible.
• Forward checking – after assignment, reduce domain of neighboring variables.
• MAC – maintain arc-consistency: do a back-tracking search, and fix arc consistency after every assignment.
![Page 4: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/4.jpg)
AC-3 complexity
![Page 5: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/5.jpg)
Example: Cryptarithmetic Problem
TWO+ TWO _____ FOUR
O
R
C1
W
U
C2
T
F
0 1
0 1
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
C3 0 1
3C F
C3 C2 C1
![Page 6: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/6.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
0 1
0 1
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
1
C3 1
Characters are distinct
1 C2 C1
Example: Cryptarithmetic Problem
![Page 7: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/7.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
0 1
0 1
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
%10O O R O R
1 C2 C1Example: Cryptarithmetic Problem
![Page 8: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/8.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
0 1
0 1
0 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9
0 2 4 6 8
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 C2 C1
2 9T T C
Example: Cryptarithmetic Problem
![Page 9: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/9.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
0 1
0 1
5 6 7 8 9
2 3 4 5 6 7 8 9
0 2 4 6 8
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 C2 C1
2 %10T T C O
Example: Cryptarithmetic Problem
![Page 10: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/10.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
0 1
0 1
6 7 8 9
2 3 4 5 6 7 8 9
0 2 4 6 8
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 C2 C1
MRVLCV
Example: Cryptarithmetic Problem
![Page 11: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/11.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0 1
6 7 8 9
2 3 4 5 6 7 8 9
0 2 4 6 8
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 C1
1 %10 ,T T O T O
Example: Cryptarithmetic Problem
![Page 12: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/12.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0 1
6 7 8
3 5 7
0 2 4 6 8
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 C1
%10O O R
Example: Cryptarithmetic Problem
![Page 13: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/13.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0 1
6 7 8
3 5 7
0 4 6
0 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 C1
1 9W W C
Example: Cryptarithmetic Problem
![Page 14: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/14.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0 1
6 7 8
3 5 7
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 C1
MRVLCV
Example: Cryptarithmetic Problem
![Page 15: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/15.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0
6 7 8
3 5 7
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 0
10O O
Example: Cryptarithmetic Problem
![Page 16: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/16.jpg)
TW3+ TW3 _____ 13UR
O
R
C1
W
U
C2
T
F
1
0
6 7 8
3
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 0
3 3 R
Example: Cryptarithmetic Problem
![Page 17: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/17.jpg)
TW3+ TW3 _____ 13U6
O
R
C1
W
U
C2
T
F
1
0
6 7 8
3
6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 0
1 10 3T T
Example: Cryptarithmetic Problem
![Page 18: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/18.jpg)
6W3+ 6W3 _____ 13U6
O
R
C1
W
U
C2
T
F
1
0
6
3
6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 0
אחורה גלגול
Example: Cryptarithmetic Problem
![Page 19: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/19.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
0 1
6 7 8
3 5 7
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 C1
MRV
Example: Cryptarithmetic Problem
![Page 20: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/20.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
6 7 8
3 5 7
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 1
9O O
Example: Cryptarithmetic Problem
![Page 21: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/21.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
6 7 8
5 7
0 4 6
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 1
10O O R
Example: Cryptarithmetic Problem
![Page 22: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/22.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
6 7 8
5 7
0 4
5 6 7 8 9
0 2 3 4 5 6 7 8 9
1
C3 1
1 1 1
1 10W W U
Example: Cryptarithmetic Problem
![Page 23: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/23.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
6 7 8
5 7
0 4
6 7 8
3 5 7
1
C3 1
1 1 1
1 10T T O
Example: Cryptarithmetic Problem
![Page 24: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/24.jpg)
TWO+ TWO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
7 8
5 7
0 4
6 7 8
3 5 7
1
C3 1
1 1 1
MRVLCV
Example: Cryptarithmetic Problem
![Page 25: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/25.jpg)
8WO+ 8WO _____ 1OUR
O
R
C1
W
U
C2
T
F
1
1
8
5 7
0 4
6 7 8
3 5 7
1
C3 1
1 1 1
Example: Cryptarithmetic Problem
![Page 26: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/26.jpg)
8W7+ 8W7 _____ 17UR
O
R
C1
W
U
C2
T
F
1
1
8
7
0 4
6 7 8
3 5 7
1
C3 1
1 1 1
Example: Cryptarithmetic Problem
![Page 27: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/27.jpg)
8W7+ 8W7 _____ 17U4
O
R
C1
W
U
C2
T
F
1
1
8
7
4
6 7 8
3 5 7
1
C3 1
1 1 1
Distinct character values
Example: Cryptarithmetic Problem
![Page 28: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/28.jpg)
867+ 867 _____ 17U4
O
R
C1
W
U
C2
T
F
1
1
8
7
4
6
3 5
1
C3 1
1 1 1Example: Cryptarithmetic Problem
![Page 29: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/29.jpg)
867+ 867 _____ 1734
O
R
C1
W
U
C2
T
F
1
1
8
7
4
6
3
1
C3 1
1 1 1Example: Cryptarithmetic Problem
![Page 30: CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.](https://reader035.fdocuments.us/reader035/viewer/2022062712/56649c7c5503460f9493015e/html5/thumbnails/30.jpg)
Example: Zebra puzzle
• http://www.youtube.com/watch?v=_dcsqBY04OY
• Some kind of MAC.