Constraint Satisfaction Problem: Artificial Intelligence Sessional Lab-5
Constraint Satisfaction Problem: Artificial Intelligence Sessional Lab-5
It consists of –
A finite set of variables
V = {V1, V2, V3,....., Vn}
A set of discrete values known as domain
D = {D1, D2, D3,.....,Dn}
A finite set of constraints
C = {C1, C2, C3,......, Cn}
Popular Problems of CSP
CryptArithmetic (Coding alphabets to numbers.)
n-Queen (In an n-queen problem, n queens should be placed in a nXn
matrix such that no queen shares the same row, column or diagonal.)
Map Coloring (Coloring different regions of map ensuring no adjacent
regions have the same color.)
Crossword (Everyday puzzles appearing in newspapers.)
Sudoku (A number grid.)
Converting problems to CSPs
A problem to be converted to CSP requires the following steps:
8 3 7
3 5 6 4
2 8
8 3 1
4 7 3 5 1
7 5 6 4
5 4 1 6
Sudoku
5 1 2 8 7 9 4 6 3
6 8 4 1 3 2 5 7 9
3 9 7 5 6 4 1 8 2
7 5 1 6 4 3 9 2 8
8 3 9 2 1 5 7 4 6
2 4 6 7 9 8 3 5 1
1 7 8 3 5 6 2 9 4
4 6 3 9 2 7 8 1 5
9 2 5 4 8 1 6 3 7
Let’s solving Sudoku using choco-solver