# CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables.

## Presentation on theme: "CSP Yaron Kassner Winter 2013. Reminder Arc Consistency: the domains of pairs of variables are consistent. k-consistency: the domains of every k variables."— Presentation transcript:

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 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.

AC-3 complexity

Example: Cryptarithmetic Problem TWO + TWO _____ FOUR O R C1 W U C2 T F 01 01 0123456789 0123456789 0123456789 0123456789 0123456789 123456789 C301 C3 C2 C1

TWO + TWO _____ 1OUR O R C1 W U C2 T F 01 01 0123456789 0123456789 0123456789 0123456789 0123456789 1 C31 Characters are distinct 1 C2 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 01 01 023456789 023456789 023456789 023456789 023456789 1 C31 1 C2 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 01 01 023456789 23456789 02468 023456789 023456789 1 C31 1 C2 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 01 01 56789 23456789 02468 023456789 023456789 1 C31 1 C2 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 01 01 6789 23456789 02468 023456789 023456789 1 C31 1 C2 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 01 6789 23456789 02468 023456789 023456789 1 C31 1 1 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 01 678 357 02468 023456789 023456789 1 C31 1 1 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 01 678 357 046 023456789 023456789 1 C31 1 1 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 01 678 357 046 56789 023456789 1 C31 1 1 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 0 678 357 046 56789 023456789 1 C31 1 1 0 Example: Cryptarithmetic Problem

TW3 + TW3 _____ 13UR O R C1 W U C2 T F 1 0 678 3 046 56789 023456789 1 C31 1 1 0 Example: Cryptarithmetic Problem

TW3 + TW3 _____ 13U6 O R C1 W U C2 T F 1 0 678 3 6 56789 023456789 1 C31 1 1 0 Example: Cryptarithmetic Problem

6W3 + 6W3 _____ 13U6 O R C1 W U C2 T F 1 0 6 3 6 56789 023456789 1 C31 1 1 0 גלגול אחורה Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 01 678 357 046 56789 023456789 1 C31 1 1 C1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 1 678 357 046 56789 023456789 1 C31 1 1 1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 1 678 57 046 56789 023456789 1 C31 1 1 1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 1 678 57 04 56789 023456789 1 C31 1 1 1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 1 678 57 04 678 357 1 C31 1 1 1 Example: Cryptarithmetic Problem

TWO + TWO _____ 1OUR O R C1 W U C2 T F 1 1 78 57 04 678 357 1 C31 1 1 1 Example: Cryptarithmetic Problem

8WO + 8WO _____ 1OUR O R C1 W U C2 T F 1 1 8 57 04 678 357 1 C31 1 1 1 Example: Cryptarithmetic Problem

8W7 + 8W7 _____ 17UR O R C1 W U C2 T F 1 1 8 7 04 678 357 1 C31 1 1 1 Example: Cryptarithmetic Problem

8W7 + 8W7 _____ 17U4 O R C1 W U C2 T F 1 1 8 7 4 678 357 1 C31 1 1 1 Distinct character values Example: Cryptarithmetic Problem

867 + 867 _____ 17U4 O R C1 W U C2 T F 1 1 8 7 4 6 35 1 C31 1 1 1 Example: Cryptarithmetic Problem

867 + 867 _____ 1734 O R C1 W U C2 T F 1 1 8 7 4 6 3 1 C31 1 1 1 Example: Cryptarithmetic Problem