300 likes | 502 Views
CSP. Yaron Kassner Winter 2013. 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. Reminder.
E N D
CSP YaronKassner Winter 2013
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.
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.
Example: Cryptarithmetic Problem C3 C2 C1 C2 0 1 TWO + TWO _____ FOUR T 0 1 2 3 4 5 6 7 8 9 O 0 1 2 3 4 5 6 7 8 9 R 0 1 2 3 4 5 6 7 8 9 C1 0 1 W 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 U F 1 2 3 4 5 6 7 8 9 C3 0 1
Example: Cryptarithmetic Problem 1 C2 C1 C2 0 1 TWO + TWO _____ 1OUR T 0 1 2 3 4 5 6 7 8 9 O 0 1 2 3 4 5 6 7 8 9 R 0 1 2 3 4 5 6 7 8 9 C1 0 1 W 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 U F 1 C3 1 Characters are distinct
Example: Cryptarithmetic Problem 1 C2 C1 C2 0 1 TWO + TWO _____ 1OUR T 0 2 3 4 5 6 7 8 9 O 0 2 3 4 5 6 7 8 9 R 0 2 3 4 5 6 7 8 9 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 C2 C1 C2 0 1 TWO + TWO _____ 1OUR T 0 2 3 4 5 6 7 8 9 O 2 3 4 5 6 7 8 9 R 0 2 4 6 8 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 C2 C1 C2 0 1 TWO + TWO _____ 1OUR T 5 6 7 8 9 O 2 3 4 5 6 7 8 9 R 0 2 4 6 8 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 C2 C1 C2 0 1 TWO + TWO _____ 1OUR T 6 7 8 9 O 2 3 4 5 6 7 8 9 R 0 2 4 6 8 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 C1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 9 O 2 3 4 5 6 7 8 9 R 0 2 4 6 8 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 C1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 2 4 6 8 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 C1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 4 6 C1 0 1 W 0 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 C1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 4 6 C1 0 1 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 0 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 4 6 C1 0 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 0 C2 1 TW3 + TW3 _____ 13UR T 6 7 8 O 3 R 0 4 6 C1 0 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 0 C2 1 TW3 + TW3 _____ 13U6 T 6 7 8 O 3 R 6 C1 0 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 0 C2 1 6W3 + 6W3 _____ 13U6 T 6 O 3 R 6 C1 0 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1 גלגול אחורה
Example: Cryptarithmetic Problem 1 1 C1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 4 6 C1 0 1 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 3 5 7 R 0 4 6 C1 1 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 5 7 R 0 4 6 C1 1 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 5 7 R 0 4 C1 1 W 5 6 7 8 9 0 2 3 4 5 6 7 8 9 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 TWO + TWO _____ 1OUR T 6 7 8 O 5 7 R 0 4 C1 1 W 6 7 8 3 5 7 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 TWO + TWO _____ 1OUR T 7 8 O 5 7 R 0 4 C1 1 W 6 7 8 3 5 7 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 8WO + 8WO _____ 1OUR T 8 O 5 7 R 0 4 C1 1 W 6 7 8 3 5 7 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 8W7 + 8W7 _____ 17UR T 8 O 7 R 0 4 C1 1 W 6 7 8 3 5 7 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 8W7 + 8W7 _____ 17U4 T 8 O 7 R 4 C1 1 W 6 7 8 3 5 7 U F 1 C3 1 Distinct character values
Example: Cryptarithmetic Problem 1 1 1 C2 1 867 + 867 _____ 17U4 T 8 O 7 R 4 C1 1 W 6 3 5 U F 1 C3 1
Example: Cryptarithmetic Problem 1 1 1 C2 1 867 + 867 _____ 1734 T 8 O 7 R 4 C1 1 W 6 3 U F 1 C3 1
Example: Zebra puzzle • http://www.youtube.com/watch?v=_dcsqBY04OY • Some kind of MAC.