Lec 4
Lec 4
Lec 4
N variables
domain D
constraints
x2
x1
o Domains:
Explicit:
o Formulation 2:
o Variables:
o Domains:
o Constraints:
Implicit:
Explicit:
Example: Cryptarithmetic
X1
o Variables:
o Domains:
o Constraints:
Example: Sudoku
§ Variables:
§ Each (open) square
§ Domains:
§ {1,2,…,9}
§ Constraints:
{}
{WA=g} {WA=r} … {NT=g} …
o Ordering:
o Which variable should be assigned next?
o In what order should its values be tried?
Keep track of domains for unassigned variables and cross off bad options
Filtering: Forward Checking
o Filtering: Keep track of domains for unassigned variables and cross off bad
options
o Forward checking: Cross off values that violate a constraint when added to the
existing assignment
NT Q
WA
SA NSW
V
NT Q
WA
SA
NSW
V
NT Q
WA
SA
NSW
V
NT Q
WA SA
NSW
V